Class DrawObjectsGenerator
- All Implemented Interfaces:
Generator<ObjectCollectionWithProperties>
,TransformingGenerator<ObjectCollectionWithProperties,
,Stack> ElementWriter<ObjectCollectionWithProperties>
Generates stacks of RGB images using a
DrawObject
to draw objects on a background.- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionprotected RGBStack
generateBackgroundRegion
(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates aRGBStack
containing the background, without objects being drawn upon it.protected ObjectCollectionWithProperties
Creates aObjectCollectionWithProperties
indicative of the masks that will be imposed on top of the background-region.static DrawObjectsGenerator
outlineSingleColor
(int outlineWidth, DisplayStack background, RGBColor color) Creates a generator that draws an outline around objects on a background using a single color for all objects.static DrawObjectsGenerator
outlineVariedColors
(int numberColors, int outlineWidth, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates a generator that draws an outline around objects on a background using varied colors for the objects.static DrawObjectsGenerator
outlineVariedColors
(int numberColors, int outlineWidth, DisplayStack background) Creates a generator that draws an outline around objects on a background using varied colors for the objects.static DrawObjectsGenerator
outlineWithColorIndex
(int outlineWidth, ColorIndex colorIndex) Creates a generator that draws an outline around objects using a particularColorIndex
.static DrawObjectsGenerator
withBackgroundAndColors
(DrawObject drawObject, DisplayStack background, ColorIndex colorIndex) Creates a generator that draws an object in a particular way with particular colors and background.Methods inherited from class org.anchoranalysis.image.io.object.output.rgb.ObjectsAsRGBGenerator
createEmptyStackFor, getBackground, guaranteedImageAttributes, setBackground, transform
Methods inherited from class org.anchoranalysis.image.io.stack.output.generator.RasterGeneratorSelectFormat
selectFileExtension, writeToFile
Methods inherited from class org.anchoranalysis.image.io.stack.output.generator.RasterGenerator
write, writeWithIndex
-
Method Details
-
withBackgroundAndColors
public static DrawObjectsGenerator withBackgroundAndColors(DrawObject drawObject, DisplayStack background, ColorIndex colorIndex) Creates a generator that draws an object in a particular way with particular colors and background.- Parameters:
drawObject
- how to draw the object.background
- the background.colorIndex
- the colors.- Returns:
- the generator.
-
outlineVariedColors
public static DrawObjectsGenerator outlineVariedColors(int numberColors, int outlineWidth, DisplayStack background) Creates a generator that draws an outline around objects on a background using varied colors for the objects.- Parameters:
numberColors
- the number of unique colors to use.outlineWidth
- the width of the outline.background
- the background.- Returns:
- the generator.
-
outlineWithColorIndex
Creates a generator that draws an outline around objects using a particularColorIndex
.- Parameters:
outlineWidth
- the width of the outline.colorIndex
- the color-index.- Returns:
- the generator.
-
outlineVariedColors
public static DrawObjectsGenerator outlineVariedColors(int numberColors, int outlineWidth, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates a generator that draws an outline around objects on a background using varied colors for the objects.- Parameters:
numberColors
- the number of unique colors to use.outlineWidth
- the width of the outline.background
- the background or dimensions for a background (drawn as all black).- Returns:
- the generator.
-
outlineSingleColor
public static DrawObjectsGenerator outlineSingleColor(int outlineWidth, DisplayStack background, RGBColor color) Creates a generator that draws an outline around objects on a background using a single color for all objects.- Parameters:
outlineWidth
- the width of the outline.background
- the background or dimensions for a background (drawn as all black).color
- the single color to use for all objects.- Returns:
- the generator.
-
generateBackgroundRegion
protected RGBStack generateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) Description copied from class:ObjectsAsRGBGenerator
Creates aRGBStack
containing the background, without objects being drawn upon it.This background may be all or only a region of the entire background-stack.
- Specified by:
generateBackgroundRegion
in classObjectsAsRGBGenerator
- Parameters:
objects
- the current objects to be drawn.background
- the entire background.- Returns:
- a newly created
RGBStack
, as above.
-
generateMasks
Description copied from class:ObjectsAsRGBGenerator
Creates aObjectCollectionWithProperties
indicative of the masks that will be imposed on top of the background-region.- Specified by:
generateMasks
in classObjectsAsRGBGenerator
- Parameters:
objects
- the objects to draw.- Returns:
- either
objects
or a derived-representation ofobjects
, as will be drawn on the background-region.
-