Class StatsComparator

java.lang.Object
com.xinapse.multisliceimage.roi.StatsComparator
All Implemented Interfaces:
Serializable, Comparator<ROI>

public class StatsComparator extends Object implements Comparator<ROI>, Serializable
A Comparator used in sorting operations for ROIs based on their statistics.
See Also:
  • Constructor Details

    • StatsComparator

      public StatsComparator(StatsType statsType, Object pix, PixelDataType dataType, int nCols, int nRows, float pixelXSize, float pixelYSize, ComplexMode complexMode)
      Create a new StatsComparator object, for sorting ROIs using the supplied type of statistic to determine the sort order.
      Parameters:
      statsType - the StatsType on which to sort.
      pix - the image pixel values.
      dataType - the PixelDataType of the image pixel values.
      nCols - the number of image columns.
      nRows - the number of image rows.
      pixelXSize - the image pixel width, in mm.
      pixelYSize - the image pixel height, in mm.
      complexMode - the ComplexMode for complex images.
  • Method Details

    • compare

      public int compare(ROI roi1, ROI roi2)
      Compares the statistics for two ROIs for order. Returns a negative integer, zero, or a positive integer as the statistic for the first ROI is less than, equal to, or greater than the statistic for the second ROI. The statistic to be compared is determined at instantiation of this Comparator.
      Specified by:
      compare in interface Comparator<ROI>
      Parameters:
      roi1 - the first ROI for which to compare statistics.
      roi2 - the second ROI for which to compare statistics.
      Returns:
      a negative integer, zero, or a positive integer as the first ROI's statistic is less than, equal to, or greater than the second.