Class PixelClassificationMeasurementManager

java.lang.Object
qupath.opencv.ml.pixel.PixelClassificationMeasurementManager

public class PixelClassificationMeasurementManager extends Object
Helper class to compute area-based measurements for regions of interest based on pixel classification.
Author:
Pete Bankhead
  • Constructor Details

    • PixelClassificationMeasurementManager

      public PixelClassificationMeasurementManager(ImageServer<BufferedImage> classifierServer)
      Constructor.
      Parameters:
      classifierServer - the server for which measurements will be made.
  • Method Details

    • getMeasurementValue

      @Deprecated public Number getMeasurementValue(PathObject pathObject, String name, boolean cachedOnly)
      Get the measurement value for this object.
      Parameters:
      pathObject - the PathObject to measure
      name - the measurement name
      cachedOnly - if true, return null if the measurement cannot be determined from cached tiles
      Returns:
    • getCachedMeasurementValue

      public Number getCachedMeasurementValue(PathObject pathObject, String name)
      Get the value of a single measurement for a specified PathObject if all tiles are cached, otherwise return null.
      Parameters:
      pathObject -
      name -
      Returns:
      See Also:
    • getMeasurementValue

      public Number getMeasurementValue(PathObject pathObject, String name)
      Get the value of a single measurement for a specified PathObject, computing it if it is unavailable.
      Parameters:
      pathObject -
      name -
      Returns:
      See Also:
    • getMeasurementValue

      @Deprecated public Number getMeasurementValue(ROI roi, String name, boolean cachedOnly)
      Get the measurement value for this ROI.
      Parameters:
      roi - the ROI to measure
      name - the measurement name
      cachedOnly - if true, return null if the measurement cannot be determined from cached tiles
      Returns:
    • getCachedMeasurementValue

      public Number getCachedMeasurementValue(ROI roi, String name)
      Get the value of a single measurement for a specified ROI if all tiles are cached, otherwise return null.
      Parameters:
      roi -
      name -
      Returns:
      See Also:
    • getMeasurementValue

      public Number getMeasurementValue(ROI roi, String name)
      Get the value of a single measurement for a specified ROI, computing it if it is unavailable.
      Parameters:
      roi -
      name -
      Returns:
      See Also:
    • addMeasurements

      public boolean addMeasurements(Collection<? extends PathObject> objectsToMeasure, String measurementID)
      Add measurements to specified objects
      Parameters:
      objectsToMeasure - the objects to measure.
      measurementID - identifier that is prepended to measurement names, to make these identifiable later (optional; may be null)
      Returns:
      true if measurements were added, false otherwise
      Since:
      v0.5.0
    • getMeasurementNames

      public List<String> getMeasurementNames()
      Get the names of all measurements that may be returned.
      Returns:
    • calculatePreferredParallelism

      protected int calculatePreferredParallelism()
      Make a semi-educated guess as to an appropriate number of threads to use. We lack much information about the image and pixel classifier, so this should be a fairly pessimistic guess.
      Returns:
    • getPoolSizeProp

      protected int getPoolSizeProp()
    • getProbabilityThreshold

      public static double getProbabilityThreshold(WritableRaster raster)
      Get a suitable threshold assuming a raster contains probability values. This is determined from the TransferType. For integer types this is 127.5, otherwise it is 0.5.
      Parameters:
      raster -
      Returns: