public class ImageUtils extends Object
| Modifier and Type | Method and Description | 
|---|---|
static ij.process.ByteProcessor | 
createByteProcessor(int[][] data)
Creates a new ByteProcessor initialized with the content of the input
 array. 
 | 
static ij.process.FloatProcessor | 
createFloatProcessor(float[][] data)
Creates a new FloatProcessor initialized with the content of the input
 array. 
 | 
static ij.process.ImageProcessor | 
createImageProcessor(int width,
                    int height,
                    int bitDepth)
Creates a new ImageProcessor from image dimensions and bit depth. 
 | 
static ij.process.ShortProcessor | 
createShortProcessor(int[][] data)
Creates a new ShortProcessor initialized with the content of the input
 array. 
 | 
static void | 
fillRect(ij.process.ImageProcessor image,
        int x0,
        int y0,
        int w,
        int h,
        double value)
Fills a rectangle within the image with the specified value. 
 | 
static void | 
fillRect3d(ij.ImageStack image,
          int x0,
          int y0,
          int z0,
          int w,
          int h,
          int d,
          double value)
Fills a 3D rectangle within the image with the specified value. 
 | 
static double | 
findMaxValue(ij.ImagePlus imagePlus)
Computes maximum value within the input image. 
 | 
static double | 
findMaxValue(ij.process.ImageProcessor image)
Computes maximum value within the input 2D image. 
 | 
static double | 
findMaxValue(ij.ImageStack image)
Computes maximum value in the input 3D image. 
 | 
static boolean | 
isColorImage(ij.ImagePlus imagePlus)
Checks if the specified image is a color image. 
 | 
static boolean | 
isSameSize(ij.ImagePlus image1,
          ij.ImagePlus image2)
Checks if the two input images have the same dimensionality and the same
 size in each direction. 
 | 
static boolean | 
isSameSize(ij.process.ImageProcessor image1,
          ij.process.ImageProcessor image2)
Checks if the two input images have the same size in each direction. 
 | 
static boolean | 
isSameSize(ij.ImageStack image1,
          ij.ImageStack image2)
Checks if the two input 3D images have the same size in each direction. 
 | 
static boolean | 
isSameType(ij.ImagePlus image1,
          ij.ImagePlus image2)
Checks if the two input images have the same data type. 
 | 
static boolean | 
isSameType(ij.process.ImageProcessor image1,
          ij.process.ImageProcessor image2)
Checks if the two input images have the same data type. 
 | 
static boolean | 
isSameType(ij.ImageStack image1,
          ij.ImageStack image2)
Checks if the two input 3D images have the same data type. 
 | 
static void | 
print(ij.process.ImageProcessor image)
Prints the content of the given ImageProcessor on the console. 
 | 
static void | 
print(ij.ImageStack image)
Prints the content of the given 3D image on the console. 
 | 
static void | 
replaceValue(ij.ImagePlus image,
            double initialValue,
            double finalValue)
Replaces the elements of an image with a given value by a new value. 
 | 
static void | 
replaceValue(ij.process.ImageProcessor image,
            double initialValue,
            double finalValue)
Replaces the elements of a 2D image with a given value by a new value. 
 | 
static void | 
replaceValue(ij.ImageStack image,
            double initialValue,
            double finalValue)
Replaces the elements of a 3D image with a given value by a new value. 
 | 
public static final ij.process.ImageProcessor createImageProcessor(int width,
                                                                   int height,
                                                                   int bitDepth)
width - the width of the new imageheight - the height of the new imagebitDepth - the bit-depth of the new image (must be one of 8, 16, 24, or
            32).public static final ij.process.ByteProcessor createByteProcessor(int[][] data)
    ImageProcessor image = ImageUtils.createByteProcessor(new int[][] {
        { 0,  0,  0,  0,  0},  
        { 0, 20, 20, 20,  0},  
        { 0, 20, 50, 20,  0},  
        { 0, 20, 20, 20,  0},  
        { 0,  0,  0,  0,  0},  
    });
 
 data - the array containing image data, as integer valuespublic static final ij.process.ShortProcessor createShortProcessor(int[][] data)
    ImageProcessor image = ImageUtils.createShortProcessor(new int[][] {
        { 0,  0,  0,  0,  0},  
        { 0, 20, 20, 20,  0},  
        { 0, 20, 50, 20,  0},  
        { 0, 20, 20, 20,  0},  
        { 0,  0,  0,  0,  0},  
    });
 
 data - the array containing image data, as integer valuespublic static final ij.process.FloatProcessor createFloatProcessor(float[][] data)
    ImageProcessor image = ImageUtils.createFloatProcessor(new float[][] {
        { 0,  0,  0,  0,  0},  
        { 0, 20, 20, 20,  0},  
        { 0, 20, 50, 20,  0},  
        { 0, 20, 20, 20,  0},  
        { 0,  0,  0,  0,  0},  
    });
 
 data - the array containing image data, as float valuespublic static final boolean isColorImage(ij.ImagePlus imagePlus)
