Package qupath.opencv.ml.pixel
Class PixelClassifiers
java.lang.Object
qupath.opencv.ml.pixel.PixelClassifiers
Static methods and classes for working with pixel classifiers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PixelClassifiercreateClassifier(OpenCVClassifiers.OpenCVStatModel statModel, ImageDataOp calculator, PixelClassifierMetadata metadata, boolean do8Bit) Create a PixelClassifier based on an OpenCV StatModel and feature calculator.static PixelClassifiercreateClassifier(ImageDataOp op, PixelClassifierMetadata metadata) Convert anImageDataOpinto a simple classifier.static PixelClassifiercreateClassifier(ImageDataOp op, PixelCalibration inputResolution, Map<Integer, PathClass> classifications) Convert anImageDataOpinto a simple classifier by adding an interpretation to the output labels.static PixelClassifiercreateThresholdClassifier(PixelCalibration inputResolution, int channel, double threshold, PathClass below, PathClass aboveEquals) Create a newPixelClassifierthat applies a threshold to one channel of an image.static PixelClassifiercreateThresholdClassifier(PixelCalibration inputResolution, Map<Integer, ? extends Number> thresholds, PathClass below, PathClass aboveEquals) Create a newPixelClassifierthat applies a threshold to one or more channels of an image.static TypeAdapterFactoryGet theTypeAdapterFactorydefault used forPixelClassifierobjects.static PixelClassifierreadClassifier(Path path) Read a standard pixel classifier from a file.static voidwriteClassifier(PixelClassifier classifier, Path path) Write a pixel classifier to a file.
-
Constructor Details
-
PixelClassifiers
public PixelClassifiers()
-
-
Method Details
-
getTypeAdapterFactory
Get theTypeAdapterFactorydefault used forPixelClassifierobjects. 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 anImageDataOpinto a simple classifier by adding an interpretation to the output labels.- Parameters:
op-inputResolution-classifications-- Returns:
-
createClassifier
Convert anImageDataOpinto 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 newPixelClassifierthat 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 newPixelClassifierthat 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
-