Class OpenCVProcessor

java.lang.Object
qupath.lib.experimental.pixels.OpenCVProcessor

public class OpenCVProcessor extends Object
Class to generate a PixelProcessor when using OpenCV for the primary image representation.
  • Constructor Details

    • OpenCVProcessor

      public OpenCVProcessor()
  • Method Details

    • createDetectionOutputHandler

      public static <S, T> OutputHandler<S,T,Mat> createDetectionOutputHandler()
      Create an OutputHandler that attempts to convert the output into detection objects.
      Returns:
    • createDetectionOutputHandler

      public static <S, T> OutputHandler<S,T,Mat> createDetectionOutputHandler(Map<? extends Number,String> classificationMap)
      Create an OutputHandler that attempts to convert the output into detection objects.
      Parameters:
      classificationMap - a map used to convert labels into classifications
      Returns:
    • createAnnotationOutputHandler

      public static <S, T> OutputHandler<S,T,Mat> createAnnotationOutputHandler()
      Create an OutputHandler that attempts to convert the output into annotation objects.
      Returns:
    • createAnnotationOutputHandler

      public static <S, T> OutputHandler<S,T,Mat> createAnnotationOutputHandler(Map<? extends Number,String> classificationMap)
      Create an OutputHandler that attempts to convert the output into annotation objects.
      Parameters:
      classificationMap - a map used to convert labels into classifications
      Returns:
    • createAnnotationConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createAnnotationConverter()
      Create an OutputHandler.OutputToObjectConverter that attempts to convert the output into annotation objects.
      Returns:
    • createAnnotationConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createAnnotationConverter(Map<? extends Number,String> classificationMap)
      Create an OutputHandler.OutputToObjectConverter that attempts to convert the output into annotation objects.
      Parameters:
      classificationMap - a map used to convert labels into classifications
      Returns:
    • createDetectionConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createDetectionConverter()
      Create an OutputHandler.OutputToObjectConverter that attempts to convert the output into detection objects.
      Returns:
    • createDetectionConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createDetectionConverter(Map<? extends Number,String> classificationMap)
      Create an OutputHandler.OutputToObjectConverter that attempts to convert the output into detection objects.
      Parameters:
      classificationMap - a map used to convert labels into classifications
      Returns:
    • createObjectConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createObjectConverter(Function<qupath.lib.roi.interfaces.ROI,qupath.lib.objects.PathObject> creator)
      Create an OutputHandler.OutputToObjectConverter to convert Mat binary or labeled images to path objects.
      Parameters:
      creator - the creator function to determine the type of object (e.g. detection, annotation)
      Returns:
      the converter
    • createObjectConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createObjectConverter(Function<qupath.lib.roi.interfaces.ROI,qupath.lib.objects.PathObject> creator, Map<? extends Number,String> classificationMap)
      Create an OutputHandler.OutputToObjectConverter to convert Mat labeled images to path objects, optionally setting the classification.
      Parameters:
      creator - the creator function to determine the type of object (e.g. detection, annotation)
      classificationMap - a map used to convert labels intoo
      Returns:
      the converter
    • createObjectConverter

      public static <S, T> OutputHandler.OutputToObjectConverter<S,T,Mat> createObjectConverter(BiFunction<qupath.lib.roi.interfaces.ROI,Number,qupath.lib.objects.PathObject> creator)
      Create an OutputHandler.OutputToObjectConverter to convert Mat binary or labeled images to path objects, optionally using the label number.
      Parameters:
      creator - the creator function to determine the type of object (e.g. detection, annotation). The second argument is the label, which can be used e.g. to set a classification.
      Returns:
      the converter
    • builder

      public static PixelProcessor.Builder<Mat,Mat,Mat> builder(Processor<Mat,Mat,Mat> processor)
      Create a PixelProcessor.Builder for an OpenCV Mat. By default, this will attempt to convert any labeled or binary image output to unclassified detection objects - but the builder may be further customized to override this behavior before building the processor.
      Parameters:
      processor -
      Returns:
    • createMatImageSupplier

      public static ImageSupplier<Mat> createMatImageSupplier()
      Create an ImageSupplier that returns an OpenCV Mat.
      Returns:
    • createMatMaskSupplier

      public static MaskSupplier<Mat,Mat> createMatMaskSupplier()
      Create a MaskSupplier that returns an OpenCV Mat.
      Returns:
    • wrapInPointerScope

      public static <S, T, U> Processor<S,T,U> wrapInPointerScope(Processor<S,T,U> processor)
      Wrap a processor in a second processor that uses a PointerScope to ensure that pointers are released (except for any output).

      If the input is a processor that is already known to have this behavior, it is returned unchanged.

      Type Parameters:
      S - the image type
      T - the mask type
      U - the output type
      Parameters:
      processor -
      Returns: