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).intThe background intensity to use in each channel when the scaled image does not cover the entire canvas.How to read theImageMetadatafrom the file-system.Fallback forimageMetadataReaderto read image files without a direct metadata reader.protected StackscaleStack(Stack stack, Optional<ImageSizeSuggestion> suggestedSize, VoxelsResizer voxelsResizer, CommonSize sharedState) Produce a scaled version of aStack, mapping each channel to a scaled version of itself.voidHow a smaller image (after scaling) is aligned to the larger image (with the common size).voidsetBackgroundIntensity(int backgroundIntensity) The background intensity to use in each channel when the scaled image does not cover the entire canvas.voidsetImageMetadataReader(ImageMetadataReader imageMetadataReader) How to read theImageMetadatafrom the file-system.voidsetStackReader(StackReader stackReader) Fallback forimageMetadataReaderto 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, setScaleCalculatorMethods inherited from class org.anchoranalysis.experiment.bean.task.Task
executeJob, isInputCompatibleWithMethods 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:TaskCalled once before all calls toTask.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>).- Specified by:
beforeAnyJobIsExecutedin 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:ScaleImageProduce a scaled version of aStack, mapping each channel to a scaled version of itself.- Specified by:
scaleStackin 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 theImageMetadatafrom the file-system. -
setImageMetadataReader
How to read theImageMetadatafrom the file-system. -
getStackReader
Fallback forimageMetadataReaderto read image files without a direct metadata reader. -
setStackReader
Fallback forimageMetadataReaderto 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.
-