jaitools.imageutils
Class ROIGeometry

java.lang.Object
  extended by javax.media.jai.ROI
      extended by jaitools.imageutils.ROIGeometry
All Implemented Interfaces:
Serializable

public class ROIGeometry
extends javax.media.jai.ROI

An ROI class that honours double precision coordinates when testing for inclusion.

Since:
1.1
Version:
$Id: ROIGeometry.java 1504 2011-03-05 10:56:10Z michael.bedward $
Author:
Michael Bedward, Andrea Aime
See Also:
Serialized Form

Constructor Summary
ROIGeometry(com.vividsolutions.jts.geom.Geometry geom)
          Constructor which takes a Geometry object to be used as the reference against which to test inclusion of image coordinates.
ROIGeometry(com.vividsolutions.jts.geom.Geometry geom, PixelCoordType coordType)
          Constructor which takes a Geometry object to be used as the reference against which to test inclusion of image coordinates.
 
Method Summary
 javax.media.jai.ROI add(javax.media.jai.ROI roi)
          Returns a new instance which is the union of this ROI and roi.
 boolean contains(double x, double y)
          Tests if this ROI contains the given image location.
 boolean contains(double x, double y, double w, double h)
          Tests if this ROI contains the given rectangle.
 boolean contains(int x, int y)
          Tests if this ROI contains the given image location.
 boolean contains(int x, int y, int w, int h)
          Tests if this ROI contains the given rectangle.
 boolean contains(Point p)
          Tests if this ROI contains the given point.
 boolean contains(Point2D p)
          Tests if this ROI contains the given point.
 boolean contains(Rectangle rect)
          Tests if this ROI contains the given rectangle.
 boolean contains(Rectangle2D rect)
          Tests if this ROI contains the given rectangle.
 javax.media.jai.ROI exclusiveOr(javax.media.jai.ROI roi)
          This method is not supported.
 int[][] getAsBitmask(int x, int y, int width, int height, int[][] mask)
          This method is not supported.
 com.vividsolutions.jts.geom.Geometry getAsGeometry()
          Returns the ROI as a JTS Geometry.
 javax.media.jai.PlanarImage getAsImage()
          Gets an image representation of this ROI using the VectorBinarize operation.
 LinkedList getAsRectangleList(int x, int y, int width, int height)
          This method is not supported.
protected  LinkedList getAsRectangleList(int x, int y, int width, int height, boolean mergeRectangles)
          This method is not supported.
 Shape getAsShape()
          Gets a new Shape representing this ROI.
 Rectangle getBounds()
          Gets the enclosing rectangle of this ROI.
 Rectangle2D getBounds2D()
          Gets the enclosing double-precision rectangle of this ROI.
 int getThreshold()
          This method is not supported.
 javax.media.jai.ROI intersect(javax.media.jai.ROI roi)
          Returns a new instance which is the intersection of this ROI and roi.
 boolean intersects(double x, double y, double w, double h)
          Tests if the given rectangle intersects with this ROI.
 boolean intersects(int x, int y, int w, int h)
          Tests if the given rectangle intersects with this ROI.
 boolean intersects(Rectangle rect)
          Tests if the given rectangle intersects with this ROI.
 boolean intersects(Rectangle2D rect)
          Tests if the given rectangle intersects with this ROI.
 javax.media.jai.ROI performImageOp(RenderedImageFactory RIF, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints)
          This method is not supported.
 javax.media.jai.ROI performImageOp(String name, ParameterBlock paramBlock, int sourceIndex, RenderingHints renderHints)
          This method is not supported.
 void setThreshold(int threshold)
          This method is not supported.
 javax.media.jai.ROI subtract(javax.media.jai.ROI roi)
          This method is not supported.
 javax.media.jai.ROI transform(AffineTransform at)
          Returns a new ROI created by applying the given transform to this ROI.
 javax.media.jai.ROI transform(AffineTransform at, javax.media.jai.Interpolation interp)
          Returns a new ROI created by applying the given transform to this ROI.
 
Methods inherited from class javax.media.jai.ROI
mergeRunLengthList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ROIGeometry

