public class Montage extends Task<StackSequenceInput,MontageSharedState>
The images are tiled into a grid formation, to have a approximately similar number of rows and columns.
The size of the montage is determined by two factors, varyImageSize
and an optional
suggestion on size.
When varyImageSize==false
, by default each image will be scaled to approximately
600x480, preserving aspect ratio, as per fixedSizeScaler
. However, a size suggestion in
the form of a uniform scaling constant, will override this, and be applied instead to each image.
Other size suggestions are disallowed.
When varyImageSize==true
, by default the combined image will have the larger of varyingSizeWidth
and varyingSizeWidthRatio
(as calculated against the average row-size).
However, suggestions offering a fixed-width (but no height should be specified), or a constant
scaling-factor will override this. Other size suggestions are disallowed.
Any 3D images are flattened into a 2D image using a maximum-intensity projection.
The montage occurs in a two step process:
imageMetadataReader
which is often much quicker than opening an image with the stackReader
but this is not always the case.
If a particular image is errored during the first step, it is omitted from the montage entirely, and an error will register with its respective job in the second step.
If a particular image succeeds in the first step, but fails in the second step, an error will register with the respective job, and its place on the montage will be entirely black - apart from a label of background red color, if labelling is enabled.
The following outputs are produced:
Output Name | Default? | Description |
---|---|---|
yes | The montage of all the input images - without a label indicating the identifier of each image. | |
yes | The montage of all the input images - with a label indicating the identifier of each image. | |
inherited from Task |
Constructor and Description |
---|
Montage() |
Modifier and Type | Method and Description |
---|---|
void |
afterAllJobsAreExecuted(MontageSharedState sharedState,
InputOutputContext context)
Called once after all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
MontageSharedState |
beforeAnyJobIsExecuted(Outputter outputter,
ConcurrencyPlan concurrencyPlan,
List<StackSequenceInput> inputs,
ParametersExperiment parameters)
Called once before all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
OutputEnabledMutable |
defaultOutputs()
If specified, default rules for determine which outputs are enabled or not.
|
void |
doJobOnInput(InputBound<StackSequenceInput,MontageSharedState> input)
Performs the task on a particular input.
|
BoxAligner |
getAligner()
When
varyImageSize==false and varyImageLocation==false , how to align a
smaller image inside a larger cell. |
BoxAligner |
getAlignerLabel()
When
label==false and varyImageLocation==false , how to align the label with
its associated image. |
StackDisplayer |
getDisplayer()
How to convert an image to be displayed to the user.
|
ScaleCalculator |
getFixedSizeScaler()
How to calculate the size of each image, when
varyImageSize==false . |
ImageMetadataReader |
getImageMetadataReader()
How to read the
ImageMetadata from the file-system. |
Interpolator |
getInterpolator()
How to resize images.
|
double |
getRatioHeightForLabel()
When
label==true , this determines the height of the label. |
double |
getRatioRowsToColumns()
An ideal approximate ratio of the number of rows to the number of columns.
|
StackReader |
getStackReader()
Fallback for
imageMetadataReader to read image files without a directy metadata
reader. |
int |
getVaryingSizeWidth()
If no specific width or scaling-factor is suggested, this determines the default width that
the combined-montage should have, when
varyImageSize==true . |
double |
getVaryingSizeWidthRatio()
If no specific width or scaling-factor is suggested, this determines the default percentage
of the existing size, the combined-montage should have, when
varyImageSize==true . |
boolean |
hasVeryQuickPerInputExecution()
Is the execution-time of the task per-input expected to be very quick to execute?
|
InputTypesExpected |
inputTypesExpected()
Highest class(es) that will function as a valid input.
|
boolean |
isVaryImageLocation()
When true, the location of an image in the grid, as well as the number of images in each row
are both allowed to vary to fill space.
|
boolean |
isVaryImageSize()
When true, the images may vary in width/height in their respective rows to fill space, while
preserving the aspect-ratio of each image.
|
void |
setAligner(BoxAligner aligner)
When
varyImageSize==false and varyImageLocation==false , how to align a
smaller image inside a larger cell. |
void |
setAlignerLabel(BoxAligner alignerLabel)
When
label==false and varyImageLocation==false , how to align the label with
its associated image. |
void |
setDisplayer(StackDisplayer displayer)
How to convert an image to be displayed to the user.
|
void |
setFixedSizeScaler(ScaleCalculator fixedSizeScaler)
How to calculate the size of each image, when
varyImageSize==false . |
void |
setImageMetadataReader(ImageMetadataReader imageMetadataReader)
How to read the
ImageMetadata from the file-system. |
void |
setInterpolator(Interpolator interpolator)
How to resize images.
|
void |
setRatioHeightForLabel(double ratioHeightForLabel)
When
label==true , this determines the height of the label. |
void |
setRatioRowsToColumns(double ratioRowsToColumns)
An ideal approximate ratio of the number of rows to the number of columns.
|
void |
setStackReader(StackReader stackReader)
Fallback for
imageMetadataReader to read image files without a directy metadata
reader. |
void |
setVaryImageLocation(boolean varyImageLocation)
When true, the location of an image in the grid, as well as the number of images in each row
are both allowed to vary to fill space.
|
void |
setVaryImageSize(boolean varyImageSize)
When true, the images may vary in width/height in their respective rows to fill space, while
preserving the aspect-ratio of each image.
|
void |
setVaryingSizeWidth(int varyingSizeWidth)
If no specific width or scaling-factor is suggested, this determines the default width that
the combined-montage should have, when
varyImageSize==true . |
void |
setVaryingSizeWidthRatio(double varyingSizeWidthRatio)
If no specific width or scaling-factor is suggested, this determines the default percentage
of the existing size, the combined-montage should have, when
varyImageSize==true . |
executeJob, isInputCompatibleWith
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public MontageSharedState beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<StackSequenceInput> inputs, ParametersExperiment parameters) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.beforeAnyJobIsExecuted
in class Task<StackSequenceInput,MontageSharedState>
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.public void doJobOnInput(InputBound<StackSequenceInput,MontageSharedState> input) throws JobExecutionException
Task
doJobOnInput
in class Task<StackSequenceInput,MontageSharedState>
input
- the input for the job.JobExecutionException
- if an error occurs executing a particular job, that is not
otherwise suppressed.public void afterAllJobsAreExecuted(MontageSharedState sharedState, InputOutputContext context) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.afterAllJobsAreExecuted
in class Task<StackSequenceInput,MontageSharedState>
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 InputTypesExpected inputTypesExpected()
Task
This is usually the class of T (or sometimes the absolute base class InputFromManager).
inputTypesExpected
in class Task<StackSequenceInput,MontageSharedState>
public boolean hasVeryQuickPerInputExecution()
Task
hasVeryQuickPerInputExecution
in class Task<StackSequenceInput,MontageSharedState>
public OutputEnabledMutable defaultOutputs()
Task
defaultOutputs
in class Task<StackSequenceInput,MontageSharedState>
public ImageMetadataReader getImageMetadataReader()
ImageMetadata
from the file-system.public void setImageMetadataReader(ImageMetadataReader imageMetadataReader)
ImageMetadata
from the file-system.public StackReader getStackReader()
imageMetadataReader
to read image files without a directy metadata
reader.public void setStackReader(StackReader stackReader)
imageMetadataReader
to read image files without a directy metadata
reader.public Interpolator getInterpolator()
public void setInterpolator(Interpolator interpolator)
public boolean isVaryImageSize()
public void setVaryImageSize(boolean varyImageSize)
public boolean isVaryImageLocation()
When true, varyImageSize
will always be considered also as true
.
public void setVaryImageLocation(boolean varyImageLocation)
When true, varyImageSize
will always be considered also as true
.
public BoxAligner getAligner()
varyImageSize==false
and varyImageLocation==false
, how to align a
smaller image inside a larger cell. Otherwise ignored.
By default, the smaller image grows as much as possible, while preserving the aspect-ratio, but while strictly keeping a tabular form.
public void setAligner(BoxAligner aligner)
varyImageSize==false
and varyImageLocation==false
, how to align a
smaller image inside a larger cell. Otherwise ignored.
By default, the smaller image grows as much as possible, while preserving the aspect-ratio, but while strictly keeping a tabular form.
public double getRatioHeightForLabel()
label==true
, this determines the height of the label.
Otherwise, it is ignored.
It indicates what portion of the average-image-height (when projected into the image) should the label approximately occupy.
It defaults to 0.05
i.e. the label should typically occupy 5% of the average
image-height.
It can be adjusted to make the label larger or smaller, relative to the image that is being labelled.
Note that a lower minimum exists of label font-size, below which it will not become smaller.
public void setRatioHeightForLabel(double ratioHeightForLabel)
label==true
, this determines the height of the label.
Otherwise, it is ignored.
It indicates what portion of the average-image-height (when projected into the image) should the label approximately occupy.
It defaults to 0.05
i.e. the label should typically occupy 5% of the average
image-height.
It can be adjusted to make the label larger or smaller, relative to the image that is being labelled.
Note that a lower minimum exists of label font-size, below which it will not become smaller.
public BoxAligner getAlignerLabel()
label==false
and varyImageLocation==false
, how to align the label with
its associated image.
By default, it is horizontally-centered at the bottom of the image.
public void setAlignerLabel(BoxAligner alignerLabel)
label==false
and varyImageLocation==false
, how to align the label with
its associated image.
By default, it is horizontally-centered at the bottom of the image.
public ScaleCalculator getFixedSizeScaler()
varyImageSize==false
.
Otherwise, it is irrelevant.
public void setFixedSizeScaler(ScaleCalculator fixedSizeScaler)
varyImageSize==false
.
Otherwise, it is irrelevant.
public int getVaryingSizeWidth()
varyImageSize==true
.
The eventual width will be the maximum of this and the width calculated from varyingSizeWidthRatio
.
public void setVaryingSizeWidth(int varyingSizeWidth)
varyImageSize==true
.
The eventual width will be the maximum of this and the width calculated from varyingSizeWidthRatio
.
public double getVaryingSizeWidthRatio()
varyImageSize==true
.
The eventual width will be the maximum of this and varyingSizeWidth
.
public void setVaryingSizeWidthRatio(double varyingSizeWidthRatio)
varyImageSize==true
.
The eventual width will be the maximum of this and varyingSizeWidth
.
public double getRatioRowsToColumns()
When == 1.0
, then the algorithm tries to have approximately the same number of
rows as columns.
When > 1.0
, then the algorithm tries to have more rows than columns, to
match the ratio number_rows / number_columns
.
When < 1.0
, then the algorithm tries to have more columns than rows, to
match the ratio number_rows / number_columns
.
public void setRatioRowsToColumns(double ratioRowsToColumns)
When == 1.0
, then the algorithm tries to have approximately the same number of
rows as columns.
When > 1.0
, then the algorithm tries to have more rows than columns, to
match the ratio number_rows / number_columns
.
When < 1.0
, then the algorithm tries to have more columns than rows, to
match the ratio number_rows / number_columns
.
public StackDisplayer getDisplayer()
public void setDisplayer(StackDisplayer displayer)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.