Interface OutputHandler<S,T,U>

Type Parameters:
S - the type of image
T - the type of mask
U - 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.

@FunctionalInterface public interface OutputHandler<S,T,U>
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.

  • Method Details

    • handleOutput

      boolean handleOutput(Parameters<S,T> params, U output)
      Optional method to handle the output of a Processor. For example, this might assign classifications, add measurements, or add child objects.
      Parameters:
      params - the processing parameters
      output - the generated output
    • andThen

      default OutputHandler<S,T,U> andThen(OutputHandler<S,T,U> after)
      Append a second output handler to this one. Both are called, and return true if either returns true.
      Parameters:
      after -
      Returns:
    • orElse

      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. The return value of the handler is then true if either returns true.
      Parameters:
      after -
      Returns:
    • createUnmaskedObjectOutputHandler

      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. This requires an OutputHandler.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 type
      T - the mask type
      U - the output type
      Parameters:
      converter -
      Returns:
    • createObjectOutputHandler

      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. This can result in objects with discontinuous ROIs. This requires an OutputHandler.OutputToObjectConverter to convert the output to a list of objects.
      Type Parameters:
      S - the image type
      T - the mask type
      U - the output type
      Parameters:
      converter -
      Returns:
      See Also:
    • createMaskAndSplitObjectOutputHandler

      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. This requires an OutputHandler.OutputToObjectConverter to convert the output to a list of objects.
      Type Parameters:
      S - the image type
      T - the mask type
      U - the output type
      Parameters:
      converter -
      Returns:
      See Also:
    • consumeOutput

      static <S, T, U> OutputHandler<S,T,U> 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

      static boolean handleOutputClassification(Parameters<?,?> params, PathClass output)
      Handle the output of a pixel processor by setting a PathClass.
      Parameters:
      params -
      output -
    • handleOutputClassification

      static boolean handleOutputClassification(Parameters<?,?> params, String output)
      Handle the output of a pixel processor by setting a PathClass, given by its name.
      Parameters:
      params -
      output -