Class ObjectClassifiers

java.lang.Object
qupath.lib.classifiers.object.ObjectClassifiers

public class ObjectClassifiers extends Object
Helper class for creating ObjectClassifiers.
Author:
Pete Bankhead
  • Constructor Details

    • ObjectClassifiers

      public ObjectClassifiers()
  • Method Details

    • getTypeAdapterFactory

      public static TypeAdapterFactory getTypeAdapterFactory()
      Get a TypeAdapterFactory to handle ObjectClassifier instances.
      Returns:
    • createCompositeClassifier

      public static <T> ObjectClassifier<T> createCompositeClassifier(ObjectClassifier<T>... classifiers)
      Create a composite ObjectClassifier, 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 composite ObjectClassifier, 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 an ImageChannel if the value is ≥ threshold.
      Parameters:
      filter - filter to apply, typically PathObjectFilter.CELLS
      channel - ImageChannel from which the PathClass should be derived.
      measurement - name of the measurement (within the object's MeasurementList)
      threshold - threshold to apply to the measurement
      Returns:
      the object classifier
      See Also:
    • readClassifier

      public static <T> ObjectClassifier<T> readClassifier(Path path) throws IOException
      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