| java.lang.Object javax.media.jai.ROI
All known Subclasses: javax.media.jai.ROIShape,
ROI | public class ROI implements Serializable(Code) | | The parent class for representations of a region of interest of an
image (currently only single band images with integral data types
are supported).
This class represents region information in image form, and
can thus be used as a fallback where a Shape
representation is unavailable. Where possible, subclasses such as
ROIShape are used since they provide a more compact means of
storage for large regions.
The getAsShape() method may be called optimistically on any
instance of ROI; however, it may return null to indicate that a
Shape representation of the ROI is not available. In
this case, getAsImage() should be called as a fallback.
Inclusion and exclusion of pixels is defined by a threshold value.
Pixel values greater than or equal to the threshold indicate inclusion.
|
Field Summary | |
transient PlanarImage | theImage The PlanarImage representation of the ROI. | int | threshold The inclusion/exclusion threshold of the ROI. |
Constructor Summary | |
protected | ROI() The default constructor. | public | ROI(RenderedImage im) Constructs an ROI from a RenderedImage. | public | ROI(RenderedImage im, int threshold) Constructs an ROI from a RenderedImage. |
Method Summary | |
public ROI | add(ROI roi) Adds another ROI to this one and returns the result
as a new ROI . | public boolean | contains(Point p) Returns true if the ROI contains a given Point.
Parameters: p - A Point identifying the pixel to be queried. throws: IllegalArgumentException - if p is null. | public boolean | contains(Point2D p) Returns true if the ROI contains a given Point2D.
Parameters: p - A Point2D identifying the pixel to be queried. throws: IllegalArgumentException - if p is null. | public boolean | contains(int x, int y) Returns true if the ROI contains the point (x, y).
Parameters: x - An int specifying the X coordinate of the pixel to be queried. Parameters: y - An int specifying the Y coordinate of the pixel to be queried. | public boolean | contains(double x, double y) Returns true if the ROI contain the point (x, y).
Parameters: x - A double specifying the X coordinate of the pixelto be queried. Parameters: y - A double specifying the Y coordinate of the pixelto be queried. | public boolean | contains(Rectangle rect) Returns true if a given Rectangle is
entirely included within the ROI.
Parameters: rect - A Rectangle specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if rect is null. | public boolean | contains(Rectangle2D rect) Returns true if a given Rectangle2D is
entirely included within the ROI.
Parameters: rect - A Rectangle2D specifying the region to betested for inclusion. throws: IllegalArgumentException - if rect is null. | public boolean | contains(int x, int y, int w, int h) Returns true if a given rectangle (x, y, w, h) is entirely
included within the ROI.
Parameters: x - The int X coordinate of the upper left corner of the region. Parameters: y - The int Y coordinate of the upper left corner of the region. Parameters: w - The int width of the region. Parameters: h - The int height of the region. | public boolean | contains(double x, double y, double w, double h) Returns true if a given rectangle (x, y, w, h) is entirely
included within the ROI.
Parameters: x - The double X coordinate of the upper left corner of the region. Parameters: y - The double Y coordinate of the upper left corner of the region. Parameters: w - The double width of the region. Parameters: h - The double height of the region. | public ROI | exclusiveOr(ROI roi) Exclusive-ors the ROI with another ROI
and returns the result as a new ROI . | public int[][] | getAsBitmask(int x, int y, int width, int height, int[][] mask) Returns a bitmask for a given rectangular region of the ROI
indicating whether the pixel is included in the region of
interest. | public PlanarImage | getAsImage() Returns a PlanarImage representation of the
ROI . | public LinkedList | getAsRectangleList(int x, int y, int width, int height) Returns a LinkedList of Rectangle s
for a given rectangular region of the ROI. | protected LinkedList | getAsRectangleList(int x, int y, int width, int height, boolean mergeRectangles) Returns a LinkedList of Rectangle s for
a given rectangular region of the ROI.
Parameters: x - The X coordinate of the upper left corner of the rectangle. Parameters: y - The Y coordinate of the upper left corner of the rectangle. Parameters: width - The width of the rectangle. Parameters: height - The height of the rectangle. Parameters: mergeRectangles - true if the Rectangle sare to be merged into a minimal set. | public Shape | getAsShape() Returns a Shape representation of the
ROI , if possible. | public Rectangle | getBounds() Returns the bounds of the ROI as a Rectangle . | public Rectangle2D | getBounds2D() Returns the bounds of the ROI as a Rectangle2D . | public int | getThreshold() Returns the inclusion/exclusion threshold value. | public ROI | intersect(ROI roi) Intersects the ROI with another ROI and returns the result as
a new ROI . | public boolean | intersects(Rectangle rect) Returns true if a given Rectangle
intersects the ROI.
Parameters: rect - A Rectangle specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if rect is null. | public boolean | intersects(Rectangle2D r) Returns true if a given Rectangle2D
intersects the ROI.
Parameters: r - A Rectangle2D specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if r is null. | public boolean | intersects(int x, int y, int w, int h) Returns true if a given rectangular region
intersects the ROI.
Parameters: x - The int X coordinate of the upper left corner of the region. Parameters: y - The int Y coordinate of the upper left corner of the region. Parameters: w - The int width of the region. Parameters: h - The int height of the region. | public boolean | intersects(double x, double y, double w, double h) Returns true if a given rectangular region
intersects the ROI.
Parameters: x - The double X coordinate of the upper left corner of the region. Parameters: y - The double Y coordinate of the upper left corner of the region. Parameters: w - The double width of the region. Parameters: h - The double height of the region. | protected static LinkedList | mergeRunLengthList(LinkedList rectList) Merge a LinkedList of Rectangle s
representing run lengths of pixels in the ROI into a minimal
list wherein vertically abutting Rectangle s are
merged. | public ROI | performImageOp(RenderedImageFactory RIF, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints) Transforms an ROI using an imaging operation. | public ROI | performImageOp(String name, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints) Transforms an ROI using an imaging operation. | public void | setThreshold(int threshold) Sets the inclusion/exclusion threshold value. | public ROI | subtract(ROI roi) Subtracts another ROI from this one and returns the
result as a new ROI . | public ROI | transform(AffineTransform at, Interpolation interp) Performs an affine transformation and returns the result as a new
ROI. | public ROI | transform(AffineTransform at) Performs an affine transformation and returns the result as a new
ROI. |
theImage | transient PlanarImage theImage(Code) | | The PlanarImage representation of the ROI.
|
threshold | int threshold(Code) | | The inclusion/exclusion threshold of the ROI.
|
ROI | protected ROI()(Code) | | The default constructor.
Using this constructor means that the subclass must override
all methods that reference theImage.
|
ROI | public ROI(RenderedImage im)(Code) | | Constructs an ROI from a RenderedImage. The inclusion
threshold is taken to be halfway between the minimum and maximum
sample values specified by the image's SampleModel.
Parameters: im - A single-banded RenderedImage. throws: IllegalArgumentException - if im is null. throws: IllegalArgumentException - if im does not have exactly one band |
ROI | public ROI(RenderedImage im, int threshold)(Code) | | Constructs an ROI from a RenderedImage. The inclusion
threshold is specified explicitly.
Parameters: im - A single-banded RenderedImage. Parameters: threshold - The desired inclusion threshold. throws: IllegalArgumentException - if im is null. throws: IllegalArgumentException - if im does not have exactly one band |
add | public ROI add(ROI roi)(Code) | | Adds another ROI to this one and returns the result
as a new ROI . The supplied ROI will
be converted to a rendered form if necessary. The bounds of the
resultant ROI will be the union of the bounds of the
two ROI s being merged.
Parameters: roi - An ROI. throws: IllegalArgumentException - if roi is null. A new ROI containing the new ROI data. |
contains | public boolean contains(Point p)(Code) | | Returns true if the ROI contains a given Point.
Parameters: p - A Point identifying the pixel to be queried. throws: IllegalArgumentException - if p is null. true if the pixel lies within the ROI. |
contains | public boolean contains(Point2D p)(Code) | | Returns true if the ROI contains a given Point2D.
Parameters: p - A Point2D identifying the pixel to be queried. throws: IllegalArgumentException - if p is null. true if the pixel lies within the ROI. |
contains | public boolean contains(int x, int y)(Code) | | Returns true if the ROI contains the point (x, y).
Parameters: x - An int specifying the X coordinate of the pixel to be queried. Parameters: y - An int specifying the Y coordinate of the pixel to be queried. true if the pixel lies within the ROI. |
contains | public boolean contains(double x, double y)(Code) | | Returns true if the ROI contain the point (x, y).
Parameters: x - A double specifying the X coordinate of the pixelto be queried. Parameters: y - A double specifying the Y coordinate of the pixelto be queried. true if the pixel lies within the ROI. |
contains | public boolean contains(Rectangle rect)(Code) | | Returns true if a given Rectangle is
entirely included within the ROI.
Parameters: rect - A Rectangle specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if rect is null. true if the rectangle is entirelycontained within the ROI. |
contains | public boolean contains(Rectangle2D rect)(Code) | | Returns true if a given Rectangle2D is
entirely included within the ROI.
Parameters: rect - A Rectangle2D specifying the region to betested for inclusion. throws: IllegalArgumentException - if rect is null. true if the rectangle is entirely containedwithin the ROI. |
contains | public boolean contains(int x, int y, int w, int h)(Code) | | Returns true if a given rectangle (x, y, w, h) is entirely
included within the ROI.
Parameters: x - The int X coordinate of the upper left corner of the region. Parameters: y - The int Y coordinate of the upper left corner of the region. Parameters: w - The int width of the region. Parameters: h - The int height of the region. true if the rectangle is entirely containedwithin the ROI. |
contains | public boolean contains(double x, double y, double w, double h)(Code) | | Returns true if a given rectangle (x, y, w, h) is entirely
included within the ROI.
Parameters: x - The double X coordinate of the upper left corner of the region. Parameters: y - The double Y coordinate of the upper left corner of the region. Parameters: w - The double width of the region. Parameters: h - The double height of the region. true if the rectangle is entirelycontained within the ROI. |
exclusiveOr | public ROI exclusiveOr(ROI roi)(Code) | | Exclusive-ors the ROI with another ROI
and returns the result as a new ROI . The supplied
ROI will be converted to a rendered form if
necessary. The bounds of the resultant ROI will
be the union of the bounds of the two ROI s being
merged.
Parameters: roi - An ROI. throws: IllegalArgumentException - if roi is null. A new ROI containing the new ROI data. |
getAsBitmask | public int[][] getAsBitmask(int x, int y, int width, int height, int[][] mask)(Code) | | Returns a bitmask for a given rectangular region of the ROI
indicating whether the pixel is included in the region of
interest. The results are packed into 32-bit integers, with
the MSB considered to lie on the left. The last entry in each
row of the result may have bits that lie outside of the
requested rectangle. These bits are guaranteed to be zeroed.
The mask array, if supplied, must be of length
equal to or greater than height and each of its
subarrays must have length equal to or greater than (width +
31)/32. If null is passed in, a suitable array
will be constructed. If the mask is non-null but has
insufficient size, an exception will be thrown.
Parameters: x - The X coordinate of the upper left corner of the rectangle. Parameters: y - The Y coordinate of the upper left corner of the rectangle. Parameters: width - The width of the rectangle. Parameters: height - The height of the rectangle. Parameters: mask - A two-dimensional array of ints at least(width + 31)/32 entries wide and (height) entries tall,or null. A reference to the mask parameter, orto a newly constructed array if mask isnull . If the specified rectangle doesintersect with the image bounds then a null is returned. |
getAsImage | public PlanarImage getAsImage()(Code) | | Returns a PlanarImage representation of the
ROI . This method will always succeed. This method
returns a (bilevel) image whose SampleModel is an
instance of MultiPixelPackedSampleModel .
The ROI as a PlanarImage . |
getAsRectangleList | public LinkedList getAsRectangleList(int x, int y, int width, int height)(Code) | | Returns a LinkedList of Rectangle s
for a given rectangular region of the ROI. The
Rectangle s in the list are merged into a minimal
set.
Parameters: x - The X coordinate of the upper left corner of the rectangle. Parameters: y - The Y coordinate of the upper left corner of the rectangle. Parameters: width - The width of the rectangle. Parameters: height - The height of the rectangle. A LinkedList of Rectangle s.If the specified rectangle does intersect with the imagebounds then a null is returned. |
getAsRectangleList | protected LinkedList getAsRectangleList(int x, int y, int width, int height, boolean mergeRectangles)(Code) | | Returns a LinkedList of Rectangle s for
a given rectangular region of the ROI.
Parameters: x - The X coordinate of the upper left corner of the rectangle. Parameters: y - The Y coordinate of the upper left corner of the rectangle. Parameters: width - The width of the rectangle. Parameters: height - The height of the rectangle. Parameters: mergeRectangles - true if the Rectangle sare to be merged into a minimal set. A LinkedList of Rectangle s.If the specified rectangle does intersect with the imagebounds then a null is returned. |
getAsShape | public Shape getAsShape()(Code) | | Returns a Shape representation of the
ROI , if possible. If none is available, null is
returned. A proper instance of ROI (one that is not
an instance of any subclass of ROI ) will always
return null.
The ROI as a Shape . |
getBounds | public Rectangle getBounds()(Code) | | Returns the bounds of the ROI as a Rectangle .
|
getBounds2D | public Rectangle2D getBounds2D()(Code) | | Returns the bounds of the ROI as a Rectangle2D .
|
getThreshold | public int getThreshold()(Code) | | Returns the inclusion/exclusion threshold value.
|
intersect | public ROI intersect(ROI roi)(Code) | | Intersects the ROI with another ROI and returns the result as
a new ROI . The supplied ROI will be converted to a rendered
form if necessary. The bounds of the resultant ROI will be the
intersection of the bounds of the two ROI s being merged.
Parameters: roi - An ROI. throws: IllegalArgumentException - if roi is null. A new ROI containing the new ROI data. |
intersects | public boolean intersects(Rectangle rect)(Code) | | Returns true if a given Rectangle
intersects the ROI.
Parameters: rect - A Rectangle specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if rect is null. true if the rectangle intersects the ROI. |
intersects | public boolean intersects(Rectangle2D r)(Code) | | Returns true if a given Rectangle2D
intersects the ROI.
Parameters: r - A Rectangle2D specifying the region to be testedfor inclusion. throws: IllegalArgumentException - if r is null. true if the rectangle intersects the ROI. |
intersects | public boolean intersects(int x, int y, int w, int h)(Code) | | Returns true if a given rectangular region
intersects the ROI.
Parameters: x - The int X coordinate of the upper left corner of the region. Parameters: y - The int Y coordinate of the upper left corner of the region. Parameters: w - The int width of the region. Parameters: h - The int height of the region. true if the rectangle intersects the ROI. |
intersects | public boolean intersects(double x, double y, double w, double h)(Code) | | Returns true if a given rectangular region
intersects the ROI.
Parameters: x - The double X coordinate of the upper left corner of the region. Parameters: y - The double Y coordinate of the upper left corner of the region. Parameters: w - The double width of the region. Parameters: h - The double height of the region. true if the rectangle intersects the ROI. |
mergeRunLengthList | protected static LinkedList mergeRunLengthList(LinkedList rectList)(Code) | | Merge a LinkedList of Rectangle s
representing run lengths of pixels in the ROI into a minimal
list wherein vertically abutting Rectangle s are
merged. The operation is effected in place.
Parameters: rectList - The list of run length Rectangle s. throws: IllegalArgumentException - if rectList is null. The merged list. |
performImageOp | public ROI performImageOp(RenderedImageFactory RIF, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints)(Code) | | Transforms an ROI using an imaging operation. The operation is
specified by a RenderedImageFactory . The
operation's ParameterBlock , minus the image source
itself is supplied, along with an index indicating where to
insert the ROI image. The renderHints argument
allows rendering hints to be passed in.
Parameters: RIF - A RenderedImageFactory that will be usedto create the op. Parameters: paramBlock - A ParameterBlock containing allsources and parameters for the op except for the ROI itself. Parameters: sourceIndex - The index of the ParameterBlock 'ssources where the ROI is to be inserted. Parameters: renderHints - A RenderingHints object containingrendering hints, or null. throws: IllegalArgumentException - if RIF is null. throws: IllegalArgumentException - if paramBlock is null. |
performImageOp | public ROI performImageOp(String name, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints)(Code) | | Transforms an ROI using an imaging operation. The
operation is specified by name; the default JAI registry is
used to resolve this into a RIF. The operation's
ParameterBlock , minus the image source itself is supplied,
along with an index indicating where to insert the ROI image.
The renderHints argument allows rendering hints to
be passed in.
Parameters: name - The name of the operation to perform. Parameters: paramBlock - A ParameterBlock containing allsources and parameters for the op except for the ROI itself. Parameters: sourceIndex - The index of the ParameterBlock 'ssources where the ROI is to be inserted. Parameters: renderHints - A RenderingHints object containingrendering hints, or null. throws: IllegalArgumentException - if name is null. throws: IllegalArgumentException - if paramBlock is null. |
setThreshold | public void setThreshold(int threshold)(Code) | | Sets the inclusion/exclusion threshold value.
|
subtract | public ROI subtract(ROI roi)(Code) | | Subtracts another ROI from this one and returns the
result as a new ROI . The supplied ROI
will be converted to a rendered form if necessary. The
bounds of the resultant ROI will be the same as
this ROI .
Parameters: roi - An ROI. throws: IllegalArgumentException - if roi is null. A new ROI containing the new ROI data. |
transform | public ROI transform(AffineTransform at, Interpolation interp)(Code) | | Performs an affine transformation and returns the result as a new
ROI. The transformation is performed by an "Affine" RIF using the
indicated interpolation method.
Parameters: at - an AffineTransform specifying the transformation. Parameters: interp - the Interpolation to be used. throws: IllegalArgumentException - if at is null. throws: IllegalArgumentException - if interp is null. a new ROI containing the transformed ROI data. |
transform | public ROI transform(AffineTransform at)(Code) | | Performs an affine transformation and returns the result as a new
ROI. The transformation is performed by an "Affine" RIF using
nearest neighbor interpolation.
Parameters: at - an AffineTransform specifying the transformation. throws: IllegalArgumentException - if at is null. a new ROI containing the transformed ROI data. |
|
|