Class LabelImages
- Direct Known Subclasses:
LabelImages
public class LabelImages
extends java.lang.Object
- Author:
- David Legland
- See Also:
LabelUtils
-
Method Summary
Modifier and Type Method Description static ij.ImagePlus
applyLut(ij.ImagePlus labelImage, double[] values)
Applies the given Look-up table to the input label image.static ij.ImageStack
applyLut(ij.ImageStack labelImage, double[] values)
Applies the given Look-up table to the input 3D label image.static ij.process.FloatProcessor
applyLut(ij.process.ImageProcessor labelImage, double[] values)
Applies the given Look-up table to the input 2D label image.static ij.process.ImageProcessor
areaOpening(ij.process.ImageProcessor labelImage, int nPixelMin)
Applies area opening on a label image: creates a new label image that contains only particles with at least the specified number of pixels.static ij.process.ImageProcessor
binarize(ij.process.ImageProcessor image, int label)
Returns the binary image with value equals totrue
only when the corresponding value in the input image equalslabel
.static ij.process.ImageProcessor
createLabelImage(int width, int height, int nLabels)
Creates a label image with the appropriate class to store the required number of labels.static ij.process.ByteProcessor
createLabelImage(ij.process.ImageProcessor... images)
Creates a new label image from a set of binary images.static ij.ImageStack
createLabelStack(int width, int height, int depth, int nLabels)
Creates a new image stack with the appropriate class to store the required number of labels.static ij.ImagePlus
cropLabel(ij.ImagePlus imagePlus, int label, int border)
Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.static ij.ImageStack
cropLabel(ij.ImageStack image, int label, int border)
Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.static ij.process.ImageProcessor
cropLabel(ij.process.ImageProcessor image, int label, int border)
Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.static ij.ImagePlus
dilateLabels(ij.ImagePlus imagePlus, double distMax)
Applies a constrained dilation to each region in the 3D label map: The dilation of each region is constrained by the other regions; The dilation extent is limited by the specified distance (in voxel unit)static ij.ImageStack
dilateLabels(ij.ImageStack labelMap, double radius)
Applies a constrained dilation to each region in the 3D label map: The dilation of each region is constrained by the other regions; The dilation extent is limited by the the radius value (in voxel unit).static ij.process.ImageProcessor
dilateLabels(ij.process.ImageProcessor labelMap, double radius)
Applies a constrained dilation to each region in the label map: The dilation of each region is constrained by the other regions; The dilation extent is given by a radius value (in pixel unit).static ij.ImageStack
distanceMap(ij.ImageStack image)
Computes the 3D distance map from an image of labels.static ij.ImageStack
distanceMap(ij.ImageStack image, float[] weights, boolean normalize)
Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.static ij.ImageStack
distanceMap(ij.ImageStack image, short[] weights, boolean normalize)
Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.static ij.ImageStack
distanceMap(ij.ImageStack image, ChamferMask3D mask, boolean floatingPoint, boolean normalize)
Computes the 3D distance map from an image of labels, by specifying the chamfer mask and the normalization.static ij.process.ImageProcessor
distanceMap(ij.process.ImageProcessor image)
Computes the distance map for each region within a label map.static ij.process.ImageProcessor
distanceMap(ij.process.ImageProcessor image, float[] weights, boolean normalize)
Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.static ij.process.ImageProcessor
distanceMap(ij.process.ImageProcessor image, short[] weights, boolean normalize)
Computes the distance map for each region within a label map.static ij.process.ImageProcessor
distanceMap(ij.process.ImageProcessor image, ChamferMask2D mask, boolean floatingPoint, boolean normalize)
Computes the distance map for each region within a label map, by specifying the chamfer mask and the normalization.static int[]
findAllLabels(ij.ImagePlus image)
Returns the set of unique labels existing in the given image, excluding the value zero (used for background).static int[]
findAllLabels(ij.ImageStack image)
Returns the set of unique labels existing in the given stack, excluding the value zero (used for background).static int[]
findAllLabels(ij.process.ImageProcessor image)
Returns the set of unique labels existing in the given image, excluding the value zero (used for background).static int
findLargestLabel(ij.ImagePlus imagePlus)
Find largest label (by number of pixels/voxels) in input imagestatic java.awt.Point[]
findPositionOfMaxValues(ij.process.ImageProcessor valueImage, ij.process.ImageProcessor labelImage, int[] labels)
Deprecated.use LavelValues.findPositionOfMaxValues insteadstatic java.awt.Point[]
findPositionOfMinValues(ij.process.ImageProcessor valueImage, ij.process.ImageProcessor labelImage, int[] labels)
Deprecated.use LavelValues.findPositionOfMinValues insteadstatic double
getDiceCoefficient(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)
Get the Dice coefficient between two label images.static double
getDiceCoefficient(ij.ImageStack labelImage1, ij.ImageStack labelImage2)
Get the Dice coefficient between two label images.static double
getDiceCoefficient(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)
Get the Dice coefficient between two label images.static ij.measure.ResultsTable
getDiceCoefficientPerLabel(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)
Get the Dice coefficient per label (intersection over union overlap) between two label images.static ij.measure.ResultsTable
getDiceCoefficientPerLabel(ij.ImageStack labelImage1, ij.ImageStack labelImage2)
Get the Dice coefficient per label (intersection over union overlap) between two label images.static ij.measure.ResultsTable
getDiceCoefficientPerLabel(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)
Get the Dice coefficient per label (intersection over union overlap) between two label images.static double
getFalseNegativeError(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the total false negative error between two label images (source and target).static double
getFalseNegativeError(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the total false negative error between two label images (source and target).static double
getFalseNegativeError(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the total false negative error between two label images (source and target).static ij.measure.ResultsTable
getFalseNegativeErrorPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the false negative error between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getFalseNegativeErrorPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the false negative error between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getFalseNegativeErrorPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the false negative error between two label images (source and target) per each individual labeled region.static double
getFalsePositiveError(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the total false positive error between two label images (source and target).static double
getFalsePositiveError(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the total false positive error between two label images (source and target).static double
getFalsePositiveError(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the total false positive error between two label images (source and target).static ij.measure.ResultsTable
getFalsePositiveErrorPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the false positive error between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getFalsePositiveErrorPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the false positive error between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getFalsePositiveErrorPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the false positive error between two label images (source and target) per each individual labeled region.static double
getJaccardIndex(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)
Get the Jaccard index (intersection over union overlap) between two label images.static double
getJaccardIndex(ij.ImageStack labelImage1, ij.ImageStack labelImage2)
Get the Jaccard index (intersection over union overlap) between two label images.static double
getJaccardIndex(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)
Get the Jaccard index (intersection over union overlap) between two label images.static ij.measure.ResultsTable
getJaccardIndexPerLabel(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)
Get the Jaccard index per label (intersection over union overlap) between two label images.static ij.measure.ResultsTable
getJaccardIndexPerLabel(ij.ImageStack labelImage1, ij.ImageStack labelImage2)
Get the Jaccard index per label (intersection over union overlap) between two label images.static ij.measure.ResultsTable
getJaccardIndexPerLabel(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)
Get the Jaccard index per label (intersection over union overlap) between two label images.static java.util.ArrayList<java.lang.Float>
getSelectedLabels(ij.ImagePlus labelImage, ij.gui.Roi roi)
Get list of selected labels in label image.static ij.measure.ResultsTable
getTargetOverlapPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the target overlap between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getTargetOverlapPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the target overlap between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getTargetOverlapPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the target overlap between two label images (source and target) per each individual labeled region.static double
getTotalOverlap(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the total overlap between two label images (source and target).static double
getTotalOverlap(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the total overlap between two label images (source and target).static double
getTotalOverlap(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the total overlap between two label images (source and target).static double
getVolumeSimilarity(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the total volume similarity between two label images (source and target).static double
getVolumeSimilarity(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the total volume similarity between two label images (source and target).static double
getVolumeSimilarity(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the total volume similarity between two label images (source and target).static ij.measure.ResultsTable
getVolumeSimilarityPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)
Get the volume similarity between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getVolumeSimilarityPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)
Get the volume similarity between two label images (source and target) per each individual labeled region.static ij.measure.ResultsTable
getVolumeSimilarityPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)
Get the volume similarity between two label images (source and target) per each individual labeled region.static boolean
isLabelImageType(ij.ImagePlus imagePlus)
Checks if the input image may be a label image, and returns false if the type is not valid for label images.static ij.ImagePlus
keepLabels(ij.ImagePlus imagePlus, int[] labels)
Creates a new image containing only the specified labels.static ij.ImageStack
keepLabels(ij.ImageStack image, int[] labels)
Creates a new image containing only the specified labels.static ij.process.ImageProcessor
keepLabels(ij.process.ImageProcessor image, int[] labels)
Creates a new image containing only the specified labels.static ij.ImagePlus
keepLargestLabel(ij.ImagePlus imagePlus)
Returns a binary image that contains only the largest label.static ij.ImageStack
keepLargestLabel(ij.ImageStack image)
Returns a binary image that contains only the largest label.static ij.process.ImageProcessor
keepLargestLabel(ij.process.ImageProcessor image)
Returns a binary image that contains only the largest label.static ij.ImageStack
labelBoundaries(ij.ImageStack image)
Creates a binary 3D image that contains 255 for voxels that are boundaries between two labels.static ij.process.ImageProcessor
labelBoundaries(ij.process.ImageProcessor image)
Creates a binary 2D image that contains 255 for pixels that are boundaries between two labels.static ij.ImagePlus
labelToRgb(ij.ImagePlus imagePlus, byte[][] lut, java.awt.Color bgColor)
Creates a new Color image from a label image, a LUT, and a color for background.static ij.ImageStack
labelToRgb(ij.ImageStack image, byte[][] lut, java.awt.Color bgColor)
Creates a new Color image stack from a label image stack, a LUT, and a color for background.static ij.process.ColorProcessor
labelToRgb(ij.process.ImageProcessor image, byte[][] lut, java.awt.Color bgColor)
Creates a new Color image from a label planar image, a LUT, and a color for background.static java.util.HashMap<java.lang.Integer,java.lang.Integer>
mapLabelIndices(int[] labels)
Creates an associative array to retrieve the index corresponding to each label.static void
mergeLabels(ij.ImagePlus labelImage, ij.gui.Roi roi, boolean verbose)
Merge labels selected by freehand or point tool.static void
mergeLabelsWithGap(ij.ImagePlus imagePlus, float[] labels, float newLabel, int conn)
Merge several regions identified by their label, filling the gap between former regions.static void
mergeLabelsWithGap(ij.ImagePlus labelImage, ij.gui.Roi roi, int conn, boolean verbose)
Merge labels selected by freehand or point tool.static void
mergeLabelsWithGap(ij.ImageStack image, float[] labels, float newLabel, int conn)
Merge several regions identified by their label, filling the gap between former regions.static void
mergeLabelsWithGap(ij.process.ImageProcessor image, float[] labels, float newLabel, int conn)
Merge several regions identified by their label, filling the gap between former regions.static int[]
pixelCount(ij.ImagePlus image, int[] labels)
Computes the number of pixels (or voxels) composing each regions in the 2D or 3D label image.static int[]
pixelCount(ij.process.ImageProcessor image, int[] labels)
Computes the number of pixels composing each particle in the label image.static ij.ImagePlus
regionComponentsLabeling(ij.ImagePlus imagePlus, int regionLabel, 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.ImageStack
regionComponentsLabeling(ij.ImageStack image, int regionLabel, int conn, int bitDepth)
Computes the labels of the connected components in the given 3D binary image.static ij.process.ImageProcessor
regionComponentsLabeling(ij.process.ImageProcessor image, int regionLabel, int conn, int bitDepth)
Computes the labels of the connected components in the given planar binary image.static void
remapLabels(ij.ImagePlus imagePlus)
Ensures that the labels in the given label image range from 1 to Lmax.static void
remapLabels(ij.ImageStack image)
Ensures that the labels in the given label image range from 1 to Lmax.static void
remapLabels(ij.process.ImageProcessor image)
Ensures that the labels in the given label image range from 1 to Lmax.static void
removeBorderLabels(ij.ImagePlus imagePlus)
Removes all regions that touch the borders of the image.static void
removeBorderLabels(ij.ImageStack image)
Removes all regions that touch the borders of the image.static void
removeBorderLabels(ij.process.ImageProcessor image)
Removes all regions that touch the borders of the image.static void
removeLabels(ij.ImagePlus labelImage, ij.gui.Roi roi, boolean verbose)
Remove labels selected by freehand or point ROIs (in place).static void
removeLargestLabel(ij.ImagePlus imagePlus)
Removes the regions corresponding to the largest label from a label image.static void
removeLargestLabel(ij.ImageStack image)
Removes the regions corresponding to the largest label from a label image.static void
removeLargestLabel(ij.process.ImageProcessor image)
Removes the regions corresponding to the largest label from a label image.static void
replaceLabels(ij.ImagePlus imagePlus, float[] labels, float newLabel)
Replace all values specified in label array by the value 0.static void
replaceLabels(ij.ImagePlus imagePlus, int[] labels, int newLabel)
Replace all values specified in label array by a new value.static void
replaceLabels(ij.ImageStack image, float[] labels, float newLabel)
Replace all values specified in label array by the specified value.static void
replaceLabels(ij.ImageStack image, int[] labels, int newLabel)
Replace all values specified in label array by a new value.static void
replaceLabels(ij.process.ImageProcessor image, float[] labels, float newLabel)
Replace all values specified in label array by the value 0.static void
replaceLabels(ij.process.ImageProcessor image, int[] labels, int newLabel)
Replace all values specified in label array by a new value.static ij.ImagePlus
sizeOpening(ij.ImagePlus labelImage, int minElementCount)
Applies size opening on a label image: creates a new label image that contains only particles with at least the specified number of pixels or voxels.static ij.ImageStack
volumeOpening(ij.ImageStack labelImage, int nVoxelMin)
Applies area opening on a 3D label image: creates a new label image that contains only particle with at least the specified number of voxels.static int[]
voxelCount(ij.ImageStack image, int[] labels)
Counts the number of voxels that compose each labeled particle in 3D image.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
isLabelImageType
public static final boolean isLabelImageType(ij.ImagePlus imagePlus)Checks if the input image may be a label image, and returns false if the type is not valid for label images.- Parameters:
imagePlus
- the input image to check- Returns:
- true if the type of the input image is valid for label images
-
createLabelImage
public static final ij.process.ImageProcessor createLabelImage(int width, int height, int nLabels)Creates a label image with the appropriate class to store the required number of labels.- Parameters:
width
- the width of the new label imageheight
- the height of the new label imagenLabels
- expected number of labels in new image- Returns:
- a new ImageProcessor with type adapted to store the expected number of labels
-
createLabelStack
public static final ij.ImageStack createLabelStack(int width, int height, int depth, int nLabels)Creates a new image stack with the appropriate class to store the required number of labels.- Parameters:
width
- the width of the new label imageheight
- the height of the new label imagedepth
- the depth (number of slices) of the new label imagenLabels
- expected number of labels in new image- Returns:
- a new ImageStack with type adapted to store the expected number of labels
-
createLabelImage
public static final ij.process.ByteProcessor createLabelImage(ij.process.ImageProcessor... images)Creates a new label image from a set of binary images. The label values range between 1 and the number of images.
Example:ImageProcessor binary1 = new ByteProcessor(10, 10); binary1.set(2, 2, 255); binary1.set(3, 5, 255); ImageProcessor binary2 = new ByteProcessor(10, 10); binary2.set(4, 4, 255); binary2.set(3, 5, 255); // overlap of binary images ImageProcessor binary3 = new ByteProcessor(10, 10); binary3.set(6, 6, 255); ImageProcessor labels = LabelImages.createLabelImage(binary1, binary2, binary3); int background = labels.get(1, 1); // returns 0 int label1 = labels.get(2, 2); // returns 1 int label2 = labels.get(4, 4); // returns 2 int label3 = labels.get(6, 6); // returns 3 int label1overlap2 = labels.get(3, 5); // returns 2
- Parameters:
images
- a collection of binary images (0: background, >0 pixel belongs to current label)- Returns:
- a new image with label values
-
labelBoundaries
public static final ij.ImageStack labelBoundaries(ij.ImageStack image)Creates a binary 3D image that contains 255 for voxels that are boundaries between two labels.- Parameters:
image
- a 3D image containing label regions- Returns:
- a new 3D binary image with white voxels at label boundaries
-
labelBoundaries
public static final ij.process.ImageProcessor labelBoundaries(ij.process.ImageProcessor image)Creates a binary 2D image that contains 255 for pixels that are boundaries between two labels.- Parameters:
image
- a 2D image containing label regions- Returns:
- a new 2D binary image with white pixels at label boundaries
-
binarize
public static final ij.process.ImageProcessor binarize(ij.process.ImageProcessor image, int label)Returns the binary image with value equals totrue
only when the corresponding value in the input image equalslabel
.- Parameters:
image
- the input label maplabel
- the label of the region to binarize. Using a value equal to zero binarizes the background.- Returns:
- a binary image of the selected label.
-
cropLabel
public static final ij.ImagePlus cropLabel(ij.ImagePlus imagePlus, int label, int border)Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.- Parameters:
imagePlus
- an image containing label of particleslabel
- the label of the particle to selectborder
- the number of pixels to add to each side of the particle- Returns:
- a smaller binary image containing only the selected particle
-
cropLabel
public static final ij.process.ImageProcessor cropLabel(ij.process.ImageProcessor image, int label, int border)Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.- Parameters:
image
- a, image containing label of particleslabel
- the label of the particle to selectborder
- the number of pixels to add to each side of the particle- Returns:
- a smaller binary image containing only the selected particle
-
cropLabel
public static final ij.ImageStack cropLabel(ij.ImageStack image, int label, int border)Returns a binary image that contains only the selected particle or region, by automatically cropping the image and eventually adding some borders.- Parameters:
image
- a 3D image containing label of particleslabel
- the label of the particle to selectborder
- the number of voxels to add to each side of the particle- Returns:
- a smaller binary image containing only the selected particle
-
sizeOpening
public static final ij.ImagePlus sizeOpening(ij.ImagePlus labelImage, int minElementCount)Applies size opening on a label image: creates a new label image that contains only particles with at least the specified number of pixels or voxels.- Parameters:
labelImage
- an image of label regionsminElementCount
- the minimal number of pixels or voxels of regions- Returns:
- a new image containing only regions with enough elements
- See Also:
areaOpening(ImageProcessor, int)
,volumeOpening(ImageStack, int)
-
areaOpening
public static final ij.process.ImageProcessor areaOpening(ij.process.ImageProcessor labelImage, int nPixelMin)Applies area opening on a label image: creates a new label image that contains only particles with at least the specified number of pixels.- Parameters:
labelImage
- an image of label regionsnPixelMin
- the minimal number of pixels of regions- Returns:
- a new image containing only regions with enough pixels
-
volumeOpening
public static final ij.ImageStack volumeOpening(ij.ImageStack labelImage, int nVoxelMin)Applies area opening on a 3D label image: creates a new label image that contains only particle with at least the specified number of voxels. Keep original labels unchanged.- Parameters:
labelImage
- an image of label regionsnVoxelMin
- the minimal number of voxels of regions- Returns:
- a new image containing only regions with enough voxels
-
labelToRgb
public static final ij.ImagePlus labelToRgb(ij.ImagePlus imagePlus, byte[][] lut, java.awt.Color bgColor)Creates a new Color image from a label image, a LUT, and a color for background.- Parameters:
imagePlus
- a 2D or 3D image containing labels and 0 for backgroundlut
- the array of color components for each labelbgColor
- the background color- Returns:
- a new Color image
-
labelToRgb
public static final ij.process.ColorProcessor labelToRgb(ij.process.ImageProcessor image, byte[][] lut, java.awt.Color bgColor)Creates a new Color image from a label planar image, a LUT, and a color for background.- Parameters:
image
- an ImageProcessor with label values and 0 for backgroundlut
- the array of color components for each labelbgColor
- the background color- Returns:
- a new instance of ColorProcessor
-
labelToRgb
public static final ij.ImageStack labelToRgb(ij.ImageStack image, byte[][] lut, java.awt.Color bgColor)Creates a new Color image stack from a label image stack, a LUT, and a color for background.- Parameters:
image
- an ImageStack with label values and 0 for backgroundlut
- the array of color components for each labelbgColor
- the background color- Returns:
- a new instance of ImageStack containing color processors
-
removeBorderLabels
public static final void removeBorderLabels(ij.ImagePlus imagePlus)Removes all regions that touch the borders of the image.- Parameters:
imagePlus
- a label image
-
removeBorderLabels
public static final void removeBorderLabels(ij.process.ImageProcessor image)Removes all regions that touch the borders of the image.- Parameters:
image
- a label image
-
removeBorderLabels
public static final void removeBorderLabels(ij.ImageStack image)Removes all regions that touch the borders of the image.- Parameters:
image
- a label image
-
keepLargestLabel
public static final ij.ImagePlus keepLargestLabel(ij.ImagePlus imagePlus)Returns a binary image that contains only the largest label.- Parameters:
imagePlus
- an instance of ImagePlus containing a label image- Returns:
- a new ImagePlus containing only the largest label
-
keepLargestLabel
public static final ij.process.ImageProcessor keepLargestLabel(ij.process.ImageProcessor image)Returns a binary image that contains only the largest label.- Parameters:
image
- a label image- Returns:
- a new image containing only the largest label
- Throws:
java.lang.RuntimeException
- if the image is empty
-
keepLargestLabel
public static final ij.ImageStack keepLargestLabel(ij.ImageStack image)Returns a binary image that contains only the largest label.- Parameters:
image
- a label image- Returns:
- a new image containing only the largest label
- Throws:
java.lang.RuntimeException
- if the image is empty
-
removeLargestLabel
public static final void removeLargestLabel(ij.ImagePlus imagePlus)Removes the regions corresponding to the largest label from a label image.- Parameters:
imagePlus
- a label image
-
removeLargestLabel
public static final void removeLargestLabel(ij.process.ImageProcessor image)Removes the regions corresponding to the largest label from a label image.- Parameters:
image
- a label image
-
removeLargestLabel
public static final void removeLargestLabel(ij.ImageStack image)Removes the regions corresponding to the largest label from a label image.- Parameters:
image
- a 3D label image
-
pixelCount
public static final int[] pixelCount(ij.ImagePlus image, int[] labels)Computes the number of pixels (or voxels) composing each regions in the 2D or 3D label image.- Parameters:
image
- a label image (2D or 3D)labels
- the array of label indices to process- Returns:
- an array the same size as labels, containing the number of pixels / voxels within each region
-
pixelCount
public static final int[] pixelCount(ij.process.ImageProcessor image, int[] labels)Computes the number of pixels composing each particle in the label image.- Parameters:
image
- a label imagelabels
- the array of label indices to process- Returns:
- an array the same size as labels, containing the number of pixels of each region
- See Also:
GeometricMeasures2D.area(ij.process.ImageProcessor, int[], double[])
-
voxelCount
public static final int[] voxelCount(ij.ImageStack image, int[] labels)Counts the number of voxels that compose each labeled particle in 3D image.- Parameters:
image
- a label imagelabels
- the array of label indices to process- Returns:
- an array the same size as labels, containing the number of voxels of each region
- See Also:
GeometricMeasures3D.volume(ij.ImageStack, int[], double[])
-
findLargestLabel
public static final int findLargestLabel(ij.ImagePlus imagePlus)Find largest label (by number of pixels/voxels) in input image- Parameters:
imagePlus
- input image- Returns:
- value of the largest label in the input label image
-
findAllLabels
public static final int[] findAllLabels(ij.ImagePlus image)Returns the set of unique labels existing in the given image, excluding the value zero (used for background). #see inra.ijpb.label.edit.FindAllLabels- Parameters:
image
- an instance of ImagePlus containing a label image- Returns:
- the list of unique labels present in image (without background)
-
findAllLabels
public static final int[] findAllLabels(ij.ImageStack image)Returns the set of unique labels existing in the given stack, excluding the value zero (used for background). #see inra.ijpb.label.edit.FindAllLabels- Parameters:
image
- a 3D label image- Returns:
- the list of unique labels present in image (without background)
-
findAllLabels
public static final int[] findAllLabels(ij.process.ImageProcessor image)Returns the set of unique labels existing in the given image, excluding the value zero (used for background). #see inra.ijpb.label.edit.FindAllLabels- Parameters:
image
- a label image- Returns:
- the list of unique labels present in image (without background)
-
replaceLabels
public static final void replaceLabels(ij.ImagePlus imagePlus, int[] labels, int newLabel)Replace all values specified in label array by a new value. This method changes directly the values within the image.- Parameters:
imagePlus
- an ImagePlus containing a 3D label imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
replaceLabels
public static final void replaceLabels(ij.ImagePlus imagePlus, float[] labels, float newLabel)Replace all values specified in label array by the value 0. This method changes directly the values within the image.- Parameters:
imagePlus
- an ImagePlus containing a 3D label imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
replaceLabels
public static final void replaceLabels(ij.process.ImageProcessor image, int[] labels, int newLabel)Replace all values specified in label array by a new value.- Parameters:
image
- a label planar imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
replaceLabels
public static final void replaceLabels(ij.process.ImageProcessor image, float[] labels, float newLabel)Replace all values specified in label array by the value 0.- Parameters:
image
- a label planar imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
replaceLabels
public static final void replaceLabels(ij.ImageStack image, int[] labels, int newLabel)Replace all values specified in label array by a new value.- Parameters:
image
- a label 3D imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
replaceLabels
public static final void replaceLabels(ij.ImageStack image, float[] labels, float newLabel)Replace all values specified in label array by the specified value.- Parameters:
image
- a 3D label imagelabels
- the list of labels to replacenewLabel
- the new value for labels
-
remapLabels
public static final void remapLabels(ij.ImagePlus imagePlus)Ensures that the labels in the given label image range from 1 to Lmax.- Parameters:
imagePlus
- the instance of ImagePlus containing the label image
-
remapLabels
public static final void remapLabels(ij.process.ImageProcessor image)Ensures that the labels in the given label image range from 1 to Lmax.- Parameters:
image
- the label image
-
remapLabels
public static final void remapLabels(ij.ImageStack image)Ensures that the labels in the given label image range from 1 to Lmax.- Parameters:
image
- the 3D label image
-
keepLabels
public static final ij.ImagePlus keepLabels(ij.ImagePlus imagePlus, int[] labels)Creates a new image containing only the specified labels.- Parameters:
imagePlus
- an ImagePlus containing a planar label imagelabels
- the list of values to keep- Returns:
- a new instance of ImagePlus containing only the specified labels
-
keepLabels
public static final ij.process.ImageProcessor keepLabels(ij.process.ImageProcessor image, int[] labels)Creates a new image containing only the specified labels.- Parameters:
image
- a planar label imagelabels
- the list of values to keep- Returns:
- a new label image containing only the specified labels
-
keepLabels
public static final ij.ImageStack keepLabels(ij.ImageStack image, int[] labels)Creates a new image containing only the specified labels.- Parameters:
image
- a 3D label imagelabels
- the list of values to keep- Returns:
- a new 3D label image containing only the specified labels
-
applyLut
public static final ij.ImagePlus applyLut(ij.ImagePlus labelImage, double[] values)Applies the given Look-up table to the input label image.- Parameters:
labelImage
- a label image (2D or 3D)values
- a set of values associated to each unique label- Returns:
- a new ImagePlus containing for each pixel or voxel, either the value associated to the corresponding label, or 0 if the pixel is background
-
applyLut
public static final ij.process.FloatProcessor applyLut(ij.process.ImageProcessor labelImage, double[] values)Applies the given Look-up table to the input 2D label image.- Parameters:
labelImage
- a label imagevalues
- a set of values associated to each unique label- Returns:
- a new FloatProcessor containing for each pixel, either the value associated to the corresponding label, or 0 if the pixel is background
-
applyLut
public static final ij.ImageStack applyLut(ij.ImageStack labelImage, double[] values)Applies the given Look-up table to the input 3D label image.- Parameters:
labelImage
- a 3D label imagevalues
- a set of values associated to each unique label- Returns:
- a new 3D image containing for each pixel, either the value associated to the corresponding label, or 0 if the voxel is background
-
mapLabelIndices
public static final java.util.HashMap<java.lang.Integer,java.lang.Integer> mapLabelIndices(int[] labels)Creates an associative array to retrieve the index corresponding to each label.The resulting map verifies the relation:
int[] labels = ... Map<Integer,Integer> labelIndices = LabelImages.mapLabelIndices(labels); int index = ... assert(index == labelIndices.get(labels[index]));
- Parameters:
labels
- an array of labels- Returns:
- a HashMap instance with each label as key, and the index of the label in array as value.
-
regionComponentsLabeling
public static final ij.ImagePlus regionComponentsLabeling(ij.ImagePlus imagePlus, int regionLabel, 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.- Parameters:
imagePlus
- contains the 3D binary image stackregionLabel
- the label of the region to process, that can be the background (value 0)conn
- 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)- Returns:
- an ImagePlus containing the label of each connected component.
- Throws:
java.lang.RuntimeException
- if the number of labels reaches the maximum number that can be represented with this bitDepth- See Also:
FloodFillRegionComponentsLabeling
,FloodFillRegionComponentsLabeling3D
,FloodFill
-
regionComponentsLabeling
public static final ij.process.ImageProcessor regionComponentsLabeling(ij.process.ImageProcessor image, int regionLabel, int conn, int bitDepth)Computes the labels of the connected components in the given planar binary image. The type of result is controlled by the bitDepth option. Uses a Flood-fill type algorithm.- Parameters:
image
- contains the binary image (any type is accepted)regionLabel
- the label of the region to process, that can be the background (value 0)conn
- the connectivity, either 4 or 8bitDepth
- the number of bits used to create the result image (8, 16 or 32)- Returns:
- a new instance of ImageProcessor containing the label of each connected component.
- Throws:
java.lang.RuntimeException
- if the number of labels reaches the maximum number that can be represented with this bitDepth- See Also:
FloodFillRegionComponentsLabeling
,ConnectedComponentsLabeling
-
regionComponentsLabeling
public static final ij.ImageStack regionComponentsLabeling(ij.ImageStack image, int regionLabel, int conn, int bitDepth)Computes the labels of the connected components in the given 3D binary image. The type of result is controlled by the bitDepth option. Uses a Flood-fill type algorithm.- Parameters:
image
- contains the 3D binary image (any type is accepted)regionLabel
- the label of the region to process, that can be the background (value 0)conn
- the connectivity, either 6 or 26bitDepth
- the number of bits used to create the result stack (8, 16 or 32)- Returns:
- a new instance of ImageStack containing the label of each connected component.
- Throws:
java.lang.RuntimeException
- if the number of labels reaches the maximum number that can be represented with this bitDepth- See Also:
FloodFillRegionComponentsLabeling3D
,ConnectedComponentsLabeling3D
-
mergeLabels
public static final void mergeLabels(ij.ImagePlus labelImage, ij.gui.Roi roi, boolean verbose)Merge labels selected by freehand or point tool. Labels are merged in place (i.e., the input image is modified). Zero-value label is never merged.- Parameters:
labelImage
- label image to modifyroi
- selection indicating the labels to mergeverbose
- option to write in the log window the labels merged
-
mergeLabelsWithGap
public static final void mergeLabelsWithGap(ij.ImagePlus labelImage, ij.gui.Roi roi, int conn, boolean verbose)Merge labels selected by freehand or point tool. Labels are merged in place (i.e., the input image is modified). Zero-value label is merged only if its neighbors contains two different labels.- Parameters:
labelImage
- label image to modifyroi
- selection indicating the labels to mergeconn
- the connectivity to check for neighbors of background labelsverbose
- option to write in the log window the labels merged
-
mergeLabelsWithGap
public static final void mergeLabelsWithGap(ij.ImagePlus imagePlus, float[] labels, float newLabel, int conn)Merge several regions identified by their label, filling the gap between former regions. Labels are merged in place (i.e., the input image is modified). The background pixels or voxels are merged only if they are neighbor of at least two regions to be merged, and of no other region.- Parameters:
imagePlus
- an ImagePlus containing a 3D label imagelabels
- the list of labels to replacenewLabel
- the new value for labelsconn
- the connectivity to check neighbors of background pixels
-
mergeLabelsWithGap
public static final void mergeLabelsWithGap(ij.process.ImageProcessor image, float[] labels, float newLabel, int conn)Merge several regions identified by their label, filling the gap between former regions. Labels are merged in place (i.e., the input image is modified). The background pixels are merged only if they are neighbor of at least two regions to be merged, and of no other region.- Parameters:
image
- a label planar imagelabels
- the list of labels to replacenewLabel
- the new value for labelsconn
- the connectivity to check neighbors of background pixels
-
mergeLabelsWithGap
public static final void mergeLabelsWithGap(ij.ImageStack image, float[] labels, float newLabel, int conn)Merge several regions identified by their label, filling the gap between former regions. Labels are merged in place (i.e., the input image is modified). The background voxels are merged only if they are neighbor of at least two regions to be merged, and of no other region.- Parameters:
image
- a 3D label imagelabels
- the list of labels to replacenewLabel
- the new value for labelsconn
- the connectivity to check neighbors of background pixels
-
removeLabels
public static final void removeLabels(ij.ImagePlus labelImage, ij.gui.Roi roi, boolean verbose)Remove labels selected by freehand or point ROIs (in place).- Parameters:
labelImage
- input label imageroi
- FreehandRoi or PointRoi with selected labelsverbose
- flag to print deleted labels in log window
-
distanceMap
public static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image)Computes the distance map for each region within a label map. Distance is computed for each label pixel, as the chamfer distance to the nearest pixel with a different value.- Parameters:
image
- the input label image- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image, ChamferMask2D mask, boolean floatingPoint, boolean normalize)Computes the distance map for each region within a label map, by specifying the chamfer mask and the 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
orShortProcessort
, depending on thefloatingPoint
flag.- Parameters:
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)- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image, short[] weights, boolean normalize)Computes the distance map for each region within a label map. Distance is computed for each label pixel, as the chamfer distance to the nearest pixel with a different value.- Parameters:
image
- the input image of labelsweights
- 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)- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.process.ImageProcessor distanceMap(ij.process.ImageProcessor image, float[] weights, boolean normalize)Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.- Parameters:
image
- the input 3D image of labelsweights
- 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)- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.ImageStack distanceMap(ij.ImageStack image)Computes the 3D distance map from an image of labels. Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.- Parameters:
image
- the input 3D label image- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.ImageStack distanceMap(ij.ImageStack image, ChamferMask3D mask, boolean floatingPoint, boolean normalize)Computes the 3D distance map from an image of labels, by specifying the chamfer mask and the 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.
- Parameters:
image
- the input 3D 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)- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.ImageStack distanceMap(ij.ImageStack image, short[] weights, boolean normalize)Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.- Parameters:
image
- the input 3D image of labelsweights
- 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)- Returns:
- the distance map obtained after applying the distance transform
-
distanceMap
public static final ij.ImageStack distanceMap(ij.ImageStack image, float[] weights, boolean normalize)Computes the distance map from a 3D image of labels Distance is computed for each label voxel, as the chamfer distance to the nearest voxel with a different value.- Parameters:
image
- the input 3D image of labelsweights
- 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)- Returns:
- the distance map obtained after applying the distance transform
-
dilateLabels
public static final ij.ImagePlus dilateLabels(ij.ImagePlus imagePlus, double distMax)Applies a constrained dilation to each region in the 3D label map:- The dilation of each region is constrained by the other regions;
- The dilation extent is limited by the specified distance (in voxel unit)
- Parameters:
imagePlus
- the image of regions to processdistMax
- the maximum distance used for dilation- Returns:
- a new label map of regions, where regions are dilated only over the background.
-
dilateLabels
public static final ij.process.ImageProcessor dilateLabels(ij.process.ImageProcessor labelMap, double radius)Applies a constrained dilation to each region in the label map:- The dilation of each region is constrained by the other regions;
- The dilation extent is given by a radius value (in pixel unit). In practice, the distance to radius+0.5 is computed.
- Parameters:
labelMap
- the image of regions to processradius
- the radius of dilation of labels over the background- Returns:
- a new label map of regions, where regions are dilated only over the background.
-
dilateLabels
public static final ij.ImageStack dilateLabels(ij.ImageStack labelMap, double radius)Applies a constrained dilation to each region in the 3D label map:- The dilation of each region is constrained by the other regions;
- The dilation extent is limited by the the radius value (in voxel unit). In practice, the distance to radius+0.5 is computed.
- Parameters:
labelMap
- the image of regions to processradius
- the radius of dilation of labels over the background- Returns:
- a new label map of regions, where regions are dilated only over the background.
-
getSelectedLabels
public static final java.util.ArrayList<java.lang.Float> getSelectedLabels(ij.ImagePlus labelImage, ij.gui.Roi roi)Get list of selected labels in label image. Labels are selected by any selection tool in the current slice of the input label image. Zero-value label is skipped.- Parameters:
labelImage
- label imageroi
- FreehandRoi or PointRoi with selected labels- Returns:
- list of selected labels
-
getTotalOverlap
public static final double getTotalOverlap(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the total overlap between two label images (source and target).Total Overlap (for all regions) $TO = \frac{ \sum_r{|S_r \cap T_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total overlap value or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getTargetOverlapPerLabel
public static final ij.measure.ResultsTable getTargetOverlapPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the target overlap between two label images (source and target) per each individual labeled region.Target Overlap (for individual label regions r) $TO_r = \frac{ |S_r \cap T_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- target overlap per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getTotalOverlap
public static final double getTotalOverlap(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the total overlap between two label images (source and target).Total Overlap (for all regions) $TO = \frac{ \sum_r{|S_r \cap T_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total overlap value or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getTotalOverlap
public static final double getTotalOverlap(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the total overlap between two label images (source and target).Total Overlap (for all regions) $TO = \frac{ \sum_r{|S_r \cap T_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total overlap value or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getTargetOverlapPerLabel
public static final ij.measure.ResultsTable getTargetOverlapPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the target overlap between two label images (source and target) per each individual labeled region.Target Overlap (for individual label regions r) $TO_r = \frac{ |S_r \cap T_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- target overlap per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getTargetOverlapPerLabel
public static final ij.measure.ResultsTable getTargetOverlapPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the target overlap between two label images (source and target) per each individual labeled region.Target Overlap (for individual label regions r) $TO_r = \frac{ |S_r \cap T_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- target overlap per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getJaccardIndex
public static final double getJaccardIndex(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)Get the Jaccard index (intersection over union overlap) between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Jaccard index value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getJaccardIndexPerLabel
public static final ij.measure.ResultsTable getJaccardIndexPerLabel(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)Get the Jaccard index per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Jaccard index per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getJaccardIndex
public static final double getJaccardIndex(ij.ImageStack labelImage1, ij.ImageStack labelImage2)Get the Jaccard index (intersection over union overlap) between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Jaccard index value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getJaccardIndexPerLabel
public static final ij.measure.ResultsTable getJaccardIndexPerLabel(ij.ImageStack labelImage1, ij.ImageStack labelImage2)Get the Jaccard index per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Jaccard index per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getJaccardIndex
public static final double getJaccardIndex(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)Get the Jaccard index (intersection over union overlap) between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Jaccard index value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getJaccardIndexPerLabel
public static final ij.measure.ResultsTable getJaccardIndexPerLabel(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)Get the Jaccard index per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Jaccard index per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/Jaccard_index
-
getDiceCoefficient
public static final double getDiceCoefficient(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)Get the Dice coefficient between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Dice coefficient value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getDiceCoefficientPerLabel
public static final ij.measure.ResultsTable getDiceCoefficientPerLabel(ij.process.ImageProcessor labelImage1, ij.process.ImageProcessor labelImage2)Get the Dice coefficient per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Dice coefficient per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getDiceCoefficient
public static final double getDiceCoefficient(ij.ImageStack labelImage1, ij.ImageStack labelImage2)Get the Dice coefficient between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Dice coefficient value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getDiceCoefficientPerLabel
public static final ij.measure.ResultsTable getDiceCoefficientPerLabel(ij.ImageStack labelImage1, ij.ImageStack labelImage2)Get the Dice coefficient per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Dice coefficient per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getDiceCoefficient
public static final double getDiceCoefficient(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)Get the Dice coefficient between two label images.- Parameters:
labelImage1
- first label imagelabelImage2
- second label image- Returns:
- Dice coefficient value or -1 if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getDiceCoefficientPerLabel
public static final ij.measure.ResultsTable getDiceCoefficientPerLabel(ij.ImagePlus labelImage1, ij.ImagePlus labelImage2)Get the Dice coefficient per label (intersection over union overlap) between two label images.- Parameters:
labelImage1
- reference label imagelabelImage2
- label image to compare with- Returns:
- Dice coefficient per label in the reference image or null if error
- See Also:
- https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
-
getVolumeSimilarity
public static final double getVolumeSimilarity(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the total volume similarity between two label images (source and target).Volume Similarity (for all regions) $VS = 2\frac{ \sum_r{|S_r| - |T_r|} }{ \sum_r{|S_r| + |T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total volume similarity value
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getVolumeSimilarityPerLabel
public static final ij.measure.ResultsTable getVolumeSimilarityPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the volume similarity between two label images (source and target) per each individual labeled region.Volume Similarity (for each label region r) $VS_r = 2\frac{ |S_r| - |T_r| }{ |S_r| + |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- volume similarity per label
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getVolumeSimilarity
public static final double getVolumeSimilarity(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the total volume similarity between two label images (source and target).Volume Similarity (for all regions) $VS = 2\frac{ \sum_r{|S_r| - |T_r|} }{ \sum_r{|S_r| + |T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total volume similarity value or NaN if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getVolumeSimilarityPerLabel
public static final ij.measure.ResultsTable getVolumeSimilarityPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the volume similarity between two label images (source and target) per each individual labeled region.Volume Similarity (for each label region r) $VS_r = 2\frac{ |S_r| - |T_r| }{ |S_r| + |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- volume similarity per label
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getVolumeSimilarity
public static final double getVolumeSimilarity(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the total volume similarity between two label images (source and target).Volume Similarity (for all regions) $VS = 2\frac{ \sum_r{|S_r| - |T_r|} }{ \sum_r{|S_r| + |T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- total volume similarity value
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getVolumeSimilarityPerLabel
public static final ij.measure.ResultsTable getVolumeSimilarityPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the volume similarity between two label images (source and target) per each individual labeled region.Volume Similarity (for each label region r) $VS_r = 2\frac{ |S_r| - |T_r| }{ |S_r| + |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- volume similarity per label
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeError
public static final double getFalseNegativeError(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the total false negative error between two label images (source and target).False Negative Error (for all regions) $FN = \frac{ \sum_r{|T_r \setminus S_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeErrorPerLabel
public static final ij.measure.ResultsTable getFalseNegativeErrorPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the false negative error between two label images (source and target) per each individual labeled region.False Negative Error (for each individual labeled region r) $FN_r = \frac{ |T_r \setminus S_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeError
public static final double getFalseNegativeError(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the total false negative error between two label images (source and target).False Negative Error (for all regions) $FN = \frac{ \sum_r{|T_r \setminus S_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeErrorPerLabel
public static final ij.measure.ResultsTable getFalseNegativeErrorPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the false negative error between two label images (source and target) per each individual labeled region.False Negative Error (for each individual labeled region r) $FN_r = \frac{ |T_r \setminus S_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeError
public static final double getFalseNegativeError(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the total false negative error between two label images (source and target).False Negative Error (for all regions) $FN = \frac{ \sum_r{|T_r \setminus S_r|} }{ \sum_r{|T_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalseNegativeErrorPerLabel
public static final ij.measure.ResultsTable getFalseNegativeErrorPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the false negative error between two label images (source and target) per each individual labeled region.False Negative Error (for each individual labeled region r) $FN_r = \frac{ |T_r \setminus S_r| }{ |T_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false negative error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveError
public static final double getFalsePositiveError(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the total false positive error between two label images (source and target).False Positive Error (for all regions) $FP = \frac{ \sum_r{|S_r \setminus T_r|} }{ \sum_r{|S_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveErrorPerLabel
public static final ij.measure.ResultsTable getFalsePositiveErrorPerLabel(ij.process.ImageProcessor sourceImage, ij.process.ImageProcessor targetImage)Get the false positive error between two label images (source and target) per each individual labeled region.False Positive Error (for each individual labeled region r) $FN_r = \frac{ |S_r \setminus T_r| }{ |S_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveError
public static final double getFalsePositiveError(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the total false positive error between two label images (source and target).False Positive Error (for all regions) $FP = \frac{ \sum_r{|S_r \setminus T_r|} }{ \sum_r{|S_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveErrorPerLabel
public static final ij.measure.ResultsTable getFalsePositiveErrorPerLabel(ij.ImageStack sourceImage, ij.ImageStack targetImage)Get the false positive error between two label images (source and target) per each individual labeled region.False Positive Error (for each individual labeled region r) $FN_r = \frac{ |S_r \setminus T_r| }{ |S_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveError
public static final double getFalsePositiveError(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the total false positive error between two label images (source and target).False Positive Error (for all regions) $FP = \frac{ \sum_r{|S_r \setminus T_r|} }{ \sum_r{|S_r|} }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error or -1 if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
getFalsePositiveErrorPerLabel
public static final ij.measure.ResultsTable getFalsePositiveErrorPerLabel(ij.ImagePlus sourceImage, ij.ImagePlus targetImage)Get the false positive error between two label images (source and target) per each individual labeled region.False Positive Error (for each individual labeled region r) $FN_r = \frac{ |S_r \setminus T_r| }{ |S_r| }$.
- Parameters:
sourceImage
- source label imagetargetImage
- target label image- Returns:
- false positive error per label or null if error
- See Also:
- http://www.insight-journal.org/browse/publication/707
-
findPositionOfMaxValues
@Deprecated public static final java.awt.Point[] findPositionOfMaxValues(ij.process.ImageProcessor valueImage, ij.process.ImageProcessor labelImage, int[] labels)Deprecated.use LavelValues.findPositionOfMaxValues insteadFor each label, finds the position of the point belonging to label region defined bylabelImage
and with maximal value in intensity imagevalueImage
.- Parameters:
valueImage
- the intensity image containing values to comparelabelImage
- the intensity image containing label of each pixellabels
- the list of labels in the label image- Returns:
- the position of maximum value in intensity image for each label
-
findPositionOfMinValues
@Deprecated public static final java.awt.Point[] findPositionOfMinValues(ij.process.ImageProcessor valueImage, ij.process.ImageProcessor labelImage, int[] labels)Deprecated.use LavelValues.findPositionOfMinValues insteadFor each label, finds the position of the point belonging to label region defined bylabelImage
and with minimal value in intensity imagevalueImage
.- Parameters:
valueImage
- the intensity image containing values to comparelabelImage
- the intensity image containing label of each pixellabels
- the list of labels in the label image- Returns:
- the position of minimum value in intensity image for each label
-