Class RasterGenerator<T>
Object
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
Transforms an entity to a
Stack and writes it to the file-system.- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StackWriteAttributesGuarantees 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) Writes a non-indexable output (an output that isn't part of a collection of other similar items).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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.anchoranalysis.io.generator.TransformingGenerator
transform
-
Constructor Details
-
RasterGenerator
public RasterGenerator()
-
-
Method Details
-
write
public void write(T element, OutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException Description copied from interface:ElementWriterWrites a non-indexable output (an output that isn't part of a collection of other similar items).- Specified by:
writein interfaceElementWriter<T>- Parameters:
element- the element to write.outputNameStyle- how to write output-names.outputter- how the element is outputted.- Throws:
OutputWriteFailedException- if the write operation fails.
-
writeWithIndex
public void writeWithIndex(T element, String index, IndexableOutputNameStyle outputNameStyle, ElementOutputter outputter) throws OutputWriteFailedException As only a single-file is involved, this methods delegates to a simpler virtual method.- Specified by:
writeWithIndexin interfaceElementWriter<T>- Parameters:
element- the element to write.index- a string that uniquely identifies this element compared to others in the same write operation.outputNameStyle- how to write output-names.outputter- how the element is outputted.- Throws:
OutputWriteFailedException- if the write operation fails.
-
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 OperationFailedException Selects 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 OutputWriteFailedException Writes 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.
-