Package org.apache.sis.image
Class Transferer.DoubleToInteger
java.lang.Object
org.apache.sis.image.Transferer
org.apache.sis.image.Transferer.DoubleToInteger
- Direct Known Subclasses:
Transferer.DoubleToByte
,Transferer.DoubleToShort
,Transferer.DoubleToUShort
- Enclosing class:
- Transferer
Read
double
values from the source raster and write int
values in a temporary buffer.
The floating point values will be rounded and clamped to the range of the integer type.
Note that we do not provide any direct version for integer types because direct access
to DataBuffer
array disable Java2D acceleration on video card.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[]
Temporary buffer where to copy data and apply operation.protected int[]
Temporary buffer where to round data before transfer to target raster.Fields inherited from class org.apache.sis.image.Transferer
band, region, source, target
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleToInteger
(Raster source, WritableRaster target, Rectangle aoi) Creates a new instance for transferring data between the two specified rasters. -
Method Summary
Modifier and TypeMethodDescription(package private) void
clamp
(int length) Clamps data to the range of target integer type.(package private) final void
computeStrip
(org.opengis.referencing.operation.MathTransform1D converter) Copies source values in temporary buffer, applies conversion then copies to target.(package private) final int
Subdivides the region to process in smaller strips, for smaller buffer.Methods inherited from class org.apache.sis.image.Transferer
compute, create, create, length
-
Field Details
-
buffer
protected double[] bufferTemporary buffer where to copy data and apply operation. -
transfer
protected int[] transferTemporary buffer where to round data before transfer to target raster.
-
-
Constructor Details
-
DoubleToInteger
DoubleToInteger(Raster source, WritableRaster target, Rectangle aoi) Creates a new instance for transferring data between the two specified rasters.
-
-
Method Details
-
prepareTransferRegion
final int prepareTransferRegion()Subdivides the region to process in smaller strips, for smaller buffer.- Overrides:
prepareTransferRegion
in classTransferer
- Returns:
region.y + region.height
.- See Also:
-
computeStrip
final void computeStrip(org.opengis.referencing.operation.MathTransform1D converter) throws org.opengis.referencing.operation.TransformException Copies source values in temporary buffer, applies conversion then copies to target.- Specified by:
computeStrip
in classTransferer
- Parameters:
converter
- the operation to apply on sample values in current region and current band number.- Throws:
org.opengis.referencing.operation.TransformException
- if an error occurred during calculation.
-
clamp
void clamp(int length) Clamps data to the range of target integer type.
-