Package qupath.opencv.ml.pixel
Class PixelClassificationMeasurementManager
java.lang.Object
qupath.opencv.ml.pixel.PixelClassificationMeasurementManager
Helper class to compute area-based measurements for regions of interest based on pixel classification.
- Author:
- Pete Bankhead
-
Constructor Summary
ConstructorDescriptionPixelClassificationMeasurementManager
(ImageServer<BufferedImage> classifierServer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addMeasurements
(Collection<? extends PathObject> objectsToMeasure, String measurementID) Add measurements to specified objectsprotected int
Make a semi-educated guess as to an appropriate number of threads to use.getCachedMeasurementValue
(PathObject pathObject, String name) Get the value of a single measurement for a specified PathObject if all tiles are cached, otherwise return null.getCachedMeasurementValue
(ROI roi, String name) Get the value of a single measurement for a specified ROI if all tiles are cached, otherwise return null.Get the names of all measurements that may be returned.getMeasurementValue
(PathObject pathObject, String name) Get the value of a single measurement for a specified PathObject, computing it if it is unavailable.getMeasurementValue
(PathObject pathObject, String name, boolean cachedOnly) Deprecated.getMeasurementValue
(ROI roi, String name) Get the value of a single measurement for a specified ROI, computing it if it is unavailable.getMeasurementValue
(ROI roi, String name, boolean cachedOnly) Deprecated.protected int
static double
Get a suitable threshold assuming a raster contains probability values.
-
Constructor Details
-
PixelClassificationMeasurementManager
Constructor.- Parameters:
classifierServer
- the server for which measurements will be made.
-
-
Method Details
-
getMeasurementValue
@Deprecated public Number getMeasurementValue(PathObject pathObject, String name, boolean cachedOnly) Deprecated.Get the measurement value for this object.- Parameters:
pathObject
- the PathObject to measurename
- the measurement namecachedOnly
- if true, return null if the measurement cannot be determined from cached tiles- Returns:
-
getCachedMeasurementValue
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
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.Get the measurement value for this ROI.- Parameters:
roi
- the ROI to measurename
- the measurement namecachedOnly
- if true, return null if the measurement cannot be determined from cached tiles- Returns:
-
getCachedMeasurementValue
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
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
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
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:
-
getMeasurementValue(PathObject, String)
orgetCachedMeasurementValue(PathObject, String)
instead