Class ConvertImageFormat
public class ConvertImageFormat extends RasterTask<org.anchoranalysis.experiment.task.NoSharedState,org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>>
Stacks containing multiple series (i.e. multiple images in a single file) are supported.
If it looks like an RGB image, channels are written as a single RGB image. Otherwise, each channel is written separately.
If only a single stack will be converted, its name is suppressed in the output.
The following outputs are produced:
| Output Name | Default? | Description |
|---|---|---|
| "converted" | yes | An image written in the default output format. |
outputs from Task |
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description ConvertImageFormat() -
Method Summary
Modifier and Type Method Description voidafterAllJobsAreExecuted(org.anchoranalysis.experiment.task.NoSharedState sharedState, org.anchoranalysis.io.output.outputter.InputOutputContext context)org.anchoranalysis.experiment.task.NoSharedStatebeforeAnyJobIsExecuted(org.anchoranalysis.io.output.outputter.Outputter outputter, org.anchoranalysis.inference.concurrency.ConcurrencyPlan concurrencyPlan, List<org.anchoranalysis.image.io.channel.input.NamedChannelsInput> inputs, org.anchoranalysis.experiment.task.ParametersExperiment parameters)protected org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>createSharedStateJob(org.anchoranalysis.io.output.outputter.InputOutputContext context)Sets a new output-sequence for the series.org.anchoranalysis.io.output.enabled.OutputEnabledMutabledefaultOutputs()voiddoStack(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState> input, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, int seriesIndex, int numberSeries, org.anchoranalysis.io.output.outputter.InputOutputContext context)Processes one stack from a series.voidendSeries(org.anchoranalysis.experiment.task.NoSharedState sharedStateTask, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, org.anchoranalysis.io.output.outputter.InputOutputContext context)Ends processing of a series.ChannelConvertStylegetChannelConversionStyle()To convert as RGB or independently or in another way.org.anchoranalysis.image.bean.channel.ConvertChannelTo<?>getChannelConverter()Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)booleanhasVeryQuickPerInputExecution()booleanisSuppressSeries()If true, the series index is not included in the outputted file-names.voidsetChannelConversionStyle(ChannelConvertStyle channelConversionStyle)To convert as RGB or independently or in another way.voidsetChannelConverter(org.anchoranalysis.image.bean.channel.ConvertChannelTo<?> channelConverter)Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)voidsetSuppressSeries(boolean suppressSeries)If true, the series index is not included in the outputted file-names.voidstartSeries(org.anchoranalysis.experiment.task.NoSharedState sharedStateTask, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, org.anchoranalysis.io.output.outputter.InputOutputContext context)Starts processing of a series.Methods inherited from class org.anchoranalysis.plugin.image.task.bean.RasterTask
doJobOnInput, inputTypesExpectedMethods inherited from class org.anchoranalysis.experiment.bean.task.Task
executeJob, isInputCompatibleWith
-
Constructor Details
-
ConvertImageFormat
public ConvertImageFormat()
-
-
Method Details
-
defaultOutputs
public org.anchoranalysis.io.output.enabled.OutputEnabledMutable defaultOutputs()- Overrides:
defaultOutputsin classorg.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState>
-
hasVeryQuickPerInputExecution
public boolean hasVeryQuickPerInputExecution()- Specified by:
hasVeryQuickPerInputExecutionin classorg.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState>
-
beforeAnyJobIsExecuted
public org.anchoranalysis.experiment.task.NoSharedState beforeAnyJobIsExecuted(org.anchoranalysis.io.output.outputter.Outputter outputter, org.anchoranalysis.inference.concurrency.ConcurrencyPlan concurrencyPlan, List<org.anchoranalysis.image.io.channel.input.NamedChannelsInput> inputs, org.anchoranalysis.experiment.task.ParametersExperiment parameters) throws org.anchoranalysis.experiment.ExperimentExecutionException- Specified by:
beforeAnyJobIsExecutedin classorg.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState>- Throws:
org.anchoranalysis.experiment.ExperimentExecutionException
-
createSharedStateJob
protected org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> createSharedStateJob(org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.JobExecutionExceptionSets a new output-sequence for the series.It's important to do this here rather than in
beforeAnyJobIsExecuted(Outputter, ConcurrencyPlan, List, ParametersExperiment)ascontextis now bound with the directory/prefix related to the input.- Specified by:
createSharedStateJobin classRasterTask<org.anchoranalysis.experiment.task.NoSharedState,org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>>- Parameters:
context- the input-output context associated with a particular job- Returns:
- a newly created shared-state
- Throws:
org.anchoranalysis.experiment.JobExecutionException- if an error occurs during job execution
-
startSeries
public void startSeries(org.anchoranalysis.experiment.task.NoSharedState sharedStateTask, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.JobExecutionExceptionDescription copied from class:RasterTaskStarts processing of a series.This corresponds to the start of an input job, before any stacks in the series are processed.
This should be called always once before all calls to
RasterTask.doStack(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.channel.input.NamedChannelsInput, S>, U, int, int, org.anchoranalysis.io.output.outputter.InputOutputContext).- Specified by:
startSeriesin classRasterTask<org.anchoranalysis.experiment.task.NoSharedState,org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>>- Parameters:
sharedStateTask- shared-state across all jobs in tasksharedStateJob- shared-state across all stacks in a job (i.e. in all series)context- input-output context- Throws:
org.anchoranalysis.experiment.JobExecutionException- if an error occurs during job execution
-
doStack
public void doStack(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState> input, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, int seriesIndex, int numberSeries, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.JobExecutionExceptionDescription copied from class:RasterTaskProcesses one stack from a series.This can be called many times in a job, once for each stack in the series.
It is assumed each job may have only one series.
- Specified by:
doStackin classRasterTask<org.anchoranalysis.experiment.task.NoSharedState,org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>>- Parameters:
input- the input-object corresponding to this stack (a set of named-channels)sharedStateJob- shared-state across all stacks in a job (i.e. in all series)seriesIndex- the index of the input that is being currently processed from the seriesnumberSeries- the total number of images in the series (constant for a given task)context- IO context- Throws:
org.anchoranalysis.experiment.JobExecutionException- if an error occurs during job execution
-
endSeries
public void endSeries(org.anchoranalysis.experiment.task.NoSharedState sharedStateTask, org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String> sharedStateJob, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.JobExecutionExceptionDescription copied from class:RasterTaskEnds processing of a series.This corresponds to the end of an input job, after any stacks in the series are processed.
This should be called always once after all calls to
RasterTask.doStack(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.channel.input.NamedChannelsInput, S>, U, int, int, org.anchoranalysis.io.output.outputter.InputOutputContext).- Specified by:
endSeriesin classRasterTask<org.anchoranalysis.experiment.task.NoSharedState,org.anchoranalysis.io.generator.sequence.OutputSequenceIndexed<org.anchoranalysis.image.core.stack.Stack,String>>- Parameters:
sharedStateTask- shared-state across all jobs in tasksharedStateJob- shared-state across all stacks in a job (i.e. in all series)context- input-output context- Throws:
org.anchoranalysis.experiment.JobExecutionException- if an error occurs during job execution
-
afterAllJobsAreExecuted
public void afterAllJobsAreExecuted(org.anchoranalysis.experiment.task.NoSharedState sharedState, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.ExperimentExecutionException- Specified by:
afterAllJobsAreExecutedin classorg.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.channel.input.NamedChannelsInput,org.anchoranalysis.experiment.task.NoSharedState>- Throws:
org.anchoranalysis.experiment.ExperimentExecutionException
-
getChannelConversionStyle
To convert as RGB or independently or in another way. -
setChannelConversionStyle
To convert as RGB or independently or in another way. -
isSuppressSeries
public boolean isSuppressSeries()If true, the series index is not included in the outputted file-names.It is always suppressed if only a single series exists.
-
setSuppressSeries
public void setSuppressSeries(boolean suppressSeries)If true, the series index is not included in the outputted file-names.It is always suppressed if only a single series exists.
-
getChannelConverter
public org.anchoranalysis.image.bean.channel.ConvertChannelTo<?> getChannelConverter()Optionally, how to convert from one bit-depth to another (scaling, clamping etc.) -
setChannelConverter
public void setChannelConverter(org.anchoranalysis.image.bean.channel.ConvertChannelTo<?> channelConverter)Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)
-