Package org.apache.sis.image
Class PixelIterator.Builder
- Object
-
- Builder
-
- Enclosing class:
- PixelIterator
public static class PixelIterator.Builder extends Object
Builds pixel iterators for specified region of interest, window size or iteration order. By default, the builder creates iterators for all pixels in the given raster or image, with unspecified iteration order. Users can invoke setter methods for specifying desired behavior for the iterators to create.Example:PixelIterator iterator = new PixelIterator.Builder().setRegionOfInterest(new Rectangle(10, 10, 5, 5).create(image);
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a new iterator builder with no region of interest, no window size and default iterator order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PixelIterator
create(Raster data)
Creates a read-only iterator for the given raster.PixelIterator
create(RenderedImage data)
Creates a read-only iterator for the given image.WritablePixelIterator
createWritable(Raster input, WritableRaster output)
Creates an iterator which will read and write in two different rasters.WritablePixelIterator
createWritable(RenderedImage input, WritableRenderedImage output)
Creates an iterator which will read and write in two different images.WritablePixelIterator
createWritable(WritableRaster data)
Creates a read/write iterator for the given raster.WritablePixelIterator
createWritable(WritableRenderedImage data)
Creates a read/write iterator for the given image.PixelIterator.Builder
setRegionOfInterest(Rectangle subArea)
Sets the region (in pixel coordinates) where to perform the iteration.PixelIterator.Builder
setWindowSize(Dimension window)
Sets the size of the window to use inPixelIterator.createWindow(TransferType)
method.
-
-
-
Method Detail
-
setRegionOfInterest
public PixelIterator.Builder setRegionOfInterest(Rectangle subArea)
Sets the region (in pixel coordinates) where to perform the iteration. By default, iterators will traverse all pixels in the given image or raster.- Parameters:
subArea
- region where to iterator, ornull
for iterating over all image domain.- Returns:
this
for method call chaining.
-
setWindowSize
public PixelIterator.Builder setWindowSize(Dimension window)
Sets the size of the window to use inPixelIterator.createWindow(TransferType)
method. By default, iterators do not create windows.- Parameters:
window
- the window size, ornull
if no window will be created.- Returns:
this
for method call chaining.
-
create
public PixelIterator create(Raster data)
Creates a read-only iterator for the given raster.- Parameters:
data
- the raster which contains the sample values on which to iterate.- Returns:
- a new iterator traversing pixels in the given raster.
-
create
public PixelIterator create(RenderedImage data)
Creates a read-only iterator for the given image.- Parameters:
data
- the image which contains the sample values on which to iterate.- Returns:
- a new iterator traversing pixels in the given image.
-
createWritable
public WritablePixelIterator createWritable(WritableRaster data)
Creates a read/write iterator for the given raster.- Parameters:
data
- the raster which contains the sample values on which to iterate.- Returns:
- a new iterator traversing pixels in the given raster.
-
createWritable
public WritablePixelIterator createWritable(WritableRenderedImage data)
Creates a read/write iterator for the given image.- Parameters:
data
- the image which contains the sample values on which to iterate.- Returns:
- a new iterator traversing pixels in the given image.
-
createWritable
public WritablePixelIterator createWritable(Raster input, WritableRaster output)
Creates an iterator which will read and write in two different rasters.- Parameters:
input
- the raster which contains the sample values to read.output
- the raster where to write the sample values. Can be the same thaninput
.- Returns:
- a new writable iterator.
-
createWritable
public WritablePixelIterator createWritable(RenderedImage input, WritableRenderedImage output)
Creates an iterator which will read and write in two different images.- Parameters:
input
- the image which contains the sample values to read.output
- the image where to write the sample values. Can be the same thaninput
.- Returns:
- a new writable iterator.
-
-