Class ScaleImage<S>
Object
AnchorBean<Task<StackSequenceInput, S>>
Task<StackSequenceInput, S>
ScaleImage<S>
- Type Parameters:
S- shared-state for task.
- Direct Known Subclasses:
ScaleImageCommonSize,ScaleImageIndependently
public abstract class ScaleImage<S>
extends Task<StackSequenceInput, S>
Base class for tasks whose primary aim is to scale (resize) an image.
An RGB image is treated as a single-stack, otherwise each channel is scaled and outputted separately.
Second-level output keys for scaled and/or scaledFlattened additionally determine which stacks get outputted or not.
Any z-dimension present is unaffected by the scaling in scaled.
The following outputs are produced:
| Output Name | Default? | Description |
|---|---|---|
| "scaled" | yes | A scaled copy of the input image. |
| "scaledFlattened" | no | A scaled copy of the maximum-intensity-projection of the input image. |
inherited from Task |
- Author:
- Owen Feehan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted.protected ScaleCalculatorCalculates what scale-factor to apply on the image. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAllJobsAreExecuted(S sharedState, InputOutputContext context) OutputEnabledMutablevoiddoJobOnInput(InputBound<StackSequenceInput, S> input) InterpolatorThe interpolator to use for scaling images.ScaleCalculatorCalculates what scale-factor to apply on the image.booleanInputTypesExpectedbooleanisBinary()Iff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted.protected abstract StackscaleStack(Stack stack, Optional<ImageSizeSuggestion> suggestedSize, VoxelsResizer voxelsResizer, S sharedState) Produce a scaled version of aStack, mapping each channel to a scaled version of itself.voidsetBinary(boolean binary) Iff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted.voidsetInterpolator(Interpolator interpolator) The interpolator to use for scaling images.voidsetScaleCalculator(ScaleCalculator scaleCalculator) Calculates what scale-factor to apply on the image.Methods inherited from class org.anchoranalysis.experiment.bean.task.Task
beforeAnyJobIsExecuted, executeJob, isInputCompatibleWithMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Field Details
-
scaleCalculator
protected ScaleCalculator scaleCalculatorCalculates what scale-factor to apply on the image. -
binary
protected boolean binaryIff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted.
-
-
Constructor Details
-
ScaleImage
public ScaleImage()
-
-
Method Details
-
inputTypesExpected
public InputTypesExpected inputTypesExpected()- Specified by:
inputTypesExpectedin classTask<StackSequenceInput, S>
-
doJobOnInput
-
afterAllJobsAreExecuted
-
hasVeryQuickPerInputExecution
public boolean hasVeryQuickPerInputExecution()- Specified by:
hasVeryQuickPerInputExecutionin classTask<StackSequenceInput, S>
-
defaultOutputs
public OutputEnabledMutable defaultOutputs()- Overrides:
defaultOutputsin classTask<StackSequenceInput, S>
-
scaleStack
protected abstract Stack scaleStack(Stack stack, Optional<ImageSizeSuggestion> suggestedSize, VoxelsResizer voxelsResizer, S sharedState) throws OperationFailedException Produce a scaled version of aStack, mapping each channel to a scaled version of itself.- 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.
-
getScaleCalculator
public ScaleCalculator getScaleCalculator()Calculates what scale-factor to apply on the image. -
setScaleCalculator
public void setScaleCalculator(ScaleCalculator scaleCalculator) Calculates what scale-factor to apply on the image. -
isBinary
public boolean isBinary()Iff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted. -
setBinary
public void setBinary(boolean binary) Iff true the image to be scaled is treated as a binary-mask, and interpolation during scaling ensures only two binary-values are outputted. -
getInterpolator
public Interpolator getInterpolator()The interpolator to use for scaling images. -
setInterpolator
public void setInterpolator(Interpolator interpolator) The interpolator to use for scaling images.
-