|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An iterator for traversing a read-only image in top-to-bottom, left-to-right order. This will generally be the fastest style of iterator, since it does not need to perform bounds checks against the top or left edges of tiles.
The iterator is initialized with a particular rectangle as its bounds, which it is illegal to exceed. This initialization takes place in a factory method and is not a part of the iterator interface itself. Once initialized, the iterator may be reset to its initial state by means of the startLine(), startPixels(), and startBands() methods. Its position may be advanced using the nextLine(), jumpLines(), nextPixel(), jumpPixels(), and nextBand() methods.
The iterator's position may be tested against the bounding rectangle by means of the finishedLines(), finishedPixels(), and finishedBands() methods, as well as the hybrid methods nextLineDone(), nextPixelDone(), and nextBandDone().
The getSample(), getSampleFloat(), and getSampleDouble() methods are provided to allow read-only access to the source data. The various source bands may also be accessed in random fashion using the variants that accept a band index. The getPixel() methods allow retrieval of all bands simultaneously.
An instance of RectIter may be obtained by means of the RectIterFactory.create() method, which returns an opaque object implementing this interface.
WritableRectIter
,
RectIterFactory
Method Summary | |
boolean |
finishedBands()
Returns true if the max band in the image has been exceeded. |
boolean |
finishedLines()
Returns true if the bottom row of the bounding rectangle has been passed. |
boolean |
finishedPixels()
Returns true if the right edge of the bounding rectangle has been passed. |
double[] |
getPixel(double[] dArray)
Returns the samples of the current pixel from the image in an array of double. |
float[] |
getPixel(float[] fArray)
Returns the samples of the current pixel from the image in an array of float. |
int[] |
getPixel(int[] iArray)
Returns the samples of the current pixel from the image in an array of int. |
int |
getSample()
Returns the current sample as an integer. |
int |
getSample(int b)
Returns the specified sample of the current pixel as an integer. |
double |
getSampleDouble()
Returns the current sample as a double. |
double |
getSampleDouble(int b)
Returns the specified sample of the current pixel as a double. |
float |
getSampleFloat()
Returns the current sample as a float. |
float |
getSampleFloat(int b)
Returns the specified sample of the current pixel as a float. |
void |
jumpLines(int num)
Jumps downward num lines from the current position. |
void |
jumpPixels(int num)
Jumps rightward num pixels from the current position. |
void |
nextBand()
Sets the iterator to the next band in the image. |
boolean |
nextBandDone()
Sets the iterator to the next band in the image, and returns true if the max band has been exceeded. |
void |
nextLine()
Sets the iterator to the next line of the image. |
boolean |
nextLineDone()
Sets the iterator to the next line in the image, and returns true if the bottom row of the bounding rectangle has been passed. |
void |
nextPixel()
Sets the iterator to the next pixel in image (that is, move rightward). |
boolean |
nextPixelDone()
Sets the iterator to the next pixel in the image (that is, move rightward). |
void |
startBands()
Sets the iterator to the first band of the image. |
void |
startLines()
Sets the iterator to the first line of its bounding rectangle. |
void |
startPixels()
Sets the iterator to the leftmost pixel of its bounding rectangle. |
Method Detail |
public void startLines()
public void nextLine()
public boolean nextLineDone()
public void jumpLines(int num)
IndexOutOfBoundsException
will be thrown
and the position will be unchanged.public boolean finishedLines()
public void startPixels()
public void nextPixel()
This method may be used in conjunction with the method
finishedPixels
. Or the method nextPixelDone
,
which sets the iterator to the next pixel and checks the bound,
may be used instead of this method.
public boolean nextPixelDone()
public void jumpPixels(int num)
IndexOutOfBoundsException
will be thrown
and the position will be unchanged.public boolean finishedPixels()
public void startBands()
public void nextBand()
public boolean nextBandDone()
public boolean finishedBands()
public int getSample()
public int getSample(int b)
b
- the band index of the desired sample.public float getSampleFloat()
public float getSampleFloat(int b)
b
- the band index of the desired sample.public double getSampleDouble()
public double getSampleDouble(int b)
b
- the band index of the desired sample.public int[] getPixel(int[] iArray)
iArray
- An optionally preallocated int array.public float[] getPixel(float[] fArray)
fArray
- An optionally preallocated float array.public double[] getPixel(double[] dArray)
dArray
- An optionally preallocated double array.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |