Package org.apache.sis.image
Class PixelIterator.DoubleWindow
java.lang.Object
org.apache.sis.image.PixelIterator.Window<DoubleBuffer>
org.apache.sis.image.PixelIterator.DoubleWindow
- Enclosing class:
- PixelIterator
PixelIterator.Window
implementation backed by an array of double[]
.
This is the implementation used by Apache SIS for most computations.
Performance note
Java2D has numerous optimizations for the integer cases, with no equivalent for the floating point cases.
Consequently, if the data buffer is known to use some integer type, it is faster to get integer values and
convert them to
double
values instead of to request directly floating-point values. However, the
improvement is not as much as using BandedIterator
as least for small windows. For that reason,
we do not provide the "integers converted to doubles" performance workaround for now. Even if we provided
it, this DoubleWindow
would still be necessary for the general case (non-integer data buffers).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double[]
Sample values in the window (data
) and a temporary array (transfer
).private final double[]
Sample values in the window (data
) and a temporary array (transfer
).Fields inherited from class org.apache.sis.image.PixelIterator.Window
DIRECT, TRANSFER, TRANSFER_FROM_OTHER, values
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleWindow
(double[] data, double[] transfer) Creates a new window which will store the sample values in the givendata
array. -
Method Summary
Modifier and TypeMethodDescription(package private) Object
Performs the transfer between the underlying raster and this window.(package private) final PixelIterator
owner()
Returns the iterator that created this window.void
update()
Updates this window with the sample values in the region starting at current iterator position.Methods inherited from class org.apache.sis.image.PixelIterator.Window
getSize
-
Field Details
-
data
private final double[] dataSample values in the window (data
) and a temporary array (transfer
). Those arrays are overwritten whenupdate()
is invoked. -
transfer
private final double[] transferSample values in the window (data
) and a temporary array (transfer
). Those arrays are overwritten whenupdate()
is invoked.
-
-
Constructor Details
-
DoubleWindow
DoubleWindow(double[] data, double[] transfer) Creates a new window which will store the sample values in the givendata
array.
-
-
Method Details
-
owner
Returns the iterator that created this window.- Specified by:
owner
in classPixelIterator.Window<DoubleBuffer>
-
getPixels
Performs the transfer between the underlying raster and this window.- Specified by:
getPixels
in classPixelIterator.Window<DoubleBuffer>
- Parameters:
raster
- the raster from which to get the pixel values.subX
- the X coordinate of the upper-left pixel location.subY
- the Y coordinate of the upper-left pixel location.subWidth
- width of the pixel rectangle.subHeight
- height of the pixel rectangle.mode
- one ofPixelIterator.Window.DIRECT
,PixelIterator.Window.TRANSFER
orPixelIterator.Window.TRANSFER_FROM_OTHER
.- Returns:
- the array in which sample values have been stored.
-
update
public void update()Updates this window with the sample values in the region starting at current iterator position. This method assumes thatPixelIterator.next()
orPixelIterator.moveTo(int,int)
has been invoked.- Specified by:
update
in classPixelIterator.Window<DoubleBuffer>
-