Package org.geotools.image
Class TransfertRectIter
- Object
-
- TransfertRectIter
-
- All Implemented Interfaces:
RectIter
,WritableRectIter
public final class TransfertRectIter extends Object implements WritableRectIter
A writable iterator that read pixel values from an image, and write pixel values to a different image. Allget
methods read values from the source image specified at creation time. Allset
methods write values to the destination image specified at creation time, which may or may not be the same than the source image. This is different than the usualWritableRectIter
contract, which read and write values in the same image. ThisTransfertRectIter
is convenient for the implementation of some image operations.- Since:
- 2.3
- Author:
- Martin Desruisseaux (IRD)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WritableRectIter
create(RectIter src, WritableRectIter dst)
Creates aWritableRectIter
for the specified source and destination iterator.boolean
finishedBands()
Returnstrue
if the max band in the image has been exceeded.boolean
finishedLines()
Returnstrue
if the bottom row of the bounding rectangle has been passed.boolean
finishedPixels()
Returnstrue
if the right edge of the bounding rectangle has been passed.double[]
getPixel(double[] array)
Returns the samples of the current pixel from the image in an array of double.float[]
getPixel(float[] array)
Returns the samples of the current pixel from the image in an array of float.int[]
getPixel(int[] array)
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 returnstrue
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 returnstrue
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
setPixel(double[] array)
Sets all samples of the current pixel to a set of double values.void
setPixel(float[] array)
Sets all samples of the current pixel to a set of float values.void
setPixel(int[] array)
Sets all samples of the current pixel to a set of int values.void
setSample(double s)
Sets the current sample to a double value.void
setSample(float s)
Sets the current sample to a float value.void
setSample(int s)
Sets the current sample to an integral value.void
setSample(int b, double s)
Sets the specified sample of the current pixel to a double value.void
setSample(int b, float s)
Sets the specified sample of the current pixel to a float value.void
setSample(int b, int s)
Sets the specified sample of the current pixel to an integral value.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
-
create
public static WritableRectIter create(RectIter src, WritableRectIter dst)
Creates aWritableRectIter
for the specified source and destination iterator. The two iterators must iterate over a rectangle of the same size, otherwise aRasterFormatException
may be thrown during the iteration.- Parameters:
src
- The source iterator.dst
- The destination iterator.- Returns:
- An iterator that read sample from
src
and write sample todst
. Ifsrc == dst
, then the destination iterator itself is returned.
-
startLines
public void startLines()
Sets the iterator to the first line of its bounding rectangle.- Specified by:
startLines
in interfaceRectIter
-
startPixels
public void startPixels()
Sets the iterator to the leftmost pixel of its bounding rectangle.- Specified by:
startPixels
in interfaceRectIter
-
startBands
public void startBands()
Sets the iterator to the first band of the image.- Specified by:
startBands
in interfaceRectIter
-
jumpLines
public void jumpLines(int num)
Jumps downward num lines from the current position.- Specified by:
jumpLines
in interfaceRectIter
-
jumpPixels
public void jumpPixels(int num)
Jumps rightward num pixels from the current position.- Specified by:
jumpPixels
in interfaceRectIter
-
nextLine
public void nextLine()
Sets the iterator to the next line of the image.- Specified by:
nextLine
in interfaceRectIter
-
nextPixel
public void nextPixel()
Sets the iterator to the next pixel in image (that is, move rightward).- Specified by:
nextPixel
in interfaceRectIter
-
nextBand
public void nextBand()
Sets the iterator to the next band in the image.- Specified by:
nextBand
in interfaceRectIter
-
nextLineDone
public boolean nextLineDone()
Sets the iterator to the next line in the image, and returnstrue
if the bottom row of the bounding rectangle has been passed.- Specified by:
nextLineDone
in interfaceRectIter
-
nextPixelDone
public boolean nextPixelDone()
Sets the iterator to the next pixel in the image (that is, move rightward).- Specified by:
nextPixelDone
in interfaceRectIter
-
nextBandDone
public boolean nextBandDone()
Sets the iterator to the next band in the image, and returnstrue
if the max band has been exceeded.- Specified by:
nextBandDone
in interfaceRectIter
-
finishedLines
public boolean finishedLines()
Returnstrue
if the bottom row of the bounding rectangle has been passed.- Specified by:
finishedLines
in interfaceRectIter
-
finishedPixels
public boolean finishedPixels()
Returnstrue
if the right edge of the bounding rectangle has been passed.- Specified by:
finishedPixels
in interfaceRectIter
-
finishedBands
public boolean finishedBands()
Returnstrue
if the max band in the image has been exceeded.- Specified by:
finishedBands
in interfaceRectIter
-
getPixel
public int[] getPixel(int[] array)
Returns the samples of the current pixel from the image in an array of int.- Specified by:
getPixel
in interfaceRectIter
-
getPixel
public float[] getPixel(float[] array)
Returns the samples of the current pixel from the image in an array of float.- Specified by:
getPixel
in interfaceRectIter
-
getPixel
public double[] getPixel(double[] array)
Returns the samples of the current pixel from the image in an array of double.- Specified by:
getPixel
in interfaceRectIter
-
getSample
public int getSample()
Returns the current sample as an integer.- Specified by:
getSample
in interfaceRectIter
-
getSample
public int getSample(int b)
Returns the specified sample of the current pixel as an integer.- Specified by:
getSample
in interfaceRectIter
-
getSampleFloat
public float getSampleFloat()
Returns the current sample as a float.- Specified by:
getSampleFloat
in interfaceRectIter
-
getSampleFloat
public float getSampleFloat(int b)
Returns the specified sample of the current pixel as a float.- Specified by:
getSampleFloat
in interfaceRectIter
-
getSampleDouble
public double getSampleDouble()
Returns the current sample as a double.- Specified by:
getSampleDouble
in interfaceRectIter
-
getSampleDouble
public double getSampleDouble(int b)
Returns the specified sample of the current pixel as a double.- Specified by:
getSampleDouble
in interfaceRectIter
-
setPixel
public void setPixel(int[] array)
Sets all samples of the current pixel to a set of int values.- Specified by:
setPixel
in interfaceWritableRectIter
-
setPixel
public void setPixel(float[] array)
Sets all samples of the current pixel to a set of float values.- Specified by:
setPixel
in interfaceWritableRectIter
-
setPixel
public void setPixel(double[] array)
Sets all samples of the current pixel to a set of double values.- Specified by:
setPixel
in interfaceWritableRectIter
-
setSample
public void setSample(int s)
Sets the current sample to an integral value.- Specified by:
setSample
in interfaceWritableRectIter
-
setSample
public void setSample(float s)
Sets the current sample to a float value.- Specified by:
setSample
in interfaceWritableRectIter
-
setSample
public void setSample(double s)
Sets the current sample to a double value.- Specified by:
setSample
in interfaceWritableRectIter
-
setSample
public void setSample(int b, int s)
Sets the specified sample of the current pixel to an integral value.- Specified by:
setSample
in interfaceWritableRectIter
-
setSample
public void setSample(int b, float s)
Sets the specified sample of the current pixel to a float value.- Specified by:
setSample
in interfaceWritableRectIter
-
setSample
public void setSample(int b, double s)
Sets the specified sample of the current pixel to a double value.- Specified by:
setSample
in interfaceWritableRectIter
-
-