Package gov.nih.mipav.util
Class ArrayUtil
- java.lang.Object
-
- gov.nih.mipav.util.ArrayUtil
-
public class ArrayUtil extends java.lang.Object
A class containing Array-related helper methods.
-
-
Constructor Summary
Constructors Constructor Description ArrayUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
arrayCopy(double[] src, int srcPos, float[] dest, int destPos, int length)
Copy a double array to a float array.static void
arrayCopy(float[] src, int srcPos, double[] dest, int destPos, int length)
Copy a float array to a double arraystatic void
copy2D(double[] srcData, int srcFrom, int srcXDim, int srcYDim, double[] destData, int destFrom, int destXDim, int destYDim, boolean source)
static void
copy2D(float[] srcData, int srcFrom, int srcXDim, int srcYDim, float[] destData, int destFrom, int destXDim, int destYDim, boolean source)
static void
copy3D(double[] srcData, int srcFrom, int srcXDim, int srcYDim, int srcZDim, double[] destData, int destFrom, int destXDim, int destYDim, int destZDim, boolean source)
static void
copy3D(float[] srcData, int srcFrom, int srcXDim, int srcYDim, int srcZDim, float[] destData, int destFrom, int destXDim, int destYDim, int destZDim, boolean source)
static void
copy4D(double[] srcData, int srcXDim, int srcYDim, int srcZDim, int srcTDim, double[] destData, int destXDim, int destYDim, int destZDim, int destTDim, boolean source)
static void
copy4D(float[] srcData, int srcXDim, int srcYDim, int srcZDim, int srcTDim, float[] destData, int destXDim, int destYDim, int destZDim, int destTDim, boolean source)
static void
print(double[] data)
A utility function to print out a double array.static void
print(float[] data)
A utility function to print out a double array.static void
rowCopy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length, int srcDist, int destDist)
Copy a row in x, y or z direction to an array.static void
rowCopy(double[] src, int srcPos, double[] dest, int destPos, int length, int srcDist, int destDist)
Copy a row in x, y or z direction to an array.
-
-
-
Method Detail
-
copy2D
public static void copy2D(float[] srcData, int srcFrom, int srcXDim, int srcYDim, float[] destData, int destFrom, int destXDim, int destYDim, boolean source)
-
copy3D
public static void copy3D(float[] srcData, int srcFrom, int srcXDim, int srcYDim, int srcZDim, float[] destData, int destFrom, int destXDim, int destYDim, int destZDim, boolean source)
-
copy4D
public static void copy4D(float[] srcData, int srcXDim, int srcYDim, int srcZDim, int srcTDim, float[] destData, int destXDim, int destYDim, int destZDim, int destTDim, boolean source)
-
copy2D
public static void copy2D(double[] srcData, int srcFrom, int srcXDim, int srcYDim, double[] destData, int destFrom, int destXDim, int destYDim, boolean source)
-
copy3D
public static void copy3D(double[] srcData, int srcFrom, int srcXDim, int srcYDim, int srcZDim, double[] destData, int destFrom, int destXDim, int destYDim, int destZDim, boolean source)
-
copy4D
public static void copy4D(double[] srcData, int srcXDim, int srcYDim, int srcZDim, int srcTDim, double[] destData, int destXDim, int destYDim, int destZDim, int destTDim, boolean source)
-
rowCopy
public static void rowCopy(double[] src, int srcPos, double[] dest, int destPos, int length, int srcDist, int destDist)
Copy a row in x, y or z direction to an array.- Parameters:
src
-srcPos
-dest
-destPos
-length
-srcDist
- the distance between two pixels of source data in x, y or z direction.destDist
- the distance between two pixels of destination data in x, y or z direction.
-
rowCopy
public static void rowCopy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length, int srcDist, int destDist)
Copy a row in x, y or z direction to an array.- Parameters:
src
-srcPos
-dest
-destPos
-length
-srcDist
- the distance between two pixels of source data in x, y or z direction.destDist
- the distance between two pixels of destination data in x, y or z direction.
-
arrayCopy
public static void arrayCopy(float[] src, int srcPos, double[] dest, int destPos, int length)
Copy a float array to a double array- Parameters:
src
- a float arraysrcPos
- the start position of the source arraydest
- a double arraydestPos
- the start position of the destination arraylength
- the length of data to be copied
-
arrayCopy
public static void arrayCopy(double[] src, int srcPos, float[] dest, int destPos, int length)
Copy a double array to a float array.- Parameters:
src
- a float arraysrcPos
- the start position of the source arraydest
- a double arraydestPos
- the start position of the destination arraylength
- the length of data to be copied
-
print
public static void print(double[] data)
A utility function to print out a double array.- Parameters:
data
- a double array.
-
print
public static void print(float[] data)
A utility function to print out a double array.- Parameters:
data
- a double array.
-
-