Package inra.ijpb.data.image
Class Images3D
java.lang.Object
inra.ijpb.data.image.Images3D
public class Images3D
extends java.lang.Object
A collection of static methods for working on 3D images.
- Author:
- David Legland
-
Method Summary
Modifier and Type Method Description static ij.ImageStack
adjustDynamic(ij.ImageStack image, double vmin, double vmax)
Returns a new instance of ImageStack containing ByteProcessors such that display range is specified by vmin and vmax.static ij.ImageStack
complement(ij.ImageStack image, double base)
Computes the complements of the input image using the specified value as reference, and returns the complemented image.static Image3D
createWrapper(ij.ImageStack stack)
Converts the input ImageStack into an instance of Image3D, depending on the data type stored in the stack.static void
fill(ij.ImageStack image, double value)
Fills the input 3D image with the given value.static double[]
findMinAndMax(ij.ImagePlus image)
Find minimum and maximum value of input imagestatic double[]
findMinAndMax(ij.ImageStack image)
Find minimum and maximum value of input imagestatic byte[][]
getByteArrays(ij.ImageStack image)
Extracts the byte arrays corresponding to the slices of a stack containing instances of ByteProcessor.static float[][]
getFloatArrays(ij.ImageStack image)
Extracts the float arrays corresponding to the slices of a stack containing instances of FloatProcessor.static short[][]
getShortArrays(ij.ImageStack image)
Extracts the short arrays corresponding to the slices of a stack containing instances of ShortProcessor.static void
invert(ij.ImageStack image)
Inverts the values of a 3D imagestatic boolean
isSameSize(ij.ImageStack image1, ij.ImageStack image2)
Deprecated.replaced by ImageUtils.isSameSize(...)static boolean
isSameType(ij.ImageStack image1, ij.ImageStack image2)
Deprecated.replaced by ImageUtils.isSameType(...)static void
optimizeDisplayRange(ij.ImagePlus image)
Optimize display range of 2d/3d image based on its minimum and maximum valuesstatic void
print(ij.ImageStack image)
Deprecated.replaced byImageUtils.print(ImageStack)
static void
replaceValue(ij.ImagePlus image, double initialValue, double finalValue)
Deprecated.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
createWrapper
Converts the input ImageStack into an instance of Image3D, depending on the data type stored in the stack.- Parameters:
stack
- the input ImageStack to convert- Returns:
- a new instance of Image3D that can be used to access or modify values in original stack
-
isSameSize
@Deprecated public static final boolean isSameSize(ij.ImageStack image1, ij.ImageStack image2)Deprecated.replaced by ImageUtils.isSameSize(...)Checks if the two input 3D images have the same size in each direction.- Parameters:
image1
- the first imageimage2
- the second image- Returns:
- true if both images have same width, height and number of slices, and false otherwise.
-
isSameType
@Deprecated public static final boolean isSameType(ij.ImageStack image1, ij.ImageStack image2)Deprecated.replaced by ImageUtils.isSameType(...)Checks if the two input 3D images have the same data type- Parameters:
image1
- the first imageimage2
- the second image- Returns:
- true if both images have the same data type, given by the bit depth.
-
findMinAndMax
public static final double[] findMinAndMax(ij.ImagePlus image)Find minimum and maximum value of input image- Parameters:
image
- input 2d/3d image- Returns:
- array of 2 extreme values
-
findMinAndMax
public static final double[] findMinAndMax(ij.ImageStack image)Find minimum and maximum value of input image- Parameters:
image
- input 2d/3d image- Returns:
- array of 2 extreme values
-
optimizeDisplayRange
public static final void optimizeDisplayRange(ij.ImagePlus image)Optimize display range of 2d/3d image based on its minimum and maximum values- Parameters:
image
- input image
-
adjustDynamic
public static final ij.ImageStack adjustDynamic(ij.ImageStack image, double vmin, double vmax)Returns a new instance of ImageStack containing ByteProcessors such that display range is specified by vmin and vmax.- Parameters:
image
- input image, that can be 8, 16 or 32 bitsvmin
- the value that will correspond to 0 in new imagevmax
- the value that will correspond to 255 in new image- Returns:
- a new ImageStack of byte processors with adjusted dynamic
-
replaceValue
public static final void replaceValue(ij.ImagePlus image, double initialValue, double finalValue)Deprecated.Replaces the elements of an image with a given value by a new values.- Parameters:
image
- the image to processinitialValue
- the value of the elements to replacefinalValue
- the new value of the elements
-
fill
public static final void fill(ij.ImageStack image, double value)Fills the input 3D image with the given value.- Parameters:
image
- the 3D image to processvalue
- the value used to fill input image
-
print
public static final void print(ij.ImageStack image)Deprecated.replaced byImageUtils.print(ImageStack)
Prints the content of the given 3D image on the console. This can be used for debugging (small) images.- Parameters:
image
- the 3D image to display on the console
-
complement
public static final ij.ImageStack complement(ij.ImageStack image, double base)Computes the complements of the input image using the specified value as reference, and returns the complemented image.- Parameters:
image
- the image to complementbase
- the reference value for computing complement (ususally 255)- Returns:
- the complemented image, with values equal to base value minus values from original image.
-
invert
public static final void invert(ij.ImageStack image)Inverts the values of a 3D image- Parameters:
image
- input image
-
getByteArrays
public static final byte[][] getByteArrays(ij.ImageStack image)Extracts the byte arrays corresponding to the slices of a stack containing instances of ByteProcessor.- Parameters:
image
- a 3D image that must contain byte values- Returns:
- the array of byte arrays corresponding to each slice
-
getShortArrays
public static final short[][] getShortArrays(ij.ImageStack image)Extracts the short arrays corresponding to the slices of a stack containing instances of ShortProcessor.- Parameters:
image
- a 3D image that must contain short values- Returns:
- the array of short arrays corresponding to each slice
-
getFloatArrays
public static final float[][] getFloatArrays(ij.ImageStack image)Extracts the float arrays corresponding to the slices of a stack containing instances of FloatProcessor.- Parameters:
image
- a 3D image that must contain float values- Returns:
- the array of float arrays corresponding to each slice
-