Class GeodesicDiameter

java.lang.Object
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
  • Constructor Details

    • GeodesicDiameter

      public GeodesicDiameter()
      Empty constructor with default settings.
    • GeodesicDiameter

      public GeodesicDiameter​(ChamferMask2D mask)
      Creates a new geodesic diameter computation operator.
      Parameters:
      mask - the chamfer mask used for propagating distances
    • GeodesicDiameter

      @Deprecated public GeodesicDiameter​(ChamferWeights weights)
      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

      public GeodesicDiameter​(GeodesicDistanceTransform gdt)
      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 background
      labels - the list of region labels to process
      calib - 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 class RegionAnalyzer2D<GeodesicDiameter.Result>
      Parameters:
      labelImage - a label image, containing either the label of a particle or region, or zero for background
      labels - the list of region labels to process
      calib - the spatial caliration of the image
      Returns:
      the geodesic diameter of each region within the label image