Class MontageSharedState
Object
MontageSharedState
A
Stack into which individual images are written, together with the necessary information
on where to write each image.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionMontageSharedState(Map<Path, BoundingBoxEnclosed> boxes, Extent sizeCombined, VoxelsResizer resizer, ExecutionTimeRecorder executionTimeRecorder) Create with a mapping fromPaths to boxes. -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyStackInto(CheckedSupplier<RGBStack, InputReadFailedException> source, String identifier, Path path, Optional<String> label) Copies aStackinto aBoundingBoxin the combined image, resizing if necessary.voiddrawAllLabels(double ratioHeightForLabel, BoxAligner aligner) Draw all labels that have been queued during calls tocopyStackInto(org.anchoranalysis.core.functional.checked.CheckedSupplier<org.anchoranalysis.image.core.stack.RGBStack, org.anchoranalysis.io.input.InputReadFailedException>, java.lang.String, java.nio.file.Path, java.util.Optional<java.lang.String>).RGBStackgetStack()The stack into which individual images are written.
-
Constructor Details
-
MontageSharedState
public MontageSharedState(Map<Path, BoundingBoxEnclosed> boxes, Extent sizeCombined, VoxelsResizer resizer, ExecutionTimeRecorder executionTimeRecorder) Create with a mapping fromPaths to boxes.- Parameters:
boxes- a mapping from eachPathto the bounding-box in the combinedStack.sizeCombined- the size of the combinedStack.resizer- how to resize images.executionTimeRecorder- records the execution time of certain operations.
-
-
Method Details
-
copyStackInto
public void copyStackInto(CheckedSupplier<RGBStack, InputReadFailedException> source, String identifier, Path path, Optional<String> label) throws JobExecutionException Copies aStackinto aBoundingBoxin the combined image, resizing if necessary.Any associated label is added to a queue, to be later drawn when
drawAllLabels(double, org.anchoranalysis.image.bean.spatial.arrange.align.BoxAligner)is executed.The
Stackis read only lazily, to try and prevent errors untilBoundingBoxEnclosedis retrieved, so that a label can always be written, even in the event of copying failure.- Parameters:
source- supplies the image to copy from, not necessarily matching the final destination size. It is resized as necessary.identifier- the unique identifier for the image, so it can be included in error messages.path- the corresponding path to identify the appropriateBoundingBoxto use in the combined image.label- if set, this label is drawn onto the bottom of the image. if not set, nothing occurs.- Throws:
JobExecutionException- if no matching bounding-box exists, or the input cannot be successfully read, or copying otherwise fails.
-
drawAllLabels
public void drawAllLabels(double ratioHeightForLabel, BoxAligner aligner) throws OperationFailedException Draw all labels that have been queued during calls tocopyStackInto(org.anchoranalysis.core.functional.checked.CheckedSupplier<org.anchoranalysis.image.core.stack.RGBStack, org.anchoranalysis.io.input.InputReadFailedException>, java.lang.String, java.nio.file.Path, java.util.Optional<java.lang.String>).Once called, this class is no longer usable, and no subsequent methods should be called.
- Parameters:
ratioHeightForLabel- how much of the average box height should the label approximately be sized to.aligner- how to align the label on its respective associated image.- Throws:
OperationFailedException- if the labels cannot be successfully drawn.
-
getStack
public RGBStack getStack()The stack into which individual images are written.
-