org.jaitools.imageutils.iterator
Class WritableSimpleIterator

java.lang.Object
  extended by org.jaitools.imageutils.iterator.AbstractSimpleIterator
      extended by org.jaitools.imageutils.iterator.WritableSimpleIterator

public class WritableSimpleIterator
extends AbstractSimpleIterator

A read-write image iterator which moves by column then row (pixel then line).

Author:
michael

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jaitools.imageutils.iterator.AbstractSimpleIterator
AbstractSimpleIterator.DelegateHelper, AbstractSimpleIterator.Order
 
Field Summary
 
Fields inherited from class org.jaitools.imageutils.iterator.AbstractSimpleIterator
delegateIter, imageDataType, imageRef, iterBounds
 
Constructor Summary
WritableSimpleIterator(WritableRenderedImage image, Rectangle bounds, Number outsideValue)
          Creates a new iterator.
WritableSimpleIterator(WritableRenderedImage image, Rectangle bounds, Number outsideValue, AbstractSimpleIterator.Order order)
          Creates a new iterator.
 
Method Summary
 boolean setSample(int x, int y, int band, Number value)
          Sets the value in the specified band of the image at the specified position.
 boolean setSample(int x, int y, Number value)
          Sets the value in the first band of the image at the specified position.
 boolean setSample(int band, Number value)
          Sets the value in the specified band of the image at the current position.
 boolean setSample(Number value)
          Sets the value in the first band of the image at the current position.
 boolean setSample(Point pos, int band, Number value)
          Sets the value in the specified band of the image at the specified position.
 boolean setSample(Point pos, Number value)
          Sets the value in the first band of the image at the specified position.
 
Methods inherited from class org.jaitools.imageutils.iterator.AbstractSimpleIterator
checkBandArg, done, getBounds, getEndPos, getImage, getPos, getPos, getSample, getSample, getSample, getSample, getSample, getSample, getStartPos, getSubBounds, hasNext, isInsideDelegateBounds, isWithinImage, next, reset, setDelegatePosition, setPos, setPos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WritableSimpleIterator

public WritableSimpleIterator(WritableRenderedImage image,
                              Rectangle bounds,
                              Number outsideValue)
Creates a new iterator. The bounds are allowed to extend beyond the bounds of the target image. When the iterator is positioned outside the image the specified outside value will be returned.

Parameters:
image - the target image
bounds - bounds for the iterator; if null the bounds of the target image will be used
outsideValue - value to return when the iterator is positioned beyond the bounds of the target image; may be null

WritableSimpleIterator

public WritableSimpleIterator(WritableRenderedImage image,
                              Rectangle bounds,
                              Number outsideValue,
                              AbstractSimpleIterator.Order order)
Creates a new iterator. The bounds are allowed to extend beyond the bounds of the target image. When the iterator is positioned outside the image the specified outside value will be returned.

Parameters:
image - the target image
bounds - bounds for the iterator; if null the bounds of the target image will be used
outsideValue - value to return when the iterator is positioned beyond the bounds of the target image; may be null
order - processing order for this iterator when using the AbstractSimpleIterator.next() method
Method Detail

setSample

public boolean setSample(Number value)
Sets the value in the first band of the image at the current position. If the iterator is positioned outside the image bounds, no change is made and this method returns false.

Parameters:
value -
Returns:
true if the image value was set; false if the iterator was positioned outside the bounds of the image

setSample

public boolean setSample(Point pos,
                         Number value)
Sets the value in the first band of the image at the specified position. If the position lies outside the image bounds, no change is made and this method returns false.

Parameters:
pos - the image position
value - the new value
Returns:
true if the image value was set; false if the specified position was outside the bounds of the image
Throws:
IllegalArgumentException - if either argument is null

setSample

public boolean setSample(int x,
                         int y,
                         Number value)
Sets the value in the first band of the image at the specified position. If the position lies outside the image bounds, no change is made and this method returns false.

Parameters:
x - image X-ordinate
y - image Y-ordinate
value - the new value
Returns:
true if the image value was set; false if the specified position was outside the bounds of the image
Throws:
IllegalArgumentException - if value is null

setSample

public boolean setSample(int band,
                         Number value)
Sets the value in the specified band of the image at the current position. If the iterator is positioned outside the image bounds, no change is made and this method returns false.

Parameters:
band - image band
value - the new value
Returns:
true if the image value was set; false if the iterator was positioned outside the bounds of the image
Throws:
IllegalArgumentException - if band is out of range for the target image or if value is null

setSample

public boolean setSample(Point pos,
                         int band,
                         Number value)
Sets the value in the specified band of the image at the specified position. If the position lies outside the image bounds, no change is made and this method returns false.

Parameters:
pos - the image position
band - the image band
value - the new value
Returns:
true if the image value was set; false if the specified position was outside the bounds of the image
Throws:
IllegalArgumentException - if either pos or value is null; or if band is out of range

setSample

public boolean setSample(int x,
                         int y,
                         int band,
                         Number value)
Sets the value in the specified band of the image at the specified position. If the position lies outside the image bounds, no change is made and this method returns false.

Parameters:
x - image X-ordinate
y - image Y-ordinate
band - the image band
value - the new value
Returns:
true if the image value was set; false if the specified position was outside the bounds of the image
Throws:
IllegalArgumentException - if value is null; or if band is out of range


Copyright © 2009-2013. All Rights Reserved.