Class SharedStateFilteredImageOutput<T>

Object
SharedStateFilteredImageOutput<T>
Type Parameters:
T - type of initialization for the ImageLabeller.

public class SharedStateFilteredImageOutput<T> extends Object
Manages filtered image output with shared state across multiple images.
  • Constructor Details

    • SharedStateFilteredImageOutput

      public SharedStateFilteredImageOutput(Outputter baseOutputter, ImageLabeller<T> filter, String outputNameMapping, String outputNameImages) throws CreateException
      Parameters:
      baseOutputter - the base Outputter for writing results
      filter - the ImageLabeller to use (must not be initialized yet)
      outputNameMapping - the output name for the CSV file mapping inputs to labels
      outputNameImages - the output name for the labels sub-directory
      Throws:
      CreateException - if there's an error during creation
  • Method Details

    • writeRow

      public void writeRow(String name, String groupIdentifier)
      Writes a row to the CSV file with image name and group identifier.
      Parameters:
      name - the name of the image
      groupIdentifier - the group identifier for the image
    • close

      public void close()
      Closes the CSV writer.
    • labelFor

      public String labelFor(ProvidesStackInput input, InputOutputContext context) throws OperationFailedException
      Determines a particular group-identifier for an input.
      Parameters:
      input - the ProvidesStackInput to label
      context - the InputOutputContext for the operation
      Returns:
      the label for the input
      Throws:
      OperationFailedException - if the labelling operation fails
    • getOutputterFor

      public Optional<Outputter> getOutputterFor(String groupIdentifier)
      Gets the outputter for a specific group identifier.
      Parameters:
      groupIdentifier - the group identifier
      Returns:
      an Optional containing the Outputter for the group, if it exists
    • getFilterInitialization

      public T getFilterInitialization(Path pathForBinding) throws InitializeException
      Gets the filter initialization, initializing it if necessary.
      Parameters:
      pathForBinding - the Path to use for initialization
      Returns:
      the initialization data
      Throws:
      InitializeException - if initialization fails