Class PixelClassifiers

java.lang.Object
qupath.opencv.ml.pixel.PixelClassifiers

public class PixelClassifiers extends Object
Static methods and classes for working with pixel classifiers.
Author:
Pete Bankhead
  • Constructor Details

    • PixelClassifiers

      public PixelClassifiers()
  • Method Details

    • getTypeAdapterFactory

      public static TypeAdapterFactory getTypeAdapterFactory()
      Get the TypeAdapterFactory default used for PixelClassifier objects. This is intended for internal use by QuPath, and should be registered with GsonTools.
      Returns:
    • readClassifier

      public static PixelClassifier readClassifier(Path path) throws IOException
      Read a standard pixel classifier from a file.
      Parameters:
      path - the file containing the classifier
      Returns:
      Throws:
      IOException
    • writeClassifier

      public static void writeClassifier(PixelClassifier classifier, Path path) throws IOException
      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 an ImageDataOp into a simple classifier by adding an interpretation to the output labels.
      Parameters:
      op -
      inputResolution -
      classifications -
      Returns:
    • createClassifier

      public static PixelClassifier createClassifier(ImageDataOp op, PixelClassifierMetadata metadata)
      Convert an ImageDataOp 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 new PixelClassifier that applies a threshold to one channel of an image.
      Parameters:
      inputResolution - resolution at which the threshold should be applied
      channel - the channel to threshold (zero-based)
      threshold - the threshold value to apply
      below - 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 new PixelClassifier that applies a threshold to one or more channels of an image.
      Parameters:
      inputResolution - resolution at which the threshold should be applied
      thresholds - map between channel numbers (zero-based) and thresholds
      below - the classification for pixels whose values are below the threshold in any channel
      aboveEquals - the classification for pixels whose values are greater than or equal to the threshold in all channels
      Returns:
      the pixel classifier