Class DrawObjectOnStackGenerator

All Implemented Interfaces:
Generator<BoundedList<ObjectMask>>, TransformingGenerator<BoundedList<ObjectMask>,Stack>, ElementWriter<BoundedList<ObjectMask>>

public class DrawObjectOnStackGenerator extends RasterGeneratorSelectFormat<BoundedList<ObjectMask>>
Creates images of object(s) drawn on a background only in a local region around their bounding box.

This provides a visualization of an object(s) and a small around of immediate background context.

Author:
Owen Feehan
  • Method Details

    • createFromStack

      public static DrawObjectOnStackGenerator createFromStack(ScaleableBackground background, int outlineWidth, ColorIndex colors)
      Creates the generator with a stack as the background - and with default color green and flattened across the Z-dimension.
      Parameters:
      background - stack that exists as a background for the object.
      outlineWidth - width of the outline around an object.
      colors - colors to use for outling of objects.
      Returns:
      the newly created generator.
    • createWithEmptyBackground

      public static DrawObjectOnStackGenerator createWithEmptyBackground(int outlineWidth, ColorIndex colors)
      Creates the generator with an empty background - and with default color green and flattened in Z-dimension.
      Parameters:
      outlineWidth - width of the outline around an object.
      colors - colors to use for outlining of objects.
      Returns:
      the newly created generator.
    • createFromStack

      public static DrawObjectOnStackGenerator createFromStack(Optional<ScaleableBackground> background, int outlineWidth, ColorIndex colors)
      Creates the generator with maybe a stack as the background, or else an empty background - and with default color green and flattened in Z.
      Parameters:
      background - stack that exists as a background for the object (or none, in which case a 0-valued grayscale background is assumed).
      outlineWidth - width of the outline around an object.
      colors - colors to use for outlining of objects.
      Returns:
      the newly created generator.
    • createFromGenerator

      public static DrawObjectOnStackGenerator createFromGenerator(TransformingGenerator<BoundingBox,Stack> backgroundGenerator, int outlineWidth, ColorIndex colors)
      Creates an extracted-object generator that draws an outline - with default color green and flattened in Z.
      Parameters:
      backgroundGenerator - generates a background for a bounding-box.
      outlineWidth - width of the outline around an object.
      colors - colors to use for outlining of objects.
      Returns:
      the newly created generator.
    • transform

      public Stack transform(BoundedList<ObjectMask> element) throws OutputWriteFailedException
      Description copied from interface: TransformingGenerator
      Applies any necessary preprocessing to create an element suitable for writing to the filesystem.
      Parameters:
      element - element to be assigned and then transformed.
      Returns:
      the transformed element after necessary preprocessing.
      Throws:
      OutputWriteFailedException - if anything goes wrong.
    • guaranteedImageAttributes

      public StackWriteAttributes guaranteedImageAttributes()
      Description copied from class: RasterGenerator
      Guarantees on the attributes of all images created by the generator.
      Specified by:
      guaranteedImageAttributes in class RasterGenerator<BoundedList<ObjectMask>>
      Returns:
      options that are guaranteed to be true of all images by the generator.