Package qupath.lib.experimental.pixels
Class OpenCVProcessor
java.lang.Object
qupath.lib.experimental.pixels.OpenCVProcessor
Class to generate a
PixelProcessor
when using OpenCV for the primary image representation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PixelProcessor.Builder
<Mat, Mat, Mat> Create aPixelProcessor.Builder
for an OpenCVMat
.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into annotation objects.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> createAnnotationConverter
(Map<? extends Number, String> classificationMap) Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into annotation objects.static <S,
T> OutputHandler <S, T, Mat> Create anOutputHandler
that attempts to convert the output into annotation objects.static <S,
T> OutputHandler <S, T, Mat> createAnnotationOutputHandler
(Map<? extends Number, String> classificationMap) Create anOutputHandler
that attempts to convert the output into annotation objects.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into detection objects.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> createDetectionConverter
(Map<? extends Number, String> classificationMap) Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into detection objects.static <S,
T> OutputHandler <S, T, Mat> Create anOutputHandler
that attempts to convert the output into detection objects.static <S,
T> OutputHandler <S, T, Mat> createDetectionOutputHandler
(Map<? extends Number, String> classificationMap) Create anOutputHandler
that attempts to convert the output into detection objects.static ImageSupplier
<Mat> Create anImageSupplier
that returns an OpenCVMat
.static MaskSupplier
<Mat, Mat> Create aMaskSupplier
that returns an OpenCVMat
.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> createObjectConverter
(BiFunction<ROI, Number, PathObject> creator) Create anOutputHandler.OutputToObjectConverter
to convert Mat binary or labeled images to path objects, optionally using the label number.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> createObjectConverter
(Function<ROI, PathObject> creator) Create anOutputHandler.OutputToObjectConverter
to convert Mat binary or labeled images to path objects.static <S,
T> OutputHandler.OutputToObjectConverter <S, T, Mat> createObjectConverter
(Function<ROI, PathObject> creator, Map<? extends Number, String> classificationMap) Create anOutputHandler.OutputToObjectConverter
to convert Mat labeled images to path objects, optionally setting the classification.static <S,
T, U> Processor <S, T, U> wrapInPointerScope
(Processor<S, T, U> processor) Wrap a processor in a second processor that uses aPointerScope
to ensure that pointers are released (except for any output).
-
Constructor Details
-
OpenCVProcessor
public OpenCVProcessor()
-
-
Method Details
-
createDetectionOutputHandler
Create anOutputHandler
that attempts to convert the output into detection objects.- Returns:
-
createDetectionOutputHandler
public static <S,T> OutputHandler<S,T, createDetectionOutputHandlerMat> (Map<? extends Number, String> classificationMap) Create anOutputHandler
that attempts to convert the output into detection objects.- Parameters:
classificationMap
- a map used to convert labels into classifications- Returns:
-
createAnnotationOutputHandler
Create anOutputHandler
that attempts to convert the output into annotation objects.- Returns:
-
createAnnotationOutputHandler
public static <S,T> OutputHandler<S,T, createAnnotationOutputHandlerMat> (Map<? extends Number, String> classificationMap) Create anOutputHandler
that attempts to convert the output into annotation objects.- Parameters:
classificationMap
- a map used to convert labels into classifications- Returns:
-
createAnnotationConverter
Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into annotation objects.- Returns:
-
createAnnotationConverter
public static <S,T> OutputHandler.OutputToObjectConverter<S,T, createAnnotationConverterMat> (Map<? extends Number, String> classificationMap) Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into annotation objects.- Parameters:
classificationMap
- a map used to convert labels into classifications- Returns:
-
createDetectionConverter
Create anOutputHandler.OutputToObjectConverter
that attempts to convert the output into detection objects.- Returns:
-
createDetectionConverter
public static <S,T> OutputHandler.OutputToObjectConverter<S,T, createDetectionConverterMat> (Map<? extends Number, String> classificationMap) Create anOutputHandler.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, createObjectConverterMat> (Function<ROI, PathObject> creator) Create anOutputHandler.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, createObjectConverterMat> (Function<ROI, PathObject> creator, Map<? extends Number, String> classificationMap) Create anOutputHandler.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, createObjectConverterMat> (BiFunction<ROI, Number, PathObject> creator) Create anOutputHandler.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
Create aPixelProcessor.Builder
for an OpenCVMat
. 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
Create anImageSupplier
that returns an OpenCVMat
.- Returns:
-
createMatMaskSupplier
Create aMaskSupplier
that returns an OpenCVMat
.- Returns:
-
wrapInPointerScope
Wrap a processor in a second processor that uses aPointerScope
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 typeT
- the mask typeU
- the output type- Parameters:
processor
-- Returns:
-