imagePlus - the instance of ImagePlus to checkpublic static final boolean isSameSize(ij.ImagePlus image1,
                                       ij.ImagePlus image2)
image1 - the first imageimage2 - the second imagepublic static final boolean isSameSize(ij.process.ImageProcessor image1,
                                       ij.process.ImageProcessor image2)
image1 - the first imageimage2 - the second imagepublic static final boolean isSameSize(ij.ImageStack image1,
                                       ij.ImageStack image2)
image1 - the first imageimage2 - the second imagepublic static final boolean isSameType(ij.ImagePlus image1,
                                       ij.ImagePlus image2)
image1 - the first imageimage2 - the second imagepublic static final boolean isSameType(ij.process.ImageProcessor image1,
                                       ij.process.ImageProcessor image2)
image1 - the first imageimage2 - the second imagepublic static final boolean isSameType(ij.ImageStack image1,
                                       ij.ImageStack image2)
image1 - the first imageimage2 - the second imagepublic static final void fillRect(ij.process.ImageProcessor image,
                                  int x0,
                                  int y0,
                                  int w,
                                  int h,
                                  double value)
x0 (inclusive) and x0+width-1
 (inclusive)y0 (inclusive) and y0+height-1
 (inclusive)image - the image to process.x0 - the x-coordinate of the left corner of the rectangle to filly0 - the y-coordinate of the top corner of the rectangle to fillw - the width of the rectangle to fill, in pixelsh - the height of the rectangle to fill, in pixelsvalue - the value to fill the rectangle withpublic static final void fillRect3d(ij.ImageStack image,
                                    int x0,
                                    int y0,
                                    int z0,
                                    int w,
                                    int h,
                                    int d,
                                    double value)
x0 (inclusive) and x0+width-1
 (inclusive)y0 (inclusive) and y0+height-1
 (inclusive)z0 (inclusive) and z0+depth-1
 (inclusive)image - the image to process.x0 - the x-coordinate of the left corner of the rectangle to filly0 - the y-coordinate of the top corner of the rectangle to fillz0 - the z-coordinate of the front corner of the rectangle to fillw - the width of the rectangle to fill, in voxelsh - the height of the rectangle to fill, in voxelsd - the depth of the rectangle to fill, in voxelsvalue - the value to fill the 3D rectangle withpublic static final double findMaxValue(ij.ImagePlus imagePlus)
imagePlus - the image the analyzepublic static final double findMaxValue(ij.process.ImageProcessor image)
image - the image the analyzepublic static final double findMaxValue(ij.ImageStack image)
image - the 3D image the analyzepublic static final void replaceValue(ij.ImagePlus image,
                                      double initialValue,
                                      double finalValue)
image - the image to processinitialValue - the value of the elements to replacefinalValue - the new value of the elementspublic static final void replaceValue(ij.process.ImageProcessor image,
                                      double initialValue,
                                      double finalValue)
image - the 3D image to processinitialValue - the value of the elements to replacefinalValue - the new value of the elementspublic static final void replaceValue(ij.ImageStack image,
                                      double initialValue,
                                      double finalValue)
image - the 3D image to processinitialValue - the value of the elements to replacefinalValue - the new value of the elementspublic static final void print(ij.process.ImageProcessor image)
image - the image to display on the consolepublic static final void print(ij.ImageStack image)
image - the 3D image to display on the consoleCopyright © 2014–2023 INRA-IJPB Modeling and Digital Imaging lab. All rights reserved.