javax.media.jai.iterator
Interface RandomIter

All Known Subinterfaces:
WritableRandomIter

public interface RandomIter

An iterator that allows random read-only access to any sample within its bounding rectangle. This flexibility will generally exact a corresponding price in speed and setup overhead.

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.

The getSample(), getSampleFloat(), and getSampleDouble() methods are provided to allow read-only access to the source data. The getPixel() methods allow retrieval of all bands simultaneously.

An instance of RandomIter may be obtained by means of the RandomIterFactory.create() method, which returns an opaque object implementing this interface.

See Also:
WritableRandomIter, RandomIterFactory

Method Summary
 void done()
          Informs the iterator that it may discard its internal data structures.
 double[] getPixel(int x, int y, double[] dArray)
          Returns the samples of the specified pixel from the image in an array of double.
 float[] getPixel(int x, int y, float[] fArray)
          Returns the samples of the specified pixel from the image in an array of float.
 int[] getPixel(int x, int y, int[] iArray)
          Returns the samples of the specified pixel from the image in an array of int.
 int getSample(int x, int y, int b)
          Returns the specified sample from the image.
 double getSampleDouble(int x, int y, int b)
          Returns the specified sample from the image as a double.
 float getSampleFloat(int x, int y, int b)
          Returns the specified sample from the image as a float.
 

Method Detail

getSample

public int getSample(int x,
                     int y,
                     int b)
Returns the specified sample from the image.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
b - the band to retrieve.

getSampleFloat

public float getSampleFloat(int x,
                            int y,
                            int b)
Returns the specified sample from the image as a float.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
b - the band to retrieve.

getSampleDouble

public double getSampleDouble(int x,
                              int y,
                              int b)
Returns the specified sample from the image as a double.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
b - the band to retrieve.

getPixel

public int[] getPixel(int x,
                      int y,
                      int[] iArray)
Returns the samples of the specified pixel from the image in an array of int.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
iArray - An optionally preallocated int array.
Returns:
the contents of the pixel as an int array.

getPixel

public float[] getPixel(int x,
                        int y,
                        float[] fArray)
Returns the samples of the specified pixel from the image in an array of float.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
fArray - An optionally preallocated float array.
Returns:
the contents of the pixel as a float array.

getPixel

public double[] getPixel(int x,
                         int y,
                         double[] dArray)
Returns the samples of the specified pixel from the image in an array of double.

Parameters:
x - the X coordinate of the desired pixel.
y - the Y coordinate of the desired pixel.
dArray - An optionally preallocated double array.
Returns:
the contents of the pixel as a double array.

done

public void done()
Informs the iterator that it may discard its internal data structures. This method should be called when the iterator will no longer be used.