|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.ROI | +--javax.media.jai.ROIShape
A class representing a region of interest within an image as a
Shape
. Such regions are binary by definition. Using
a Shape
representation allows boolean operations to be
performed quickly and with compact storage. If a
PropertyGenerator
responsible for generating the
ROI
property of a particular
OperationDescriptor
(e.g., a warp) cannot reasonably
produce an ROIShape
representing the region, it should
call getAsImage()
on its sources and produce its
output ROI
in image form.
Constructor Summary | |
ROIShape(Area a)
Constructs an ROIShape from an Area. |
|
ROIShape(Shape s)
Constructs an ROIShape from a Shape. |
Method Summary | |
ROI |
add(ROI roi)
Adds another mask to this one. |
boolean |
contains(double x,
double y)
Returns true if the mask contains the point (x, y). |
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 mask. |
boolean |
contains(int x,
int y)
Returns true if the mask contains the point (x, y). |
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 mask. |
boolean |
contains(Point p)
Returns true if the mask contains a given Point. |
boolean |
contains(Point2D p)
Returns true if the mask contains a given Point2D. |
boolean |
contains(Rectangle rect)
Returns true if a given Rectangle is
entirely included within the mask. |
boolean |
contains(Rectangle2D rect)
Returns true if a given Rectangle2D
is entirely included within the mask. |
ROI |
exclusiveOr(ROI roi)
Sets the mask to its exclusive-or with another mask. |
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. |
PlanarImage |
getAsImage()
Returns the shape as a PlanarImage . |
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. |
Shape |
getAsShape()
Returns the internal Shape representation or null if a shape representation is not possible. |
Rectangle |
getBounds()
Returns the bounds of the mask as a Rectangle . |
Rectangle2D |
getBounds2D()
Returns the bounds of the mask as a Rectangle2D . |
ROI |
intersect(ROI roi)
Sets the mask to its intersection with another mask. |
boolean |
intersects(double x,
double y,
double w,
double h)
Returns true if a given rectangle (x, y, w, h)
intersects the mask. |
boolean |
intersects(int x,
int y,
int w,
int h)
Returns true if a given rectangle (x, y, w, h)
intersects the mask. |
boolean |
intersects(Rectangle r)
Returns true if a given Rectangle
intersects the mask. |
boolean |
intersects(Rectangle2D r)
Returns true if a given Rectangle2D
intersects the mask. |
ROI |
subtract(ROI roi)
Subtracts another mask from this one. |
ROI |
transform(AffineTransform at)
Transforms the current contents of the ROI by a
given AffineTransform . |
Methods inherited from class javax.media.jai.ROI |
getThreshold,
mergeRunLengthList,
performImageOp,
performImageOp,
setThreshold,
transform |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ROIShape(Shape s)
s
- A Shape.public ROIShape(Area a)
a
- An Area.Method Detail |
public Rectangle getBounds()
Rectangle
.public Rectangle2D getBounds2D()
Rectangle2D
.public boolean contains(Point p)
true
if the mask contains a given Point.p
- a Point specifying the coordinates of the pixel to be queried.true
if the pixel lies within the mask.public boolean contains(Point2D p)
true
if the mask contains a given Point2D.p
- A Point2D specifying the coordinates of the pixel
to be queried.true
if the pixel lies within the mask.public boolean contains(int x, int y)
true
if the mask contains the point (x, y).x
- An int specifying the X coordinate of the pixel to be queried.y
- An int specifying the Y coordinate of the pixel to be queried.true
if the pixel lies within the mask.public boolean contains(double x, double y)
true
if the mask contains the point (x, y).x
- A double specifying the X coordinate of the pixel
to be queried.y
- A double specifying the Y coordinate of the pixel
to be queried.true
if the pixel lies within the mask.public boolean contains(Rectangle rect)
true
if a given Rectangle
is
entirely included within the mask.rect
- A Rectangle
specifying the region to
be tested for inclusion.true
if the rectangle is
entirely contained within the mask.public boolean contains(Rectangle2D rect)
true
if a given Rectangle2D
is entirely included within the mask.rect
- A Rectangle2D
specifying the region to
be tested for inclusion.true
if the rectangle is entirely
contained within the mask.public boolean contains(int x, int y, int w, int h)
true
if a given rectangle (x, y, w, h) is entirely
included within the mask.x
- The int X coordinate of the upper left corner of the region.y
- The int Y coordinate of the upper left corner of the region.w
- The int width of the region.h
- The int height of the region.true
if the rectangle is entirely
contained within the mask.public boolean contains(double x, double y, double w, double h)
true
if a given rectangle (x, y, w, h) is entirely
included within the mask.x
- The double X coordinate of the upper left corner of the region.y
- The double Y coordinate of the upper left corner of the region.w
- The double width of the region.h
- The double height of the region.true
if the rectangle is entirely contained
within the mask.public boolean intersects(Rectangle r)
true
if a given Rectangle
intersects the mask.r
- A Rectangle
specifying the region to be tested for
inclusion.true
if the rectangle intersects the mask.public boolean intersects(Rectangle2D r)
true
if a given Rectangle2D
intersects the mask.r
- A Rectangle2D
specifying the region to be
tested for inclusion.true
if the rectangle intersects the mask.public boolean intersects(int x, int y, int w, int h)
true
if a given rectangle (x, y, w, h)
intersects the mask.x
- The int X coordinate of the upper left corner of the region.y
- The int Y coordinate of the upper left corner of the region.w
- The int width of the region.h
- The int height of the region.true
if the rectangle intersects the mask.public boolean intersects(double x, double y, double w, double h)
true
if a given rectangle (x, y, w, h)
intersects the mask.x
- The double X coordinate of the upper left corner of the region.y
- The double Y coordinate of the upper left corner of the region.w
- The double width of the region.h
- The double height of the region.true
if the rectangle intersects the mask.public ROI add(ROI roi)
roi
- A ROI.public ROI subtract(ROI roi)
roi
- A ROI.public ROI intersect(ROI roi)
roi
- A ROI.public ROI exclusiveOr(ROI roi)
roi
- A ROI.public Shape getAsShape()
ROI
as a Shape
.public PlanarImage getAsImage()
PlanarImage
. This requires
performing an antialiased rendering of the internal Shape.ROIShape
is (0, 0), the returned image is a
BufferedImage
of type TYPE_BYTE_BINARY wrapped as
a PlanarImage
. Otherwise, the returned image is a
(bilevel) TiledImage
whose SampleModel
is an instance of MultiPixelPackedSampleModel
.public ROI transform(AffineTransform at)
ROI
by a
given AffineTransform
.at
- An AffineTransform
object.public int[][] getAsBitmask(int x, int y, int width, int height, int[][] mask)
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.
x
- The X coordinate of the upper left corner of the rectangle.y
- The Y coordinate of the upper left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.mask
- A two-dimensional array of ints at least
(width + 31)/32 entries wide and (height) entries tall,
or null.mask
parameter, or
to a newly constructed array if mask
is
null
.public LinkedList getAsRectangleList(int x, int y, int width, int height)
LinkedList
of Rectangle
s
for a given rectangular region of the ROI. The
Rectangle
s in the list are merged into a minimal
set.x
- The X coordinate of the upper left corner of the rectangle.y
- The Y coordinate of the upper left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.LinkedList
of Rectangle
s.protected LinkedList getAsRectangleList(int x, int y, int width, int height, boolean mergeRectangles)
LinkedList
of Rectangle
s for
a given rectangular region of the ROI.x
- The X coordinate of the upper left corner of the rectangle.y
- The Y coordinate of the upper left corner of the rectangle.width
- The width of the rectangle.height
- The height of the rectangle.mergeRectangles
- true
if the Rectangle
s
are to be merged into a minimal set.LinkedList
of Rectangle
s.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |