Class MontageSharedState

Object
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, BoundingBoxEnclosed> boxes, Extent sizeCombined, VoxelsResizer resizer, 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(CheckedSupplier<RGBStack, InputReadFailedException> source, String identifier, Path path, Optional<String> label) throws 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:
      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
      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.