Class ScaleImageCommonSize
Creates a scaled copy of images, ensuring all images have identical output size.
When given input images of either varying or identical size, it will produce outputs of identical (scaled) size.
Whenever the scaled image is smaller than the output size, it is aligned (e.g. centered) and unused pixels are assigned the background color of 0.
- Author:
- Owen Feehan
-
Field Summary
Fields inherited from class org.anchoranalysis.plugin.image.task.bean.scale.ScaleImage
binary, scaleCalculator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeforeAnyJobIsExecuted
(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<StackSequenceInput> inputs, ParametersExperiment parameters) Called once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.getAlign()
How a smaller image (after scaling) is aligned to the larger image (with the common size).int
The background intensity to use in each channel when the scaled image does not cover the entire canvas.How to read theImageMetadata
from the file-system.Fallback forimageMetadataReader
to read image files without a direct metadata reader.protected Stack
scaleStack
(Stack stack, Optional<ImageSizeSuggestion> suggestedSize, VoxelsResizer voxelsResizer, CommonSize sharedState) Produce a scaled version of aStack
, mapping each channel to a scaled version of itself.void
How a smaller image (after scaling) is aligned to the larger image (with the common size).void
setBackgroundIntensity
(int backgroundIntensity) The background intensity to use in each channel when the scaled image does not cover the entire canvas.void
setImageMetadataReader
(ImageMetadataReader imageMetadataReader) How to read theImageMetadata
from the file-system.void
setStackReader
(StackReader stackReader) Fallback forimageMetadataReader
to read image files without a direct metadata reader.Methods inherited from class org.anchoranalysis.plugin.image.task.bean.scale.ScaleImage
afterAllJobsAreExecuted, defaultOutputs, doJobOnInput, getInterpolator, getScaleCalculator, hasVeryQuickPerInputExecution, inputTypesExpected, isBinary, setBinary, setInterpolator, setScaleCalculator
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
-
ScaleImageCommonSize
public ScaleImageCommonSize()
-
-
Method Details
-
beforeAnyJobIsExecuted
public CommonSize beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<StackSequenceInput> 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<StackSequenceInput,
CommonSize> - 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.
-
scaleStack
protected Stack scaleStack(Stack stack, Optional<ImageSizeSuggestion> suggestedSize, VoxelsResizer voxelsResizer, CommonSize sharedState) throws OperationFailedException Description copied from class:ScaleImage
Produce a scaled version of aStack
, mapping each channel to a scaled version of itself.- Specified by:
scaleStack
in classScaleImage<CommonSize>
- Parameters:
stack
- the stack before scaling.suggestedSize
- the suggested-size that has been passed into the task.voxelsResizer
- how to resize the voxels in a channel.sharedState
- the shared-state of the task.- Returns:
- the scaled version of the stack.
- Throws:
OperationFailedException
- if the scaling operation fails.
-
getImageMetadataReader
How to read theImageMetadata
from the file-system. -
setImageMetadataReader
How to read theImageMetadata
from the file-system. -
getStackReader
Fallback forimageMetadataReader
to read image files without a direct metadata reader. -
setStackReader
Fallback forimageMetadataReader
to read image files without a direct metadata reader. -
getAlign
How a smaller image (after scaling) is aligned to the larger image (with the common size).e.g. centered, left-aligned etc. in each dimension.
-
setAlign
How a smaller image (after scaling) is aligned to the larger image (with the common size).e.g. centered, left-aligned etc. in each dimension.
-
getBackgroundIntensity
public int getBackgroundIntensity()The background intensity to use in each channel when the scaled image does not cover the entire canvas.0 would create black, 255 would create white.
-
setBackgroundIntensity
public void setBackgroundIntensity(int backgroundIntensity) The background intensity to use in each channel when the scaled image does not cover the entire canvas.0 would create black, 255 would create white.
-