public class BinaryImages extends Object
LabelImages
Modifier and Type | Method and Description |
---|---|
static ij.process.ImageProcessor |
areaOpening(ij.process.ImageProcessor image,
int nPixelMin)
Applies area opening on a binary image: creates a new binary image that
contains only particles with at least the specified number of pixels.
|
static ij.ImagePlus |
binarize(ij.ImagePlus imagePlus)
Converts a grayscale 2D or 3D image into a binary image by setting
non-zero elements to 255.
|
static ij.process.ImageProcessor |
binarize(ij.process.ImageProcessor image)
Converts a grayscale 2D image into a binary 2D image by setting non-zero
pixels to 255.
|
static ij.ImageStack |
binarize(ij.ImageStack image)
Converts a grayscale 3D image into a binary 3D image by setting non-zero
voxels to 255.
|
static ij.ImagePlus |
binarizeBackground(ij.ImagePlus imagePlus)
Converts a grayscale 2D or 3D image into a binary image by setting
zero elements to 255, and non zero ones to 0.
|
static ij.process.ImageProcessor |
binarizeBackground(ij.process.ImageProcessor image)
Converts a grayscale 2D image into a binary 2D image by setting
zero elements to 255, and non zero ones to 0.
|
static ij.ImageStack |
binarizeBackground(ij.ImageStack image)
Converts a grayscale 3D image into a binary 3D image by setting
zero elements to 255, and non zero ones to 0.
|
static ij.ImagePlus |
componentsLabeling(ij.ImagePlus imagePlus,
int conn,
int bitDepth)
Computes the labels in the binary 2D or 3D image contained in the given
ImagePlus, and computes the maximum label to set up the display range of
the resulting ImagePlus.
|
static ij.process.ImageProcessor |
componentsLabeling(ij.process.ImageProcessor image,
int conn,
int bitDepth)
Computes the labels of the connected components in the given planar
binary image.
|
static ij.ImageStack |
componentsLabeling(ij.ImageStack image,
int conn,
int bitDepth)
Computes the labels of the connected components in the given 3D binary
image.
|
static int |
countForegroundPixels(ij.process.ImageProcessor image)
Counts the number of foreground pixels.
|
static int |
countForegroundVoxels(ij.ImageStack image)
Counts the number of foreground voxels.
|
static ij.ImagePlus |
distanceMap(ij.ImagePlus imagePlus)
Computes the distance map (or distance transform) from a binary image
processor.
|
static ij.process.ImageProcessor |
distanceMap(ij.process.ImageProcessor image)
Computes the distance map (or distance transform) from a binary image
processor.
|
static ij.process.ImageProcessor |
distanceMap(ij.process.ImageProcessor image,
ChamferMask2D mask,
boolean floatingPoint,
boolean normalize)
Computes the distance map from a binary image processor, by specifying
weights and normalization.
|
static ij.process.FloatProcessor |
distanceMap(ij.process.ImageProcessor image,
float[] weights,
boolean normalize)
Computes the distance map from a binary image processor, by specifying
weights and normalization.
|
static ij.process.ShortProcessor |
distanceMap(ij.process.ImageProcessor image,
short[] weights,
boolean normalize)
Computes the distance map from a binary image processor, by specifying
weights and normalization.
|
static ij.ImageStack |
distanceMap(ij.ImageStack image)
Computes the distance map from a binary 3D image.
|
static ij.ImageStack |
distanceMap(ij.ImageStack image,
ChamferMask3D chamferMask,
boolean floatingPoint,
boolean normalize)
Computes the distance map from a binary 3D image.
|
static ij.ImageStack |
distanceMap(ij.ImageStack image,
float[] weights,
boolean normalize)
Computes the distance map from a binary 3D image.
|
static ij.ImageStack |
distanceMap(ij.ImageStack image,
short[] weights,
boolean normalize)
Computes the distance map from a binary 3D image.
|
static ij.ImagePlus |
geodesicDistanceMap(ij.ImagePlus markerPlus,
ij.ImagePlus maskPlus)
Computes the geodesic distance transform (or geodesic distance map) of a
binary image of marker, constrained to a binary mask.
|
static ij.process.ImageProcessor |
geodesicDistanceMap(ij.process.ImageProcessor marker,
ij.process.ImageProcessor mask)
Computes the geodesic distance transform (or geodesic distance map) of a
binary image of marker, constrained to a binary mask.
|
static ij.process.ImageProcessor |
geodesicDistanceMap(ij.process.ImageProcessor marker,
ij.process.ImageProcessor mask,
float[] weights,
boolean normalize)
Computes the geodesic distance transform (or geodesic distance map) of a
binary image of marker, constrained to a binary mask.
|
static ij.process.ImageProcessor |
geodesicDistanceMap(ij.process.ImageProcessor marker,
ij.process.ImageProcessor mask,
short[] weights,
boolean normalize)
Computes the geodesic distance transform (or geodesic distance map) of a
binary image of marker, constrained to a binary mask.
|
static boolean |
isBinaryImage(ij.ImagePlus image)
Check if input image is binary (8-bit with only 0 or 255 values)
|
static boolean |
isBinaryImage(ij.process.ImageProcessor image)
Check if input image is binary (8-bit with only 0 or 255 values)
|
static ij.ImagePlus |
keepLargestRegion(ij.ImagePlus imagePlus)
Returns a binary image that contains only the largest region.
|
static ij.process.ImageProcessor |
keepLargestRegion(ij.process.ImageProcessor image)
Returns a binary image that contains only the largest region.
|
static ij.ImageStack |
keepLargestRegion(ij.ImageStack image)
Returns a binary image that contains only the largest label.
|
static void |
removeLargestRegion(ij.ImagePlus imagePlus)
Returns a binary image in which the largest region has been replaced by
background.
|
static ij.process.ImageProcessor |
removeLargestRegion(ij.process.ImageProcessor image)
Returns a binary image in which the largest region has been replaced by
the background value.
|
static ij.ImageStack |
removeLargestRegion(ij.ImageStack image)
Returns a binary image in which the largest region has been replaced by
the background value.
|
static ij.ImagePlus |
sizeOpening(ij.ImagePlus imagePlus,
int minElementCount)
Applies size opening on a binary 2D or 3D image.
|
static ij.process.ImageProcessor |
skeleton(ij.process.ImageProcessor image)
Computes the skeleton of a binary image, and returns another binary image.
|
static ij.ImageStack |
volumeOpening(ij.ImageStack image,
int nVoxelMin)
Applies area opening on a binary image: creates a new binary image that
contains only particle with at least the specified number of voxels.
|
public static final boolean isBinaryImage(ij.ImagePlus image)
image
- input imagepublic static final boolean isBinaryImage(ij.process.ImageProcessor image)
image
- input imagepublic static final int countForegroundPixels(ij.process.ImageProcessor image)
image
- a binary image with zero values for backgroundpublic static final int countForegroundVoxels(ij.ImageStack image)
image
- a binary 3D image with zero values for backgroundpublic static final ij.ImagePlus componentsLabeling(ij.ImagePlus imagePlus, int conn, int bitDepth)
imagePlus
- contains the 3D binary image stackconn
- the connectivity, either 4 or 8 for planar images, or 6 or 26
for 3D imagesbitDepth
- the number of bits used to create the result image (8, 16 or
32)RuntimeException
- if the number of labels reaches the maximum number that can
be represented with this bitDepthConnectedComponentsLabeling
,
ConnectedComponentsLabeling3D
,
FloodFill
public static final ij.process.ImageProcessor componentsLabeling(ij.process.ImageProcessor image, int conn, int bitDepth)
image
- contains the binary image (any type is accepted)conn
- the connectivity, either 4 or 8bitDepth
- the number of bits used to create the result image (8, 16 or
32)RuntimeException
- if the number of labels reaches the maximum number that can
be represented with this bitDepthConnectedComponentsLabeling
public static final ij.ImageStack componentsLabeling(ij.ImageStack image, int conn, int bitDepth)
image
- contains the 3D binary image (any type is accepted)conn
- the connectivity, either 6 or 26bitDepth
- the number of bits used to create the result stack (8, 16 or
32)RuntimeException
- if the number of labels reaches the maximum number that can
be represented with this bitDepthConnectedComponentsLabeling3D
public static final ij.ImagePlus distanceMap(ij.ImagePlus imagePlus)
imagePlus
- an ImagePlus object containing a binary or label imageDistanceTransform
,
DistanceTransform3D
public static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image)
Computes the distance map (or distance transform) from a binary image processor. Distance is computed for each foreground (white) pixel, as the chamfer distance to the nearest background (black) pixel.
This method uses default 5x5 weights, and normalizes the resulting map. Result is given in a new instance of ShortProcessor.
image
- the input binary or label imagepublic static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image, ChamferMask2D mask, boolean floatingPoint, boolean normalize)
Computes the distance map from a binary image processor, by specifying weights and normalization.
Distance is computed for each foreground (white) pixel, as the chamfer distance to the nearest background (black) pixel. Result is given in a new instance of FloatProcessor.
image
- the input binary or label imagemask
- the chamfer mask used to propagate distancesfloatingPoint
- indicates if the computation should be performed using
floating point computationnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.process.ShortProcessor distanceMap(ij.process.ImageProcessor image, short[] weights, boolean normalize)
Computes the distance map from a binary image processor, by specifying weights and normalization.
Distance is computed for each foreground (white) pixel, as the chamfer distance to the nearest background (black) pixel. Result is given as a new instance of ShortProcessor.
image
- the input binary or label imageweights
- an array of chamfer weights, with at least two valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.process.FloatProcessor distanceMap(ij.process.ImageProcessor image, float[] weights, boolean normalize)
Computes the distance map from a binary image processor, by specifying weights and normalization.
Distance is computed for each foreground (white) pixel, as the chamfer distance to the nearest background (black) pixel. Result is given in a new instance of FloatProcessor.
image
- the input binary or label imageweights
- an array of chamfer weights, with at least two valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.ImageStack distanceMap(ij.ImageStack image)
image
- the input binary imagepublic static final ij.ImageStack distanceMap(ij.ImageStack image, ChamferMask3D chamferMask, boolean floatingPoint, boolean normalize)
image
- the input binary imagechamferMask
- the chamfer mask used for propagating distancesfloatingPoint
- indicates if the distane propagation should use floating point computationnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.ImageStack distanceMap(ij.ImageStack image, short[] weights, boolean normalize)
image
- the input binary imageweights
- an array of chamfer weights, with at least three valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.ImageStack distanceMap(ij.ImageStack image, float[] weights, boolean normalize)
image
- the input 3D binary imageweights
- an array of chamfer weights, with at least three valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.ImagePlus geodesicDistanceMap(ij.ImagePlus markerPlus, ij.ImagePlus maskPlus)
markerPlus
- the image containing the markermaskPlus
- the image containing the markerpublic static final ij.process.ImageProcessor geodesicDistanceMap(ij.process.ImageProcessor marker, ij.process.ImageProcessor mask)
marker
- the binary image of markermask
- the binary image of maskpublic static final ij.process.ImageProcessor geodesicDistanceMap(ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, short[] weights, boolean normalize)
marker
- the binary image of markermask
- the binary image of maskweights
- an array of chamfer weights, with at least two valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.process.ImageProcessor geodesicDistanceMap(ij.process.ImageProcessor marker, ij.process.ImageProcessor mask, float[] weights, boolean normalize)
marker
- the binary image of markermask
- the binary image of maskweights
- an array of chamfer weights, with at least two valuesnormalize
- indicates whether the resulting distance map should be
normalized (divide distances by the first chamfer weight)public static final ij.ImagePlus sizeOpening(ij.ImagePlus imagePlus, int minElementCount)
imagePlus
- the binary 2D or 3D image containing individual particlesminElementCount
- the minimum number of pixels or voxels required to keep a
particleLabelImages.sizeOpening(ImagePlus, int)
public static final ij.process.ImageProcessor areaOpening(ij.process.ImageProcessor image, int nPixelMin)
image
- the binary image containing individual particlesnPixelMin
- the minimum number of pixels required to keep a particleLabelImages.areaOpening(ImageProcessor, int)
public static final ij.ImageStack volumeOpening(ij.ImageStack image, int nVoxelMin)
image
- the 3D binary image containing individual particlesnVoxelMin
- the minimum number of voxels required to keep a particleLabelImages.volumeOpening(ImageStack, int)
public static final ij.ImagePlus keepLargestRegion(ij.ImagePlus imagePlus)
imagePlus
- an instance of imagePlus that contains a binary imagepublic static final ij.process.ImageProcessor keepLargestRegion(ij.process.ImageProcessor image)
image
- a binary image containing several individual regionspublic static final ij.ImageStack keepLargestRegion(ij.ImageStack image)
image
- a binary 3D image containing several individual regionspublic static final void removeLargestRegion(ij.ImagePlus imagePlus)
imagePlus
- a binary image containing several individual particlespublic static final ij.process.ImageProcessor removeLargestRegion(ij.process.ImageProcessor image)
image
- a binary image containing several individual particlespublic static final ij.ImageStack removeLargestRegion(ij.ImageStack image)
image
- a binary 3D image containing several individual particlespublic static final ij.ImagePlus binarize(ij.ImagePlus imagePlus)
imagePlus
- an ImagePlus object containing a gray scale imagepublic static final ij.process.ImageProcessor binarize(ij.process.ImageProcessor image)
image
- a gray scale imagepublic static final ij.ImageStack binarize(ij.ImageStack image)
image
- a gray scale 3D imagepublic static final ij.ImagePlus binarizeBackground(ij.ImagePlus imagePlus)
imagePlus
- an ImagePlus object containing a gray scale imagepublic static final ij.process.ImageProcessor binarizeBackground(ij.process.ImageProcessor image)
image
- a gray scale imagepublic static final ij.ImageStack binarizeBackground(ij.ImageStack image)
image
- a gray scale 3D imagepublic static final ij.process.ImageProcessor skeleton(ij.process.ImageProcessor image)
image
- a binary imageCopyright © 2014–2023 INRA-IJPB Modeling and Digital Imaging lab. All rights reserved.