Class SharedStateFilteredImageOutput<T>
Object
org.anchoranalysis.plugin.image.task.labeller.SharedStateFilteredImageOutput<T>
- Type Parameters:
T- type of initialization for theImageLabeller.
public class SharedStateFilteredImageOutput<T> extends Object
Manages filtered image output with shared state across multiple images.
-
Constructor Summary
Constructors Constructor Description SharedStateFilteredImageOutput(org.anchoranalysis.io.output.outputter.Outputter baseOutputter, ImageLabeller<T> filter, String outputNameMapping, String outputNameImages)Creates a newSharedStateFilteredImageOutput. -
Method Summary
Modifier and Type Method Description voidclose()Closes the CSV writer.TgetFilterInitialization(Path pathForBinding)Gets the filter initialization, initializing it if necessary.Optional<org.anchoranalysis.io.output.outputter.Outputter>getOutputterFor(String groupIdentifier)Gets the outputter for a specific group identifier.StringlabelFor(org.anchoranalysis.image.io.stack.input.ProvidesStackInput input, org.anchoranalysis.io.output.outputter.InputOutputContext context)Determines a particular group-identifier for an input.voidwriteRow(String name, String groupIdentifier)Writes a row to the CSV file with image name and group identifier.
-
Constructor Details
-
SharedStateFilteredImageOutput
public SharedStateFilteredImageOutput(org.anchoranalysis.io.output.outputter.Outputter baseOutputter, ImageLabeller<T> filter, String outputNameMapping, String outputNameImages) throws org.anchoranalysis.core.exception.CreateExceptionCreates a newSharedStateFilteredImageOutput.- Parameters:
baseOutputter- the baseOutputterfor writing resultsfilter- theImageLabellerto use (must not be initialized yet)outputNameMapping- the output name for the CSV file mapping inputs to labelsoutputNameImages- the output name for the labels sub-directory- Throws:
org.anchoranalysis.core.exception.CreateException- if there's an error during creation
-
-
Method Details
-
writeRow
Writes a row to the CSV file with image name and group identifier.- Parameters:
name- the name of the imagegroupIdentifier- the group identifier for the image
-
close
public void close()Closes the CSV writer. -
labelFor
public String labelFor(org.anchoranalysis.image.io.stack.input.ProvidesStackInput input, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.core.exception.OperationFailedExceptionDetermines a particular group-identifier for an input.- Parameters:
input- theProvidesStackInputto labelcontext- theInputOutputContextfor the operation- Returns:
- the label for the input
- Throws:
org.anchoranalysis.core.exception.OperationFailedException- if the labelling operation fails
-
getOutputterFor
public Optional<org.anchoranalysis.io.output.outputter.Outputter> getOutputterFor(String groupIdentifier)Gets the outputter for a specific group identifier.- Parameters:
groupIdentifier- the group identifier- Returns:
- an
Optionalcontaining theOutputterfor the group, if it exists
-
getFilterInitialization
public T getFilterInitialization(Path pathForBinding) throws org.anchoranalysis.core.exception.InitializeExceptionGets the filter initialization, initializing it if necessary.- Parameters:
pathForBinding- thePathto use for initialization- Returns:
- the initialization data
- Throws:
org.anchoranalysis.core.exception.InitializeException- if initialization fails
-