public ROIGeometry(com.vividsolutions.jts.geom.Geometry geom)
Constructor which takes a Geometry object to be used as the reference against which to test inclusion of image coordinates. The argument geom must be either a Polygon or MultiPolygon.

Using this constructor will result in pixel inclusion being tested with corner coordinates (equivalent to standard JAI pixel indexing).

Note: geom will be copied so subsequent changes to it will not be reflected in the ROIGeometry object.

Parameters:
geom - either a Polygon or MultiPolygon object defining the area(s) of inclusion.
Throws:
IllegalArgumentException - if theGeom is null or not an instance of either Polygon or MultiPolygon

ROIGeometry

public ROIGeometry(com.vividsolutions.jts.geom.Geometry geom,
                   PixelCoordType coordType)
Constructor which takes a Geometry object to be used as the reference against which to test inclusion of image coordinates. The argument geom must be either a Polygon or MultiPolygon.

Note: geom will be copied so subsequent changes to it will not be reflected in the ROIGeometry object.

Parameters:
geom - either a Polygon or MultiPolygon object defining the area(s) of inclusion.
coordType - type of pixel coordinates to use when testing for inclusion
Throws:
IllegalArgumentException - if theGeom is null or not an instance of either Polygon or MultiPolygon
Method Detail

add

public javax.media.jai.ROI add(javax.media.jai.ROI roi)
Returns a new instance which is the union of this ROI and roi. This is only possible if roi is an instance of ROIGeometry or ROIShape.

Overrides:
add in class javax.media.jai.ROI
Parameters:
roi - the ROI to add
Returns:
the union as a new instance
Throws:
UnsupportedOperationException - if roi is not an instance of ROIGeometry or ROIShape

contains

public boolean contains(Point p)
Tests if this ROI contains the given point.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
p - the point
Returns:
true if the point is within this ROI; false otherwise

contains

public boolean contains(Point2D p)
Tests if this ROI contains the given point.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
p - the point
Returns:
true if the point is within this ROI; false otherwise

contains

public boolean contains(int x,
                        int y)
Tests if this ROI contains the given image location.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
x - location X ordinate
y - location Y ordinate
Returns:
true if the location is within this ROI; false otherwise

contains

public boolean contains(double x,
                        double y)
Tests if this ROI contains the given image location.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
x - location X ordinate
y - location Y ordinate
Returns:
true if the location is within this ROI; false otherwise

contains

public boolean contains(Rectangle rect)
Tests if this ROI contains the given rectangle.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
rect - the rectangle
Returns:
true if the rectangle is within this ROI; false otherwise

contains

public boolean contains(Rectangle2D rect)
Tests if this ROI contains the given rectangle.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
rect - the rectangle
Returns:
true if the rectangle is within this ROI; false otherwise

contains

public boolean contains(int x,
                        int y,
                        int w,
                        int h)
Tests if this ROI contains the given rectangle.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
x - rectangle origin X ordinate
y - rectangle origin Y ordinate
w - rectangle width
h - rectangle height
Returns:
true if the rectangle is within this ROI; false otherwise

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Tests if this ROI contains the given rectangle.

Overrides:
contains in class javax.media.jai.ROI
Parameters:
x - rectangle origin X ordinate
y - rectangle origin Y ordinate
w - rectangle width
h - rectangle height
Returns:
true if the rectangle is within this ROI; false otherwise

exclusiveOr

public javax.media.jai.ROI exclusiveOr(javax.media.jai.ROI roi)
This method is not supported.

Overrides:
exclusiveOr in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

getAsBitmask

public int[][] getAsBitmask(int x,
                            int y,
                            int width,
                            int height,
                            int[][] mask)
This method is not supported.

Overrides:
getAsBitmask in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

getAsImage

public javax.media.jai.PlanarImage getAsImage()
Gets an image representation of this ROI using the VectorBinarize operation. For an ROI with very large bounds but simple shape(s) the resulting image has a small memory footprint.

Overrides:
getAsImage in class javax.media.jai.ROI
Returns:
a new image representing this ROI
See Also:
VectorBinarizeDescriptor

getAsRectangleList

public LinkedList getAsRectangleList(int x,
                                     int y,
                                     int width,
                                     int height)
