Class RasterGenerator<T>
Object
org.anchoranalysis.image.io.stack.output.generator.RasterGenerator<T>
- Type Parameters:
T- the type of entity that is transformed to aStack
- All Implemented Interfaces:
Generator<T>,TransformingGenerator<T,Stack>,ElementWriter<T>
- Direct Known Subclasses:
RasterGeneratorSelectFormat
public abstract class RasterGenerator<T> extends Object implements TransformingGenerator<T,Stack>
Transforms an entity to a
Stack and writes it to the file-system.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description RasterGenerator() -
Method Summary
Modifier and Type Method Description abstract StackWriteAttributesguaranteedImageAttributes()Guarantees on the attributes of all images created by the generator.protected abstract StringselectFileExtension(Stack stack, StackWriteOptions options, OutputWriteSettings settings, Optional<Logger> logger)Selects the file-extension to use for a particular stack.voidwrite(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter)protected abstract voidwriteToFile(T untransformedElement, Stack transformedElement, StackWriteOptions options, OutputWriteSettings settings, Path filePath)Writes a stack to the file-system.voidwriteWithIndex(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter)As only a single-file is involved, this methods delegates to a simpler virtual method.
-
Constructor Details
-
RasterGenerator
public RasterGenerator()
-
-
Method Details
-
write
public void write(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException- Specified by:
writein interfaceElementWriter<T>- Throws:
OutputWriteFailedException
-
writeWithIndex
public void writeWithIndex(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedExceptionAs only a single-file is involved, this methods delegates to a simpler virtual method.- Specified by:
writeWithIndexin interfaceElementWriter<T>- Throws:
OutputWriteFailedException
-
guaranteedImageAttributes
Guarantees on the attributes of all images created by the generator.- Returns:
- options that are guaranteed to be true of all images by the generator.
-
selectFileExtension
protected abstract String selectFileExtension(Stack stack, StackWriteOptions options, OutputWriteSettings settings, Optional<Logger> logger) throws OperationFailedExceptionSelects the file-extension to use for a particular stack.- Parameters:
stack- the stack to select a file-extension foroptions- options that describe howstackshould be writtensettings- general settings for writing outputlogger- logger for information messages or warnings associated with writing outputs- Returns:
- the file extension without any leading period
- Throws:
OperationFailedException- if the operation could not be successfully completed.
-
writeToFile
protected abstract void writeToFile(T untransformedElement, Stack transformedElement, StackWriteOptions options, OutputWriteSettings settings, Path filePath) throws OutputWriteFailedExceptionWrites a stack to the file-system.- Parameters:
untransformedElement- the element for the generator before transforming to aStacktransformedElement- theStackthatelementwas transformed intooptions- options that describe howstackshould be writtensettings- general settings for writing output.filePath- the file-path to write too including the extension.- Throws:
OutputWriteFailedException- if the image could not be be successfully written to the file-system.
-