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 V
convertBeforeAssign
(T element) Converts an element before setting it on thedelegate
.protected Stack
convertBeforeTransform
(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, guaranteedImageAttributes
Methods inherited from class org.anchoranalysis.image.io.stack.output.generator.RasterGeneratorSelectFormat
selectFileExtension, writeToFile
Methods 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 delegateRasterGenerator
which 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:TransformingGenerator
Applies any necessary preprocessing to create an element suitable for writing to the filesystem.- Specified by:
transform
in interfaceTransformingGenerator<T,
V> - Overrides:
transform
in 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:RasterGeneratorDelegateToRaster
Converts an element before setting it on thedelegate
.- Specified by:
convertBeforeAssign
in classRasterGeneratorDelegateToRaster<V,
T> - Parameters:
element
- element to convert- Returns:
- converted element
- Throws:
OperationFailedException
- if anything goes wrong during conversion
-
convertBeforeTransform
Description copied from class:RasterGeneratorDelegateToRaster
Converts an element before callingRasterGeneratorDelegateToRaster.transform(T)
on thedelegate
.- Specified by:
convertBeforeTransform
in classRasterGeneratorDelegateToRaster<V,
T> - Parameters:
stack
- stack to convert- Returns:
- converted element
-