public class DrawCroppedObjectsGenerator extends ObjectsAsRGBGenerator
DrawObjectsGenerator
, but with the background stack cropped to focus only on
the region containing objects.
Padding is also placed around the objects.
Constructor and Description |
---|
DrawCroppedObjectsGenerator(DrawObject drawObject,
DisplayStack background,
Padding padding,
ColorIndex colors)
Create with a particular background and method for drawing-objects.
|
Modifier and Type | Method and Description |
---|---|
protected RGBStack |
generateBackgroundRegion(ObjectCollectionWithProperties objects,
io.vavr.control.Either<Dimensions,DisplayStack> background)
Creates a
RGBStack containing the background, without objects being drawn upon it. |
protected ObjectCollectionWithProperties |
generateMasks(ObjectCollectionWithProperties objects)
Creates a
ObjectCollectionWithProperties indicative of the masks that will be imposed
on top of the background-region. |
createEmptyStackFor, getBackground, guaranteedImageAttributes, setBackground, transform
selectFileExtension, writeToFile
write, writeWithIndex
public DrawCroppedObjectsGenerator(DrawObject drawObject, DisplayStack background, Padding padding, ColorIndex colors)
drawObject
- method for drawing an object on an image.background
- the background image, on which objects are drawn.padding
- padding used to add a margin around the objects in the cropped area.colors
- the colors to use for objects, indexed by a particular identifier.protected RGBStack generateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions,DisplayStack> background) throws CreateException
ObjectsAsRGBGenerator
RGBStack
containing the background, without objects being drawn upon it.
This background may be all or only a region of the entire background-stack.
generateBackgroundRegion
in class ObjectsAsRGBGenerator
objects
- the current objects to be drawn.background
- the entire background.RGBStack
, as above.CreateException
- if the background cannot be successfully created.protected ObjectCollectionWithProperties generateMasks(ObjectCollectionWithProperties objects) throws CreateException
ObjectsAsRGBGenerator
ObjectCollectionWithProperties
indicative of the masks that will be imposed
on top of the background-region.generateMasks
in class ObjectsAsRGBGenerator
objects
- the objects to draw.objects
or a derived-representation of objects
, as will be
drawn on the background-region.CreateException
- if the background cannot be successfully created.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.