Package org.geotools.image
Class TransfertRectIter
Object
TransfertRectIter
- All Implemented Interfaces:
RectIter,WritableRectIter
A writable iterator that read pixel values from an image, and write pixel values to a
different image. All
get methods read values from the source image specified at
creation time. All set 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 usual WritableRectIter contract, which read and write values in the same image.
This TransfertRectIter is convenient for the implementation of some image operations.- Since:
- 2.3
- Author:
- Martin Desruisseaux (IRD)
-
Method Summary
Modifier and TypeMethodDescriptionstatic WritableRectItercreate(RectIter src, WritableRectIter dst) Creates aWritableRectIterfor the specified source and destination iterator.booleanReturnstrueif the max band in the image has been exceeded.booleanReturnstrueif the bottom row of the bounding rectangle has been passed.booleanReturnstrueif 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.intReturns the current sample as an integer.intgetSample(int b) Returns the specified sample of the current pixel as an integer.doubleReturns the current sample as a double.doublegetSampleDouble(int b) Returns the specified sample of the current pixel as a double.floatReturns the current sample as a float.floatgetSampleFloat(int b) Returns the specified sample of the current pixel as a float.voidjumpLines(int num) Jumps downward num lines from the current position.voidjumpPixels(int num) Jumps rightward num pixels from the current position.voidnextBand()Sets the iterator to the next band in the image.booleanSets the iterator to the next band in the image, and returnstrueif the max band has been exceeded.voidnextLine()Sets the iterator to the next line of the image.booleanSets the iterator to the next line in the image, and returnstrueif the bottom row of the bounding rectangle has been passed.voidSets the iterator to the next pixel in image (that is, move rightward).booleanSets the iterator to the next pixel in the image (that is, move rightward).voidsetPixel(double[] array) Sets all samples of the current pixel to a set of double values.voidsetPixel(float[] array) Sets all samples of the current pixel to a set of float values.voidsetPixel(int[] array) Sets all samples of the current pixel to a set of int values.voidsetSample(double s) Sets the current sample to a double value.voidsetSample(float s) Sets the current sample to a float value.voidsetSample(int s) Sets the current sample to an integral value.voidsetSample(int b, double s) Sets the specified sample of the current pixel to a double value.voidsetSample(int b, float s) Sets the specified sample of the current pixel to a float value.voidsetSample(int b, int s) Sets the specified sample of the current pixel to an integral value.voidSets the iterator to the first band of the image.voidSets the iterator to the first line of its bounding rectangle.voidSets the iterator to the leftmost pixel of its bounding rectangle.
-
Method Details
-
create
public static WritableRectIter create(RectIter src, WritableRectIter dst) Creates aWritableRectIterfor the specified source and destination iterator. The two iterators must iterate over a rectangle of the same size, otherwise aRasterFormatExceptionmay be thrown during the iteration.- Parameters:
src- The source iterator.dst- The destination iterator.- Returns:
- An iterator that read sample from
srcand 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:
startLinesin interfaceRectIter
-
startPixels
public void startPixels()Sets the iterator to the leftmost pixel of its bounding rectangle.- Specified by:
startPixelsin interfaceRectIter
-
startBands
public void startBands()Sets the iterator to the first band of the image.- Specified by:
startBandsin interfaceRectIter
-
jumpLines
public void jumpLines(int num) Jumps downward num lines from the current position.- Specified by:
jumpLinesin interfaceRectIter
-
jumpPixels
public void jumpPixels(int num) Jumps rightward num pixels from the current position.- Specified by:
jumpPixelsin interfaceRectIter
-
nextLine
public void nextLine()Sets the iterator to the next line of the image.- Specified by:
nextLinein interfaceRectIter
-
nextPixel
public void nextPixel()Sets the iterator to the next pixel in image (that is, move rightward).- Specified by:
nextPixelin interfaceRectIter
-
nextBand
public void nextBand()Sets the iterator to the next band in the image.- Specified by:
nextBandin interfaceRectIter
-
nextLineDone
public boolean nextLineDone()Sets the iterator to the next line in the image, and returnstrueif the bottom row of the bounding rectangle has been passed.- Specified by:
nextLineDonein interfaceRectIter
-
nextPixelDone
public boolean nextPixelDone()Sets the iterator to the next pixel in the image (that is, move rightward).- Specified by:
nextPixelDonein interfaceRectIter
-
nextBandDone
public boolean nextBandDone()Sets the iterator to the next band in the image, and returnstrueif the max band has been exceeded.- Specified by:
nextBandDonein interfaceRectIter
-
finishedLines
public boolean finishedLines()Returnstrueif the bottom row of the bounding rectangle has been passed.- Specified by:
finishedLinesin interfaceRectIter
-
finishedPixels
public boolean finishedPixels()Returnstrueif the right edge of the bounding rectangle has been passed.- Specified by:
finishedPixelsin interfaceRectIter
-
finishedBands
public boolean finishedBands()Returnstrueif the max band in the image has been exceeded.- Specified by:
finishedBandsin interfaceRectIter
-
getPixel
public int[] getPixel(int[] array) Returns the samples of the current pixel from the image in an array of int.- Specified by:
getPixelin interfaceRectIter
-
getPixel
public float[] getPixel(float[] array) Returns the samples of the current pixel from the image in an array of float.- Specified by:
getPixelin interfaceRectIter
-
getPixel
public double[] getPixel(double[] array) Returns the samples of the current pixel from the image in an array of double.- Specified by:
getPixelin interfaceRectIter
-
getSample
public int getSample()Returns the current sample as an integer.- Specified by:
getSamplein interfaceRectIter
-
getSample
public int getSample(int b) Returns the specified sample of the current pixel as an integer.- Specified by:
getSamplein interfaceRectIter
-
getSampleFloat
public float getSampleFloat()Returns the current sample as a float.- Specified by:
getSampleFloatin interfaceRectIter
-
getSampleFloat
public float getSampleFloat(int b) Returns the specified sample of the current pixel as a float.- Specified by:
getSampleFloatin interfaceRectIter
-
getSampleDouble
public double getSampleDouble()Returns the current sample as a double.- Specified by:
getSampleDoublein interfaceRectIter
-
getSampleDouble
public double getSampleDouble(int b) Returns the specified sample of the current pixel as a double.- Specified by:
getSampleDoublein interfaceRectIter
-
setPixel
public void setPixel(int[] array) Sets all samples of the current pixel to a set of int values.- Specified by:
setPixelin interfaceWritableRectIter
-
setPixel
public void setPixel(float[] array) Sets all samples of the current pixel to a set of float values.- Specified by:
setPixelin interfaceWritableRectIter
-
setPixel
public void setPixel(double[] array) Sets all samples of the current pixel to a set of double values.- Specified by:
setPixelin interfaceWritableRectIter
-
setSample
public void setSample(int s) Sets the current sample to an integral value.- Specified by:
setSamplein interfaceWritableRectIter
-
setSample
public void setSample(float s) Sets the current sample to a float value.- Specified by:
setSamplein interfaceWritableRectIter
-
setSample
public void setSample(double s) Sets the current sample to a double value.- Specified by:
setSamplein interfaceWritableRectIter
-
setSample
public void setSample(int b, int s) Sets the specified sample of the current pixel to an integral value.- Specified by:
setSamplein interfaceWritableRectIter
-
setSample
public void setSample(int b, float s) Sets the specified sample of the current pixel to a float value.- Specified by:
setSamplein interfaceWritableRectIter
-
setSample
public void setSample(int b, double s) Sets the specified sample of the current pixel to a double value.- Specified by:
setSamplein interfaceWritableRectIter
-