Package qupath.opencv.ml.pixel
Class PixelClassifiers
java.lang.Object
qupath.opencv.ml.pixel.PixelClassifiers
Static methods and classes for working with pixel classifiers.
- Author:
- Pete Bankhead
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PixelClassifier
createClassifier
(OpenCVClassifiers.OpenCVStatModel statModel, ImageDataOp calculator, PixelClassifierMetadata metadata, boolean do8Bit) Create a PixelClassifier based on an OpenCV StatModel and feature calculator.static PixelClassifier
createClassifier
(ImageDataOp op, PixelClassifierMetadata metadata) Convert anImageDataOp
into a simple classifier.static PixelClassifier
createClassifier
(ImageDataOp op, PixelCalibration inputResolution, Map<Integer, PathClass> classifications) Convert anImageDataOp
into a simple classifier by adding an interpretation to the output labels.static PixelClassifier
createThresholdClassifier
(PixelCalibration inputResolution, int channel, double threshold, PathClass below, PathClass aboveEquals) Create a newPixelClassifier
that applies a threshold to one channel of an image.static PixelClassifier
createThresholdClassifier
(PixelCalibration inputResolution, Map<Integer, ? extends Number> thresholds, PathClass below, PathClass aboveEquals) Create a newPixelClassifier
that applies a threshold to one or more channels of an image.static TypeAdapterFactory
Get theTypeAdapterFactory
default used forPixelClassifier
objects.static PixelClassifier
readClassifier
(Path path) Read a standard pixel classifier from a file.static void
writeClassifier
(PixelClassifier classifier, Path path) Write a pixel classifier to a file.
-
Constructor Details
-
PixelClassifiers
public PixelClassifiers()
-
-
Method Details
-
getTypeAdapterFactory
Get theTypeAdapterFactory
default used forPixelClassifier
objects. This is intended for internal use by QuPath, and should be registered withGsonTools
.- Returns:
-
readClassifier
Read a standard pixel classifier from a file.- Parameters:
path
- the file containing the classifier- Returns:
- Throws:
IOException
-
writeClassifier
Write a pixel classifier to a file.- Parameters:
classifier
-path
-- Throws:
IOException
-
createClassifier
public static PixelClassifier createClassifier(ImageDataOp op, PixelCalibration inputResolution, Map<Integer, PathClass> classifications) Convert anImageDataOp
into a simple classifier by adding an interpretation to the output labels.- Parameters:
op
-inputResolution
-classifications
-- Returns:
-
createClassifier
Convert anImageDataOp
into a simple classifier.- Parameters:
op
-metadata
-- Returns:
-
createClassifier
public static PixelClassifier createClassifier(OpenCVClassifiers.OpenCVStatModel statModel, ImageDataOp calculator, PixelClassifierMetadata metadata, boolean do8Bit) Create a PixelClassifier based on an OpenCV StatModel and feature calculator.- Parameters:
statModel
-calculator
-metadata
-do8Bit
-- Returns:
-
createThresholdClassifier
public static PixelClassifier createThresholdClassifier(PixelCalibration inputResolution, int channel, double threshold, PathClass below, PathClass aboveEquals) Create a newPixelClassifier
that applies a threshold to one channel of an image.- Parameters:
inputResolution
- resolution at which the threshold should be appliedchannel
- the channel to threshold (zero-based)threshold
- the threshold value to applybelow
- the classification for pixels below the threshold (must not be null)aboveEquals
- the classification for pixels greater than or equal to the threshold (must not be null)- Returns:
- the pixel classifier
-
createThresholdClassifier
public static PixelClassifier createThresholdClassifier(PixelCalibration inputResolution, Map<Integer, ? extends Number> thresholds, PathClass below, PathClass aboveEquals) Create a newPixelClassifier
that applies a threshold to one or more channels of an image.- Parameters:
inputResolution
- resolution at which the threshold should be appliedthresholds
- map between channel numbers (zero-based) and thresholdsbelow
- the classification for pixels whose values are below the threshold in any channelaboveEquals
- the classification for pixels whose values are greater than or equal to the threshold in all channels- Returns:
- the pixel classifier
-