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 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 from Paths to boxes.
      Parameters:
      boxes - a mapping from each Path to the bounding-box in the combined Stack.
      sizeCombined - the size of the combined Stack.
      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.JobExecutionException
      Copies a Stack into a BoundingBox in 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 Stack is read only lazily, to try and prevent errors until BoundingBoxEnclosed is 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 appropriate BoundingBox to 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.OperationFailedException
      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.