Class OutputManager
An output prefix (with directory and/or file-path components) is calculated for each input.
Rules can be specified in outputsEnabled
as to which outputs occur or do not occur
(from the available outputs in an experiment) when an experiment is run.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateContextForWriting
(Optional<ImageFileFormat> suggestedFormatToWrite, ExecutionTimeRecorder executionTimeRecorder) Creates theOutputWriteContext
needed for writing files.createExperimentOutputter
(Optional<String> experimentIdentifier, MultiLevelOutputEnabled outputsEnabled, Optional<MultiLevelRecordedOutputs> recordedOutputs, OutputWriteContext writeContext, PathPrefixerContext prefixerContext, Optional<Consumer<Path>> callUponDirectoryCreation, Optional<Logger> logger) Creates an outputter for the experiment in general.determineEnabledOutputs
(RecordedOutputsWithRules recordedOutputs) Determines which outputs are enabled or not.Which outputs are enabled or not enabled.General settings (default file extensions, colors etc.) for outputting files.Determines a prefix to use when outputting a file based upon an input-path.boolean
Whether to silently first delete any existing output at the intended path, or rather throw an error.void
setOutputsEnabled
(OutputEnabledRules outputsEnabled) Which outputs are enabled or not enabled.void
setOutputWriteSettings
(OutputWriteSettings outputWriteSettings) General settings (default file extensions, colors etc.) for outputting files.void
setPrefixer
(PathPrefixer prefixer) Determines a prefix to use when outputting a file based upon an input-path.void
setSilentlyDeleteExisting
(boolean silentlyDeleteExisting) Whether to silently first delete any existing output at the intended path, or rather throw an error.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
OutputManager
public OutputManager()
-
-
Method Details
-
determineEnabledOutputs
Determines which outputs are enabled or not.- Parameters:
recordedOutputs
- where output-names are recorded as used/tested.- Returns:
- a
MultiLevelOutputEnabled
which indicates which outputs are enabled or not.
-
createContextForWriting
public OutputWriteContext createContextForWriting(Optional<ImageFileFormat> suggestedFormatToWrite, ExecutionTimeRecorder executionTimeRecorder) Creates theOutputWriteContext
needed for writing files.- Parameters:
suggestedFormatToWrite
- a suggestion on what file-format to write.executionTimeRecorder
- for recording the execution-times of operations.- Returns:
- newly created context.
-
createExperimentOutputter
public OutputterChecked createExperimentOutputter(Optional<String> experimentIdentifier, MultiLevelOutputEnabled outputsEnabled, Optional<MultiLevelRecordedOutputs> recordedOutputs, OutputWriteContext writeContext, PathPrefixerContext prefixerContext, Optional<Consumer<Path>> callUponDirectoryCreation, Optional<Logger> logger) throws BindFailedException Creates an outputter for the experiment in general.i.e. this is not an outputter for a specific job.
- Parameters:
experimentIdentifier
- if defined, an identifier for the experiment, to be included in the directory root.outputsEnabled
- which outputs are enabled. This is typically provided via a call todetermineEnabledOutputs(RecordedOutputsWithRules)
.recordedOutputs
- if defined, remembers which outputs are written or not.writeContext
- context needed for writing. This is typically provided via a call tocreateContextForWriting(Optional, ExecutionTimeRecorder)
.prefixerContext
- parameters for the file-path prefixer.callUponDirectoryCreation
- when defined, thisconsumer
is called (with the directory path) when the directory is first created, as it is created lazily only when first needed.logger
- logger for warning for information messages when outputting.- Returns:
- a newly created outputter.
- Throws:
BindFailedException
- when an outputter cannot be successfully bound to an output directory.
-
getPrefixer
Determines a prefix to use when outputting a file based upon an input-path.This method is called with a binding path from the input to determine a output prefix for each input to an experiment.
-
setPrefixer
Determines a prefix to use when outputting a file based upon an input-path.This method is called with a binding path from the input to determine a output prefix for each input to an experiment.
-
isSilentlyDeleteExisting
public boolean isSilentlyDeleteExisting()Whether to silently first delete any existing output at the intended path, or rather throw an error.If true, if an existing output folder (at intended path) is deleted If false, an error is thrown if the folder already exists
-
setSilentlyDeleteExisting
public void setSilentlyDeleteExisting(boolean silentlyDeleteExisting) Whether to silently first delete any existing output at the intended path, or rather throw an error.If true, if an existing output folder (at intended path) is deleted If false, an error is thrown if the folder already exists
-
getOutputWriteSettings
General settings (default file extensions, colors etc.) for outputting files. -
setOutputWriteSettings
General settings (default file extensions, colors etc.) for outputting files. -
getOutputsEnabled
Which outputs are enabled or not enabled. If null, default rules are used instead. -
setOutputsEnabled
Which outputs are enabled or not enabled. If null, default rules are used instead.
-