Class MontageSharedState
Object
org.anchoranalysis.plugin.image.task.slice.MontageSharedState
public class MontageSharedState extends Object
A
Stack into which individual images are written, together with the necessary information
on where to write each image.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description MontageSharedState(Map<Path,org.anchoranalysis.image.bean.nonbean.spatial.arrange.BoundingBoxEnclosed> boxes, org.anchoranalysis.spatial.box.Extent sizeCombined, org.anchoranalysis.image.voxel.resizer.VoxelsResizer resizer, org.anchoranalysis.core.time.ExecutionTimeRecorder executionTimeRecorder)Create with a mapping fromPaths to boxes. -
Method Summary
Modifier and Type Method Description voidcopyStackInto(org.anchoranalysis.core.functional.checked.CheckedSupplier<org.anchoranalysis.image.core.stack.RGBStack,org.anchoranalysis.io.input.InputReadFailedException> source, String identifier, Path path, Optional<String> label)Copies aStackinto aBoundingBoxin the combined image, resizing if necessary.voiddrawAllLabels(double ratioHeightForLabel, org.anchoranalysis.image.bean.spatial.arrange.align.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>).org.anchoranalysis.image.core.stack.RGBStackgetStack()The stack into which individual images are written.
-
Constructor Details
-
MontageSharedState
public MontageSharedState(Map<Path,org.anchoranalysis.image.bean.nonbean.spatial.arrange.BoundingBoxEnclosed> boxes, org.anchoranalysis.spatial.box.Extent sizeCombined, org.anchoranalysis.image.voxel.resizer.VoxelsResizer resizer, org.anchoranalysis.core.time.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(org.anchoranalysis.core.functional.checked.CheckedSupplier<org.anchoranalysis.image.core.stack.RGBStack,org.anchoranalysis.io.input.InputReadFailedException> source, String identifier, Path path, Optional<String> label) throws org.anchoranalysis.experiment.JobExecutionExceptionCopies 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:
org.anchoranalysis.experiment.JobExecutionException- if no matching bounding-box exists, or the input cannot be successfully read, or copying otherwise fails.
-
drawAllLabels
public void drawAllLabels(double ratioHeightForLabel, org.anchoranalysis.image.bean.spatial.arrange.align.BoxAligner aligner) throws org.anchoranalysis.core.exception.OperationFailedExceptionDraw 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:
org.anchoranalysis.core.exception.OperationFailedException- if the labels cannot be successfully drawn.
-
getStack
public org.anchoranalysis.image.core.stack.RGBStack getStack()The stack into which individual images are written.
-