This method is not supported.

Overrides:
getAsRectangleList in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

getAsRectangleList

protected LinkedList getAsRectangleList(int x,
                                        int y,
                                        int width,
                                        int height,
                                        boolean mergeRectangles)
This method is not supported.

Overrides:
getAsRectangleList in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

getAsShape

public Shape getAsShape()
Gets a new Shape representing this ROI.

Overrides:
getAsShape in class javax.media.jai.ROI
Returns:
the shape

getAsGeometry

public com.vividsolutions.jts.geom.Geometry getAsGeometry()
Returns the ROI as a JTS Geometry.

Returns:
the geometry

getBounds

public Rectangle getBounds()
Gets the enclosing rectangle of this ROI.

Overrides:
getBounds in class javax.media.jai.ROI
Returns:
a new rectangle

getBounds2D

public Rectangle2D getBounds2D()
Gets the enclosing double-precision rectangle of this ROI.

Overrides:
getBounds2D in class javax.media.jai.ROI
Returns:
a new rectangle

getThreshold

public int getThreshold()
This method is not supported.

Overrides:
getThreshold in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

intersect

public javax.media.jai.ROI intersect(javax.media.jai.ROI roi)
Returns a new instance which is the intersection of this ROI and roi. This is only possible if roi is an instance of ROIGeometry or ROIShape.

Overrides:
intersect in class javax.media.jai.ROI
Parameters:
roi - the ROI to intersect with
Returns:
the intersection as a new instance
Throws:
UnsupportedOperationException - if roi is not an instance of ROIGeometry or ROIShape

intersects

public boolean intersects(Rectangle rect)
Tests if the given rectangle intersects with this ROI.

Overrides:
intersects in class javax.media.jai.ROI
Parameters:
rect - the rectangle
Returns:
true if there is an intersection; false otherwise

intersects

public boolean intersects(Rectangle2D rect)
Tests if the given rectangle intersects with this ROI.

Overrides:
intersects in class javax.media.jai.ROI
Parameters:
rect - the rectangle
Returns:
true if there is an intersection; false otherwise

intersects

public boolean intersects(int x,
                          int y,
                          int w,
                          int h)
Tests if the given rectangle intersects with this ROI.

Overrides:
intersects in class javax.media.jai.ROI
Parameters:
x - rectangle origin X ordinate
y - rectangle origin Y ordinate
w - rectangle width
h - rectangle height
Returns:
true if there is an intersection; false otherwise

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Tests if the given rectangle intersects with this ROI.

Overrides:
intersects in class javax.media.jai.ROI
Parameters:
x - rectangle origin X ordinate
y - rectangle origin Y ordinate
w - rectangle width
h - rectangle height
Returns:
true if there is an intersection; false otherwise

performImageOp

public javax.media.jai.ROI performImageOp(RenderedImageFactory RIF,
                                          ParameterBlock paramBlock,
                                          int sourceIndex,
                                          RenderingHints renderHints)
This method is not supported.

Overrides:
performImageOp in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

performImageOp

public javax.media.jai.ROI performImageOp(String name,
                                          ParameterBlock paramBlock,
                                          int sourceIndex,
                                          RenderingHints renderHints)
This method is not supported.

Overrides:
performImageOp in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

setThreshold

public void setThreshold(int threshold)
This method is not supported.

Overrides:
setThreshold in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

subtract

public javax.media.jai.ROI subtract(javax.media.jai.ROI roi)
This method is not supported.

Overrides:
subtract in class javax.media.jai.ROI
Throws:
UnsupportedOperationException - if called

transform

public javax.media.jai.ROI transform(AffineTransform at,
                                     javax.media.jai.Interpolation interp)
Returns a new ROI created by applying the given transform to this ROI.

Overrides:
transform in class javax.media.jai.ROI
Parameters:
at - the transform
interp - ignored
Returns:
the new ROI

transform

public javax.media.jai.ROI transform(AffineTransform at)
Returns a new ROI created by applying the given transform to this ROI.

Overrides:
transform in class javax.media.jai.ROI
Parameters:
at - the transform
Returns:
the new ROI


Copyright © 2009-2011. All Rights Reserved.