Package qupath.lib.experimental.pixels
Interface OutputHandler<S,T,U>
- Type Parameters:
S
- the type of imageT
- the type of maskU
- the type of output
- All Known Implementing Classes:
OutputHandler.ObjectOutputHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface for handling the output of a
Processor
.
This may (for example) add measurements to the parent object, set the classification, or create child objects.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static interface
-
Method Summary
Modifier and TypeMethodDescriptiondefault OutputHandler
<S, T, U> andThen
(OutputHandler<S, T, U> after) Append a second output handler to this one.static <S,
T, U> OutputHandler <S, T, U> Create a basic do-nothing output handler that consumes the output with no changes.static <S,
T, U> OutputHandler <S, T, U> createMaskAndSplitObjectOutputHandler
(OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object, applying the ROI mask and splitting objects with discontinuous ROIs.static <S,
T, U> OutputHandler <S, T, U> createObjectOutputHandler
(OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object, applying the ROI mask.static <S,
T, U> OutputHandler <S, T, U> createUnmaskedObjectOutputHandler
(OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object.boolean
handleOutput
(Parameters<S, T> params, U output) Optional method to handle the output of aProcessor
.static boolean
handleOutputClassification
(Parameters<?, ?> params, String output) Handle the output of a pixel processor by setting a PathClass, given by its name.static boolean
handleOutputClassification
(Parameters<?, ?> params, PathClass output) Handle the output of a pixel processor by setting a PathClass.static boolean
handleOutputMeasurements
(Parameters<?, ?> params, Map<String, ? extends Number> output) Handle the output of a pixel processor by adding measurements to the path object.default OutputHandler
<S, T, U> orElse
(OutputHandler<S, T, U> after) Append a second output handler to this one, but only call it if this one returns false.
-
Method Details
-
handleOutput
Optional method to handle the output of aProcessor
. For example, this might assign classifications, add measurements, or add child objects.- Parameters:
params
- the processing parametersoutput
- the generated output
-
andThen
Append a second output handler to this one. Both are called, and return true if either returns true.- Parameters:
after
-- Returns:
-
orElse
Append a second output handler to this one, but only call it if this one returns false. The return value of the handler is then true if either returns true.- Parameters:
after
-- Returns:
-
createUnmaskedObjectOutputHandler
static <S,T, OutputHandler<S,U> T, createUnmaskedObjectOutputHandlerU> (OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object. This requires anOutputHandler.OutputToObjectConverter
to convert the output to a list of objects.This method does not apply any masking to the parent ROI, but assumed this has already been applied elsewhere. Consequently, it can result in objects being created that extend beyond the ROI. To avoid this, use
createMaskAndSplitObjectOutputHandler(OutputToObjectConverter)
or #createMaskedObjectOutputHandler(OutputToObjectConverter)}.- Type Parameters:
S
- the image typeT
- the mask typeU
- the output type- Parameters:
converter
-- Returns:
-
createObjectOutputHandler
static <S,T, OutputHandler<S,U> T, createObjectOutputHandlerU> (OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object, applying the ROI mask. This can result in objects with discontinuous ROIs. This requires anOutputHandler.OutputToObjectConverter
to convert the output to a list of objects.- Type Parameters:
S
- the image typeT
- the mask typeU
- the output type- Parameters:
converter
-- Returns:
- See Also:
-
createMaskAndSplitObjectOutputHandler
static <S,T, OutputHandler<S,U> T, createMaskAndSplitObjectOutputHandlerU> (OutputHandler.OutputToObjectConverter<S, T, U> converter) Create an output handler that can be used to add objects to the parent object, applying the ROI mask and splitting objects with discontinuous ROIs. This requires anOutputHandler.OutputToObjectConverter
to convert the output to a list of objects.- Type Parameters:
S
- the image typeT
- the mask typeU
- the output type- Parameters:
converter
-- Returns:
- See Also:
-
consumeOutput
Create a basic do-nothing output handler that consumes the output with no changes. This returns true regardless of input, without doing anything further.- Type Parameters:
S
-T
-U
-- Returns:
-
handleOutputMeasurements
static boolean handleOutputMeasurements(Parameters<?, ?> params, Map<String, ? extends Number> output) Handle the output of a pixel processor by adding measurements to the path object.- Parameters:
params
-output
-
-
handleOutputClassification
Handle the output of a pixel processor by setting a PathClass.- Parameters:
params
-output
-
-
handleOutputClassification
Handle the output of a pixel processor by setting a PathClass, given by its name.- Parameters:
params
-output
-
-