Class ROIStats

java.lang.Object
com.xinapse.multisliceimage.roi.ROIStats

public class ROIStats extends Object
A Class containing the statistics that are computed for an ROI.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
    The area of this ROI in square mm.
    The histogram of pixel intensities inside an ROI in intensity units.
    final double
    The maximum pixel intensity inside an ROI in intensity units.
    final double
    The mean pixel intensity inside an ROI in intensity units.
    final double
    The minimum pixel intensity inside an ROI in intensity units.
    final double
    The standard deviation pixel intensity inside an ROI in intensity units.
    final boolean
    A flag to indicate that the intensity-based statistics are valid.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ROIStats(double area)
    Creates an ROIStats object without valid intensity statistics or histogram of intensities but with a valid area statistic.
    ROIStats(double area, double mean, double stddev, double min, double max)
    Creates an ROIStats object with valid intensity and area statistics, but no histogram of intensities.
    ROIStats(double area, double mean, double stddev, double min, double max, Histogram histo)
    Creates an ROIStats object with valid intensity and area statistics, and a histogram of intensities.
    Creates a new ROIStats object, copying all values from existing ROIStats.
    ROIStats(ROIStats stats, double area)
    Creates a new ROIStats object, copying all values except the area from existing ROIStats.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears (sets to null) the histogram for these ROIStats.
    static ROIStats
    Returns the cumulative stats for a List of ROIStats.
    double
    Returns the median pixel intensity.
    boolean
    Returns whether this ROIStats has valid intensity-related statistics.
    getWriteDescription(boolean writeArea, boolean writeMean, boolean writeStddev, boolean writeMin, boolean writeMax, boolean writeMedian, PixelDataType dataType, ComplexMode complexMode)
    Returns a java.util.List<String> of each of the requested statistics, correctly formatted for writing.
    Returns a String describing this ROIStats object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • area

      public final double area
      The area of this ROI in square mm.
    • mean

      public final double mean
      The mean pixel intensity inside an ROI in intensity units.
    • stddev

      public final double stddev
      The standard deviation pixel intensity inside an ROI in intensity units.
    • min

      public final double min
      The minimum pixel intensity inside an ROI in intensity units.
    • max

      public final double max
      The maximum pixel intensity inside an ROI in intensity units.
    • histo

      public Histogram histo
      The histogram of pixel intensities inside an ROI in intensity units.
    • validIntensityStats

      public final boolean validIntensityStats
      A flag to indicate that the intensity-based statistics are valid.
  • Constructor Details

    • ROIStats

      public ROIStats(double area)
      Creates an ROIStats object without valid intensity statistics or histogram of intensities but with a valid area statistic.
      Parameters:
      area - the area within the perimieter of an ROI in square mm.
    • ROIStats

      public ROIStats(double area, double mean, double stddev, double min, double max)
      Creates an ROIStats object with valid intensity and area statistics, but no histogram of intensities.
      Parameters:
      area - the area within the perimieter of an ROI in square mm.
      mean - the mean pixel intensity within an ROI.
      stddev - the standard deviation of pixel intensity within an ROI.
      min - the minimum pixel intensity within an ROI.
      max - the maximum pixel intensity within an ROI.
    • ROIStats

      public ROIStats(double area, double mean, double stddev, double min, double max, Histogram histo)
      Creates an ROIStats object with valid intensity and area statistics, and a histogram of intensities.
      Parameters:
      area - the area within the perimieter of an ROI in square mm.
      mean - the mean pixel intensity within an ROI.
      stddev - the standard deviation of pixel intensity within an ROI.
      min - the minimum pixel intensity within an ROI.
      max - the maximum pixel intensity within an ROI.
      histo - the histogram of pixel intensities within an ROI.
    • ROIStats

      public ROIStats(ROIStats stats)
      Creates a new ROIStats object, copying all values from existing ROIStats.
      Parameters:
      stats - the ROIStats from which to copy the values.
    • ROIStats

      public ROIStats(ROIStats stats, double area)
      Creates a new ROIStats object, copying all values except the area from existing ROIStats.
      Parameters:
      stats - the ROIStats from which to copy all the values except the area.
      area - the area.
  • Method Details

    • getValidIntensityStats

      public boolean getValidIntensityStats()
      Returns whether this ROIStats has valid intensity-related statistics.
      Returns:
      true if his ROIStats has valid intensity-related statistics; false otherwise.
    • clearHisto

      public void clearHisto()
      Clears (sets to null) the histogram for these ROIStats.
    • getMedian

      public double getMedian() throws ROIException
      Returns the median pixel intensity.
      Returns:
      the median pixel intensity.
      Throws:
      ROIException - if the median intensity can't be computed because the stats does not contain a Histogram of intensities.
    • getWriteDescription

      public List<String> getWriteDescription(boolean writeArea, boolean writeMean, boolean writeStddev, boolean writeMin, boolean writeMax, boolean writeMedian, PixelDataType dataType, ComplexMode complexMode)
      Returns a java.util.List<String> of each of the requested statistics, correctly formatted for writing. This is the format used when ROI statistics are written to disk.
      Parameters:
      writeArea - whether to write the area statistic. If true the area is in the List of Strings returned.
      writeMean - whether to write the mean statistic. If true the mean is in the List of Strings returned.
      writeStddev - whether to write the standard deviation statistic. If true the standard deviation is in the List of Strings returned.
      writeMin - whether to write the minimum statistic. If true the minimum is in the List of Strings returned.
      writeMax - whether to write the maximum statistic. If true the maximum is in the List of Strings returned.
      writeMedian - whether to write the median statistic. If true the median is in the List of Strings returned.
      dataType - the PixelDataType of the image for which these statistics were created. Needed because Complex images statistics are annotated according to the ComplexMode.
      complexMode - the ComplexMode which reflects which property of a Complex image these statistics represent.
      Returns:
      a String[] containing each of the requested statistics correctly formatted for saving.
    • getCumulativeStats

      public static ROIStats getCumulativeStats(List<ROIStats> statsList, PixelDataType dataType)
      Returns the cumulative stats for a List of ROIStats.

      Note: if any of the ROIStats in the list has invalid intensity statistics, then the returned ROIStats will have invalid intensity statistics.

      Parameters:
      statsList - the List of ROIStats for which to compute the total statistics.
      dataType - the PixelDataType for the image from which these ROIStats are computed.
      Returns:
      the ROIStats for the list.
    • toString

      public String toString()
      Returns a String describing this ROIStats object.
      Overrides:
      toString in class Object
      Returns:
      a String describing this ROIStats object.