public class ConvertImageFormat extends RasterTask<NoSharedState,OutputSequenceIndexed<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 |
---|---|---|
yes | An image written in the default output format. | |
outputs from Task |
Constructor and Description |
---|
ConvertImageFormat() |
Modifier and Type | Method and Description |
---|---|
void |
afterAllJobsAreExecuted(NoSharedState sharedState,
InputOutputContext context)
Called once after all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
NoSharedState |
beforeAnyJobIsExecuted(Outputter outputter,
ConcurrencyPlan concurrencyPlan,
List<NamedChannelsInput> inputs,
ParametersExperiment parameters)
Called once before all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
protected OutputSequenceIndexed<Stack,String> |
createSharedStateJob(InputOutputContext context)
Sets a new output-sequence for the series.
|
OutputEnabledMutable |
defaultOutputs()
If specified, default rules for determine which outputs are enabled or not.
|
void |
doStack(InputBound<NamedChannelsInput,NoSharedState> input,
OutputSequenceIndexed<Stack,String> sharedStateJob,
int seriesIndex,
int numberSeries,
InputOutputContext context)
Processes one stack from a series.
|
void |
endSeries(NoSharedState sharedStateTask,
OutputSequenceIndexed<Stack,String> sharedStateJob,
InputOutputContext context)
Ends processing of a series.
|
ChannelConvertStyle |
getChannelConversionStyle()
To convert as RGB or independently or in another way.
|
ConvertChannelTo<?> |
getChannelConverter()
Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)
|
boolean |
hasVeryQuickPerInputExecution()
Is the execution-time of the task per-input expected to be very quick to execute?
|
boolean |
isSuppressSeries()
If true, the series index is not included in the outputted file-names.
|
void |
setChannelConversionStyle(ChannelConvertStyle channelConversionStyle)
To convert as RGB or independently or in another way.
|
void |
setChannelConverter(ConvertChannelTo<?> channelConverter)
Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)
|
void |
setSuppressSeries(boolean suppressSeries)
If true, the series index is not included in the outputted file-names.
|
void |
startSeries(NoSharedState sharedStateTask,
OutputSequenceIndexed<Stack,String> sharedStateJob,
InputOutputContext context)
Starts processing of a series.
|
doJobOnInput, inputTypesExpected
executeJob, isInputCompatibleWith
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public OutputEnabledMutable defaultOutputs()
Task
defaultOutputs
in class Task<NamedChannelsInput,NoSharedState>
public boolean hasVeryQuickPerInputExecution()
Task
hasVeryQuickPerInputExecution
in class Task<NamedChannelsInput,NoSharedState>
public NoSharedState beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<NamedChannelsInput> inputs, ParametersExperiment parameters) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.beforeAnyJobIsExecuted
in class Task<NamedChannelsInput,NoSharedState>
outputter
- the output-manager for the experiment (not for an individual job)concurrencyPlan
- available numbers of processors that can call Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
inputs
- a list of inputs, each will result in at least one call to Task.executeJob(ParametersUnbound)
.parameters
- the experiment-parameters.Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
and to Task.afterAllJobsAreExecuted(S, org.anchoranalysis.io.output.outputter.InputOutputContext)
.ExperimentExecutionException
- if a fatal error occurs executing this step of the
experiment.protected OutputSequenceIndexed<Stack,String> createSharedStateJob(InputOutputContext context) throws JobExecutionException
It's important to do this here rather than in beforeAnyJobIsExecuted(Outputter,
ConcurrencyPlan, List, ParametersExperiment)
as context
is now bound with the
directory/prefix related to the input.
createSharedStateJob
in class RasterTask<NoSharedState,OutputSequenceIndexed<Stack,String>>
context
- the input-output cotnext associated with a particular jobJobExecutionException
public void startSeries(NoSharedState sharedStateTask, OutputSequenceIndexed<Stack,String> sharedStateJob, InputOutputContext context) throws JobExecutionException
RasterTask
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)
.
startSeries
in class RasterTask<NoSharedState,OutputSequenceIndexed<Stack,String>>
sharedStateTask
- shared-state across all jobs in tasksharedStateJob
- shared-state across all stacks in a job (i.e. in all series.)context
- input-output contextJobExecutionException
public void doStack(InputBound<NamedChannelsInput,NoSharedState> input, OutputSequenceIndexed<Stack,String> sharedStateJob, int seriesIndex, int numberSeries, InputOutputContext context) throws JobExecutionException
RasterTask
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.
doStack
in class RasterTask<NoSharedState,OutputSequenceIndexed<Stack,String>>
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 series.numberSeries
- the total number of images in the series (constant for a given task)context
- IO contextJobExecutionException
public void endSeries(NoSharedState sharedStateTask, OutputSequenceIndexed<Stack,String> sharedStateJob, InputOutputContext context) throws JobExecutionException
RasterTask
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)
.
endSeries
in class RasterTask<NoSharedState,OutputSequenceIndexed<Stack,String>>
sharedStateTask
- shared-state across all jobs in tasksharedStateJob
- shared-state across all stacks in a job (i.e. in all series.)context
- input-output contextJobExecutionException
public void afterAllJobsAreExecuted(NoSharedState sharedState, InputOutputContext context) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.afterAllJobsAreExecuted
in class Task<NamedChannelsInput,NoSharedState>
sharedState
- the shared-statecontext
- IO-context for experiment (not for an individual job)ExperimentExecutionException
- if a fatal error occurs executing this step of the
experiment.public ChannelConvertStyle getChannelConversionStyle()
public void setChannelConversionStyle(ChannelConvertStyle channelConversionStyle)
public boolean isSuppressSeries()
It is always suppressed if only a single series exists.
public void setSuppressSeries(boolean suppressSeries)
It is always suppressed if only a single series exists.
public ConvertChannelTo<?> getChannelConverter()
public void setChannelConverter(ConvertChannelTo<?> channelConverter)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.