Class ConvertImageFormat
public class ConvertImageFormat
extends RasterTask<NoSharedState,OutputSequenceIndexed<Stack,String>>
Converts each input-image to an output format, optionally changing the bit depth.
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterAllJobsAreExecuted
(NoSharedState sharedState, InputOutputContext context) Called once after all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.beforeAnyJobIsExecuted
(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<NamedChannelsInput> inputs, ParametersExperiment parameters) Called once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.protected OutputSequenceIndexed
<Stack, String> createSharedStateJob
(InputOutputContext context) Sets a new output-sequence for the series.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.To convert as RGB or independently or in another way.Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)boolean
Is the execution-time of the task per-input expected to be very quick to execute?boolean
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.Methods inherited from class org.anchoranalysis.plugin.image.task.bean.RasterTask
doJobOnInput, inputTypesExpected
Methods inherited from class org.anchoranalysis.experiment.bean.task.Task
executeJob, isInputCompatibleWith
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
ConvertImageFormat
public ConvertImageFormat()
-
-
Method Details
-
defaultOutputs
Description copied from class:Task
If specified, default rules for determine which outputs are enabled or not.- Overrides:
defaultOutputs
in classTask<NamedChannelsInput,
NoSharedState> - Returns:
- the default rules if they exist.
-
hasVeryQuickPerInputExecution
public boolean hasVeryQuickPerInputExecution()Description copied from class:Task
Is the execution-time of the task per-input expected to be very quick to execute?- Specified by:
hasVeryQuickPerInputExecution
in classTask<NamedChannelsInput,
NoSharedState> - Returns:
- true iff the execution is expected to be very quick, false otherwise.
-
beforeAnyJobIsExecuted
public NoSharedState beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<NamedChannelsInput> inputs, ParametersExperiment parameters) throws ExperimentExecutionException Description copied from class:Task
Called once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.- Specified by:
beforeAnyJobIsExecuted
in classTask<NamedChannelsInput,
NoSharedState> - Parameters:
outputter
- the output-manager for the experiment (not for an individual job)concurrencyPlan
- available numbers of processors that can callTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
inputs
- a list of inputs, each will result in at least one call toTask.executeJob(ParametersUnbound)
.parameters
- the experiment-parameters.- Returns:
- the shared-state that is passed to each call to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
and toTask.afterAllJobsAreExecuted(S, org.anchoranalysis.io.output.outputter.InputOutputContext)
. - Throws:
ExperimentExecutionException
- if a fatal error occurs executing this step of the experiment.
-
doStack
public void doStack(InputBound<NamedChannelsInput, NoSharedState> input, OutputSequenceIndexed<Stack, throws JobExecutionExceptionString> sharedStateJob, int seriesIndex, int numberSeries, InputOutputContext context) Description copied from class:RasterTask
Processes 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:
doStack
in classRasterTask<NoSharedState,
OutputSequenceIndexed<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:
JobExecutionException
- if an error occurs during job execution
-
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
Optionally, how to convert from one bit-depth to another (scaling, clamping etc.) -
setChannelConverter
Optionally, how to convert from one bit-depth to another (scaling, clamping etc.)
-