Class Centroid

java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.measure.region2d.RegionAnalyzer2D<java.awt.geom.Point2D>
inra.ijpb.measure.region2d.Centroid
All Implemented Interfaces:
Algo, RegionAnalyzer<java.awt.geom.Point2D>

public class Centroid
extends RegionAnalyzer2D<java.awt.geom.Point2D>
Computes centroid position of regions within binary or label images.
Author:
dlegland
See Also:
EquivalentEllipse, Centroid3D
  • Constructor Summary

    Constructors
    Constructor Description
    Centroid()
    Default constructor
  • Method Summary

    Modifier and Type Method Description
    java.awt.geom.Point2D[] analyzeRegions​(ij.process.ImageProcessor image, int[] labels, ij.measure.Calibration calib)
    Computes centroid of each region in input label image.
    static double[][] centroids​(ij.process.ImageProcessor labelImage, int[] labels)
    Computes centroid of each label in input image and returns the result as an array of double for each label.
    static java.awt.geom.Point2D[] centroids​(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)
    Computes centroid of each label in input image and returns the result as an array of double for each label.
    ij.measure.ResultsTable createTable​(java.util.Map<java.lang.Integer,​java.awt.geom.Point2D> map)
    Utility method that transforms the mapping between labels and Point2D instances into a ResultsTable that can be displayed with ImageJ.

    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

    • Centroid

      public Centroid()
      Default constructor
  • Method Details

    • centroids

      public static final java.awt.geom.Point2D[] centroids​(ij.process.ImageProcessor labelImage, int[] labels, ij.measure.Calibration calib)
      Computes centroid of each label in input image and returns the result as an array of double for each label.
      Parameters:
      labelImage - the input image containing label of particles
      labels - the array of unique labels in image the number of directions to process, either 2 or 4
      calib - the calibration of the image
      Returns:
      an array containing for each label, the coordinates of the centroid, in calibrated coordinates
    • centroids

      public static final double[][] centroids​(ij.process.ImageProcessor labelImage, int[] labels)
      Computes centroid of each label in input image and returns the result as an array of double for each label. This version does not take into account the spatial calibration, and returns the centroids in pixel coordinates.
      Parameters:
      labelImage - the input image containing label of particles
      labels - the array of unique labels in image the number of directions to process, either 2 or 4
      Returns:
      an array containing for each label, the coordinates of the centroid, in pixel coordinates
    • createTable

      public ij.measure.ResultsTable createTable​(java.util.Map<java.lang.Integer,​java.awt.geom.Point2D> map)
      Utility method that transforms the mapping between labels and Point2D instances into a ResultsTable that can be displayed with ImageJ.
      Parameters:
      map - the mapping between labels and centroids
      Returns:
      a ResultsTable that can be displayed with ImageJ.
    • analyzeRegions

      public java.awt.geom.Point2D[] analyzeRegions​(ij.process.ImageProcessor image, int[] labels, ij.measure.Calibration calib)
      Computes centroid of each region in input label image.
      Specified by:
      analyzeRegions in class RegionAnalyzer2D<java.awt.geom.Point2D>
      Parameters:
      image - the input image containing label of particles
      labels - the array of labels within the image
      calib - the calibration of the image
      Returns:
      an array of Point2D representing the calibrated centroid coordinates