Package qupath.lib.classifiers.object
Class ObjectClassifiers
java.lang.Object
qupath.lib.classifiers.object.ObjectClassifiers
Helper class for creating ObjectClassifiers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to create a simpleObjectClassifierthat assigns a classification based upon whether the measurement of an object is above, equal to or below a specified threshold.static classTypeAdapterFactoryto help with serializing ObjectClassifiers to and from JSON. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ObjectClassifier<T> createChannelClassifier(PathObjectFilter filter, ImageChannel channel, String measurement, double threshold) Create a classifier that thresholds a single measurement, assigning a class based on anImageChannelif the value is ≥ threshold.static <T> ObjectClassifier<T> createCompositeClassifier(Collection<ObjectClassifier<T>> classifiers) Create a compositeObjectClassifier, which sequentially applies multiple (usually single-class) classifiers.static <T> ObjectClassifier<T> createCompositeClassifier(ObjectClassifier<T>... classifiers) Create a compositeObjectClassifier, which sequentially applies multiple (usually single-class) classifiers.static TypeAdapterFactoryGet aTypeAdapterFactoryto handleObjectClassifierinstances.static <T> ObjectClassifier<T> readClassifier(Path path) Read the classifier from a file.static <T> voidwriteClassifier(ObjectClassifier<T> classifier, Path path) Write the classifier to a file.
-
Constructor Details
-
ObjectClassifiers
public ObjectClassifiers()
-
-
Method Details
-
getTypeAdapterFactory
Get aTypeAdapterFactoryto handleObjectClassifierinstances.- Returns:
-
createCompositeClassifier
Create a compositeObjectClassifier, which sequentially applies multiple (usually single-class) classifiers. This can be used for multiplexed images, where a single classifier may be trained for each marker.- Type Parameters:
T-- Parameters:
classifiers- an array of classifiers to combine- Returns:
- the composite object classifier
-
createCompositeClassifier
public static <T> ObjectClassifier<T> createCompositeClassifier(Collection<ObjectClassifier<T>> classifiers) Create a compositeObjectClassifier, which sequentially applies multiple (usually single-class) classifiers. This can be used for multiplexed images, where a single classifier may be trained for each marker.- Type Parameters:
T-- Parameters:
classifiers- a collection of classifiers to combine- Returns:
- the composite object classifier
-
createChannelClassifier
public static <T> ObjectClassifier<T> createChannelClassifier(PathObjectFilter filter, ImageChannel channel, String measurement, double threshold) Create a classifier that thresholds a single measurement, assigning a class based on anImageChannelif the value is ≥ threshold.- Parameters:
filter- filter to apply, typicallyPathObjectFilter.CELLSchannel-ImageChannelfrom which thePathClassshould be derived.measurement- name of the measurement (within the object'sMeasurementList)threshold- threshold to apply to the measurement- Returns:
- the object classifier
- See Also:
-
readClassifier
Read the classifier from a file.- Type Parameters:
T-- Parameters:
path-- Returns:
- Throws:
IOException
-
writeClassifier
public static <T> void writeClassifier(ObjectClassifier<T> classifier, Path path) throws IOException Write the classifier to a file.- Type Parameters:
T-- Parameters:
classifier-path-- Throws:
IOException
-