Class ObjectsAsRGBGenerator
- All Implemented Interfaces:
Generator<ObjectCollectionWithProperties>,TransformingGenerator<ObjectCollectionWithProperties,,Stack> ElementWriter<ObjectCollectionWithProperties>
- Direct Known Subclasses:
DrawCroppedObjectsGenerator,DrawObjectsGenerator
public abstract class ObjectsAsRGBGenerator
extends RasterGeneratorSelectFormat<ObjectCollectionWithProperties>
A base class for generators that draw an
ObjectCollection upon a RGBStack.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionObjectsAsRGBGenerator(DrawObject drawObject, ObjectDrawAttributes attributes, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates a newObjectsAsRGBGeneratorinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected static RGBStackcreateEmptyStackFor(Dimensions dimensions) Creates an emptyRGBStack.protected abstract RGBStackgenerateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates aRGBStackcontaining the background, without objects being drawn upon it.protected abstract ObjectCollectionWithPropertiesCreates aObjectCollectionWithPropertiesindicative of the masks that will be imposed on top of the background-region.io.vavr.control.Either<Dimensions, DisplayStack> A background image or dimensions to define an empty background.Guarantees on the attributes of all images created by the generator.voidsetBackground(io.vavr.control.Either<Dimensions, DisplayStack> background) A background image or dimensions to define an empty background.transform(ObjectCollectionWithProperties element) Applies any necessary preprocessing to create an element suitable for writing to the filesystem.Methods 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
-
ObjectsAsRGBGenerator
public ObjectsAsRGBGenerator(DrawObject drawObject, ObjectDrawAttributes attributes, io.vavr.control.Either<Dimensions, DisplayStack> background) Creates a newObjectsAsRGBGeneratorinstance.- Parameters:
drawObject- Determines how an object is drawn (on the background).attributes- An association of color and/or other identifies with each object.background- A background image or dimensions to define an empty background.
-
-
Method Details
-
transform
Description copied from interface:TransformingGeneratorApplies 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
Description copied from class:RasterGeneratorGuarantees on the attributes of all images created by the generator.- Specified by:
guaranteedImageAttributesin classRasterGenerator<ObjectCollectionWithProperties>- Returns:
- options that are guaranteed to be true of all images by the generator.
-
generateBackgroundRegion
protected abstract RGBStack generateBackgroundRegion(ObjectCollectionWithProperties objects, io.vavr.control.Either<Dimensions, DisplayStack> background) throws CreateExceptionCreates aRGBStackcontaining the background, without objects being drawn upon it.This background may be all or only a region of the entire background-stack.
- 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 abstract ObjectCollectionWithProperties generateMasks(ObjectCollectionWithProperties objects) throws CreateException Creates aObjectCollectionWithPropertiesindicative of the masks that will be imposed on top of the background-region.- 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.
-
createEmptyStackFor
Creates an emptyRGBStack.Empty implies all voxels are zero-valued i.e. have black color.
- Parameters:
dimensions- the size of the stack to create.- Returns:
- the newly created
RGBStack.
-
getBackground
A background image or dimensions to define an empty background. -
setBackground
A background image or dimensions to define an empty background.
-