Package inra.ijpb.measure.region2d
Class GeodesicDiameter
java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.measure.region2d.RegionAnalyzer2D<GeodesicDiameter.Result>
inra.ijpb.measure.region2d.GeodesicDiameter
- All Implemented Interfaces:
Algo
,RegionAnalyzer<GeodesicDiameter.Result>
public class GeodesicDiameter extends RegionAnalyzer2D<GeodesicDiameter.Result>
Computes geodesic diameter of a set of labeled particles or regions, using an
inner instance of GeodesicDistanceTransform
for propagating chamfer distances.
The result of the algorithm is stored in a collection of
GeodesicDiameter.Result
instances, that returns the diameter,
coordinates of extreme points, and eventually the geodesic path corresponding
to each region.
This version uses optimized algorithm, that propagates distances of all particles during each pass. This reduces computation overhead due to iteration over particles.
Example of use:
GeodesicDiameter algo = new GeodesicDiameter(ChamferWeights.CHESSKNIGHT);
Map<Integer,GeodesicDiameter.Result> geodDiams = algo.process(inputLabelImage);
for (int label : geodDiams.keySet())
{
double diam = geodDiams.get(label).diameter;
System.out.printl(String.format("geod. diam. of label %d is %5.2f", label, diam);
}
- Since:
- 1.3.5
- Author:
- David Legland
- See Also:
GeodesicDiameter3D
,GeodesicDistanceTransform
,GeodesicDiameter.Result
,ChamferMask2D
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GeodesicDiameter.Result
Inner class used for representing results of geodesic diameters computations. -
Constructor Summary
Constructors Constructor Description GeodesicDiameter()
Empty constructor with default settings.GeodesicDiameter(float[] weights)
Deprecated.GeodesicDiameter(ChamferWeights weights)
Deprecated.ChamferWeights is replaced by ChamferMask2D (since 1.4.4)GeodesicDiameter(ChamferMask2D mask)
Creates a new geodesic diameter computation operator.GeodesicDiameter(GeodesicDistanceTransform gdt)
Creates a new geodesic diameter computation operator. -
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.Integer,GeodesicDiameter.Result>
analyzeRegions(ij.process.ImageProcessor labelImage)
Computes the geodesic diameter of each particle within the given label image.GeodesicDiameter.Result[]
analyzeRegions(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)
Computes the geodesic diameter of each region within the given label image.ij.measure.ResultsTable
createTable(java.util.Map<java.lang.Integer,GeodesicDiameter.Result> map)
Utility method that transforms the mapping between labels and result instances into a ResultsTable that can be displayed with ImageJ.static GeodesicDiameter.Result[]
geodesicDiameters(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)
Computes the geodesic diameter of each region within the given label image.boolean
getComputePaths()
Returns the value of the computePaths option.void
setChamferWeights(float[] weights)
Deprecated.void
setComputePaths(boolean bool)
Updates the value of the computePahs option.Methods inherited from class inra.ijpb.measure.region2d.RegionAnalyzer2D
analyzeRegions, analyzeRegions, computeTable
Methods inherited from class inra.ijpb.algo.AlgoStub
addAlgoListener, removeAlgoListener
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
GeodesicDiameter
public GeodesicDiameter()Empty constructor with default settings. -
GeodesicDiameter
Creates a new geodesic diameter computation operator.- Parameters:
mask
- the chamfer mask used for propagating distances
-
GeodesicDiameter
Deprecated.ChamferWeights is replaced by ChamferMask2D (since 1.4.4)Creates a new geodesic diameter computation operator.- Parameters:
weights
- the array of weights for orthogonal, diagonal, and eventually chess-knight moves neighbors
-
GeodesicDiameter
@Deprecated public GeodesicDiameter(float[] weights)Deprecated.Creates a new geodesic diameter computation operator.- Parameters:
weights
- the array of weights for orthogonal, diagonal, and eventually chess-knight moves neighbors
-
GeodesicDiameter
Creates a new geodesic diameter computation operator.- Parameters:
gdt
- the instance of Geodesic Distance Transform calculator used for propagating distances
-
-
Method Details
-
geodesicDiameters
public static final GeodesicDiameter.Result[] geodesicDiameters(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)Computes the geodesic diameter of each region within the given label image.- Parameters:
labelImage
- a label image, containing either the label of a particle or region, or zero for backgroundlabels
- the list of region labels to processcalib
- the spatial caliration of the image- Returns:
- the geodesic diameter of each region within the label image
-
analyzeRegions
public java.util.Map<java.lang.Integer,GeodesicDiameter.Result> analyzeRegions(ij.process.ImageProcessor labelImage)Computes the geodesic diameter of each particle within the given label image.- Parameters:
labelImage
- a label image, containing either the label of a particle or region, or zero for background- Returns:
- a the geodesic diameter of each particle within the label image
-
getComputePaths
public boolean getComputePaths()Returns the value of the computePaths option.- Returns:
- the value of the computePaths option.
-
setComputePaths
public void setComputePaths(boolean bool)Updates the value of the computePahs option.- Parameters:
bool
- the new value of the computePahs option.
-
setChamferWeights
@Deprecated public void setChamferWeights(float[] weights)Deprecated.Updates the value of weights.- Parameters:
weights
- the new value of the weights.
-
createTable
public ij.measure.ResultsTable createTable(java.util.Map<java.lang.Integer,GeodesicDiameter.Result> map)Utility method that transforms the mapping between labels and result instances into a ResultsTable that can be displayed with ImageJ.- Parameters:
map
- the mapping between labels and results- Returns:
- a ResultsTable that can be displayed with ImageJ.
-
analyzeRegions
public GeodesicDiameter.Result[] analyzeRegions(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)Computes the geodesic diameter of each region within the given label image.- Specified by:
analyzeRegions
in classRegionAnalyzer2D<GeodesicDiameter.Result>
- Parameters:
labelImage
- a label image, containing either the label of a particle or region, or zero for backgroundlabels
- the list of region labels to processcalib
- the spatial caliration of the image- Returns:
- the geodesic diameter of each region within the label image
-