Class ObjectsAsRGBGenerator
Object
org.anchoranalysis.image.io.stack.output.generator.RasterGenerator<T>
org.anchoranalysis.image.io.stack.output.generator.RasterGeneratorSelectFormat<ObjectCollectionWithProperties>
org.anchoranalysis.image.io.object.output.rgb.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
Constructors Constructor Description ObjectsAsRGBGenerator(DrawObject drawObject, ObjectDrawAttributes attributes, io.vavr.control.Either<Dimensions,DisplayStack> background) -
Method Summary
Modifier and Type Method Description protected 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 ObjectCollectionWithPropertiesgenerateMasks(ObjectCollectionWithProperties objects)Creates aObjectCollectionWithPropertiesindicative of the masks that will be imposed on top of the background-region.io.vavr.control.Either<Dimensions,DisplayStack>getBackground()A background image or dimensions to define an empty background.StackWriteAttributesguaranteedImageAttributes()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.Stacktransform(ObjectCollectionWithProperties element)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)
-
-
Method Details
-
transform
- Throws:
OutputWriteFailedException
-
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 CreateExceptionCreates 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.
-