Class DnnObjectClassifier

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

public class DnnObjectClassifier 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 is likely to change in the future.

  • Field Summary

    Fields inherited from interface qupath.lib.classifiers.object.ObjectClassifier

    PROJECT_LOCATION
  • Constructor Summary

    Constructors
    Constructor
    Description
    DnnObjectClassifier(qupath.lib.objects.PathObjectFilter filter, DnnModel model, List<qupath.lib.objects.classes.PathClass> pathClasses, int width, int height, double requestedPixelSize)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    classifyObjects(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean resetExistingClass)
     
    getMissingFeatures(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects)
     
    Collection<qupath.lib.objects.classes.PathClass>
     
     
    protected int
    tryToClassify(List<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier)
    Try to classify a batch of objects.
    protected boolean
    tryToClassify(qupath.lib.objects.PathObject pathObject, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier)
     
    boolean
    updateURIs(Map<URI,URI> replacements)
     

    Methods inherited from class qupath.lib.classifiers.object.AbstractObjectClassifier

    classifyObjects, getCompatibleObjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface qupath.lib.io.UriResource

    getUris, updateUris
  • Constructor Details

    • DnnObjectClassifier

      public DnnObjectClassifier(qupath.lib.objects.PathObjectFilter filter, DnnModel 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(qupath.lib.objects.PathObject pathObject, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier)
    • tryToClassify

      protected int tryToClassify(List<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier)
      Try to classify a batch of objects.
      Parameters:
      pathObjects -
      server -
      downsample -
      classifier -
      Returns:
      number of classified objects
    • 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