|
|||||||||
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.IllegalArgumentException
- if s is null.public ROIShape(Area a)
a
- An Area.Method Detail |
public Rectangle getBounds()
Rectangle
.getBounds
in class ROI
public Rectangle2D getBounds2D()
Rectangle2D
.getBounds2D
in class ROI
public boolean contains(Point p)
true
if the mask contains a given Point.contains
in class ROI
p
- a Point specifying the coordinates of the pixel to be queried.true
if the pixel lies within the mask.IllegalArgumentException
- is p is null.public boolean contains(Point2D p)
true
if the mask contains a given Point2D.contains
in class ROI
p
- A Point2D specifying the coordinates of the pixel
to be queried.true
if the pixel lies within the mask.IllegalArgumentException
- is p is null.public boolean contains(int x, int y)
true
if the mask contains the point (x, y).contains
in class ROI
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).contains
in class ROI
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.contains
in class ROI
rect
- A Rectangle
specifying the region to
be tested for inclusion.true
if the rectangle is
entirely contained within the mask.IllegalArgumentException
- is rect is null.public boolean contains(Rectangle2D rect)
true
if a given Rectangle2D
is entirely included within the mask.contains
in class ROI
rect
- A Rectangle2D
specifying the region to
be tested for inclusion.true
if the rectangle is entirely
contained within the mask.IllegalArgumentException
- is rect is null.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.contains
in class ROI
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.contains
in class ROI
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.intersects
in class ROI
r
- A Rectangle
specifying the region to be tested for
inclusion.true
if the rectangle intersects the mask.IllegalArgumentException
- is r is null.public boolean intersects(Rectangle2D r)
true
if a given Rectangle2D
intersects the mask.intersects
in class ROI
r
- A Rectangle2D
specifying the region to be
tested for inclusion.true
if the rectangle intersects the mask.IllegalArgumentException
- is r is null.public boolean intersects(int x, int y, int w, int h)
true
if a given rectangle (x, y, w, h)
intersects the mask.intersects
in class ROI
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.intersects
in class ROI
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)
add
in class ROI
roi
- A ROI.IllegalArgumentException
- is roi is null.public ROI subtract(ROI roi)
subtract
in class ROI
roi
- A ROI.IllegalArgumentException
- is roi is null.public ROI intersect(ROI roi)
intersect
in class ROI
roi
- A ROI.IllegalArgumentException
- is roi is null.public ROI exclusiveOr(ROI roi)
exclusiveOr
in class ROI
roi
- A ROI.IllegalArgumentException
- is roi is null.public Shape getAsShape()
getAsShape
in class ROI
javax.media.jai.ROI
ROI
as a Shape
.public PlanarImage getAsImage()
PlanarImage
. This requires
performing an antialiased rendering of the internal Shape.getAsImage
in class ROI
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
.transform
in class ROI
at
- An AffineTransform
object.IllegalArgumentException
- if at is null.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.
getAsBitmask
in class 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.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.getAsRectangleList
in class 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.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.getAsRectangleList
in class 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 |