Class RasterGeneratorBridge<T,V>
Object
RasterGenerator<T>
RasterGeneratorSelectFormat<T>
RasterGeneratorDelegateToRaster<V,T>
RasterGeneratorBridge<T,V>
- Type Parameters:
T- exposed-iterator typeV- delegate-iterator-type (hidden type)
- All Implemented Interfaces:
Generator<T>,TransformingGenerator<T,,Stack> ElementWriter<T>
Allows us to call an
RasterGenerator<S> as if it was an RasterGenerator<T> using
an function to connect the two.- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionRasterGeneratorBridge(RasterGenerator<V> delegate, CheckedFunction<T, V, ? extends Throwable> elementBridge) Creates with a delegate and a function to bridge the exposed element-type to the delegate element-type. -
Method Summary
Modifier and TypeMethodDescriptionprotected VconvertBeforeAssign(T element) Converts an element before setting it on thedelegate.protected StackconvertBeforeTransform(Stack stack) Converts an element before callingRasterGeneratorDelegateToRaster.transform(T)on thedelegate.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.RasterGeneratorDelegateToRaster
getDelegate, guaranteedImageAttributesMethods 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
-
RasterGeneratorBridge
public RasterGeneratorBridge(RasterGenerator<V> delegate, CheckedFunction<T, V, ? extends Throwable> elementBridge) Creates with a delegate and a function to bridge the exposed element-type to the delegate element-type.- Parameters:
delegate- the delegateRasterGeneratorwhich is called after bridging.elementBridge- the function that bridges the exposed element-type to the delegate element-type.
-
-
Method Details
-
transform
Description copied from interface:TransformingGeneratorApplies any necessary preprocessing to create an element suitable for writing to the filesystem.- Specified by:
transformin interfaceTransformingGenerator<T,V> - Overrides:
transformin classRasterGeneratorDelegateToRaster<V,T> - Parameters:
element- element to be assigned and then transformed.- Returns:
- the transformed element after necessary preprocessing.
- Throws:
OutputWriteFailedException- if anything goes wrong.
-
convertBeforeAssign
Description copied from class:RasterGeneratorDelegateToRasterConverts an element before setting it on thedelegate.- Specified by:
convertBeforeAssignin classRasterGeneratorDelegateToRaster<V,T> - Parameters:
element- element to convert- Returns:
- converted element
- Throws:
OperationFailedException- if anything goes wrong during conversion
-
convertBeforeTransform
Description copied from class:RasterGeneratorDelegateToRasterConverts an element before callingRasterGeneratorDelegateToRaster.transform(T)on thedelegate.- Specified by:
convertBeforeTransformin classRasterGeneratorDelegateToRaster<V,T> - Parameters:
stack- stack to convert- Returns:
- converted element
-