Class DrawCroppedObjectsGenerator
Object
RasterGenerator<ObjectCollectionWithProperties>
RasterGeneratorSelectFormat<ObjectCollectionWithProperties>
ObjectsAsRGBGenerator
DrawCroppedObjectsGenerator
- All Implemented Interfaces:
Generator<ObjectCollectionWithProperties>,TransformingGenerator<ObjectCollectionWithProperties,,Stack> ElementWriter<ObjectCollectionWithProperties>
Similar to
DrawObjectsGenerator, but with the background stack cropped to focus only on
the region containing objects.
Padding is also placed around the objects.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionDrawCroppedObjectsGenerator(DrawObject drawObject, DisplayStack background, Padding padding, ColorIndex colors) Create with a particular background and method for drawing-objects. -
Method Summary
Modifier and TypeMethodDescriptionprotected RGBStackgenerateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates aRGBStackcontaining the background, without objects being drawn upon it.protected ObjectCollectionWithPropertiesCreates aObjectCollectionWithPropertiesindicative of the masks that will be imposed on top of the background-region.Methods inherited from class org.anchoranalysis.image.io.object.output.rgb.ObjectsAsRGBGenerator
createEmptyStackFor, getBackground, guaranteedImageAttributes, setBackground, transformMethods inherited from class org.anchoranalysis.image.io.stack.output.generator.RasterGeneratorSelectFormat
selectFileExtension, writeToFileMethods inherited from class org.anchoranalysis.image.io.stack.output.generator.RasterGenerator
write, writeWithIndex
-
Constructor Details
-
DrawCroppedObjectsGenerator
public DrawCroppedObjectsGenerator(DrawObject drawObject, DisplayStack background, Padding padding, ColorIndex colors) Create with a particular background and method for drawing-objects.- Parameters:
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.
-
-
Method Details
-
generateBackgroundRegion
protected RGBStack generateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) throws CreateExceptionDescription copied from class:ObjectsAsRGBGeneratorCreates aRGBStackcontaining the background, without objects being drawn upon it.This background may be all or only a region of the entire background-stack.
- Specified by:
generateBackgroundRegionin classObjectsAsRGBGenerator- Parameters:
objects- the current objects to be drawn.background- the entire background.- Returns:
- a newly created
RGBStack, as above. - Throws:
CreateException- if the background cannot be successfully created.
-
generateMasks
protected ObjectCollectionWithProperties generateMasks(ObjectCollectionWithProperties objects) throws CreateException Description copied from class:ObjectsAsRGBGeneratorCreates aObjectCollectionWithPropertiesindicative of the masks that will be imposed on top of the background-region.- Specified by:
generateMasksin classObjectsAsRGBGenerator- Parameters:
objects- the objects to draw.- Returns:
- either
objectsor a derived-representation ofobjects, as will be drawn on the background-region. - Throws:
CreateException- if the background cannot be successfully created.
-