Class OpenCVModelObjectClassifier

java.lang.Object
qupath.lib.classifiers.object.AbstractObjectClassifier<BufferedImage>
qupath.opencv.dnn.OpenCVModelObjectClassifier
All Implemented Interfaces:
qupath.lib.classifiers.object.ObjectClassifier<BufferedImage>, qupath.lib.io.UriResource

public class OpenCVModelObjectClassifier extends qupath.lib.classifiers.object.AbstractObjectClassifier<BufferedImage> implements qupath.lib.io.UriResource
Initial implementation of a patch-based ObjectClassifier using an OpenCV-compatible DNN.

Warning! This implementation may change in the future.

  • Constructor Details

    • OpenCVModelObjectClassifier

      public OpenCVModelObjectClassifier(qupath.lib.objects.PathObjectFilter filter, OpenCVDnn model, List<qupath.lib.objects.classes.PathClass> pathClasses, int width, int height, double requestedPixelSize)
      Constructor.
      Parameters:
      filter - filter to select compatible options
      model - wrapper for the DNN model, including optional preprocessing
      pathClasses - ordered list of classifications, corresponding to the predicted labels
      width - patch width, in pixels, at the classification size
      height - patch height, in pixels, at the classification side
      requestedPixelSize - requested pixel size, in calibrated units, used to calculate the downsample value
  • Method Details

    • getPathClasses

      public Collection<qupath.lib.objects.classes.PathClass> getPathClasses()
      Specified by:
      getPathClasses in interface qupath.lib.classifiers.object.ObjectClassifier<BufferedImage>
    • classifyObjects

      public int classifyObjects(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean resetExistingClass)
      Specified by:
      classifyObjects in interface qupath.lib.classifiers.object.ObjectClassifier<BufferedImage>
    • tryToClassify

      protected boolean tryToClassify(ClassificationModel model, qupath.lib.objects.PathObject pathObject, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier)
    • getMissingFeatures

      public Map<String,Integer> getMissingFeatures(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects)
      Specified by:
      getMissingFeatures in interface qupath.lib.classifiers.object.ObjectClassifier<BufferedImage>
    • getURIs

      public Collection<URI> getURIs() throws IOException
      Specified by:
      getURIs in interface qupath.lib.io.UriResource
      Throws:
      IOException
    • updateURIs

      public boolean updateURIs(Map<URI,URI> replacements) throws IOException
      Specified by:
      updateURIs in interface qupath.lib.io.UriResource
      Throws:
      IOException