Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ShapeRoi Class Reference
Inheritance diagram for ShapeRoi:
Roi

Public Member Functions

 ShapeRoi (Roi r)
 
 ShapeRoi (float[] shapeArray)
 
synchronized Object clone ()
 
ShapeRoi or (ShapeRoi sr)
 
ShapeRoi and (ShapeRoi sr)
 
ShapeRoi xor (ShapeRoi sr)
 
ShapeRoi not (ShapeRoi sr)
 
Roi[] getRois ()
 
boolean contains (int x, int y)
 
double getFeretsDiameter ()
 
double getLength ()
 
float[] getShapeAsArray ()
 
void draw (Graphics g)
 
void drawPixels ()
 
ImageProcessor getMask ()
 
- Public Member Functions inherited from Roi
 Roi (int x, int y, int width, int height)
 
 Roi (int x, int y, ImagePlus imp)
 
 Roi (int x, int y, int width, int height, ImagePlus imp)
 
void setLocation (int x, int y)
 
void setImage (ImagePlus imp)
 
int getType ()
 
int getState ()
 
double getLength ()
 
double getFeretsDiameter ()
 
Rectangle getBounds ()
 
Rectangle getBoundingRect ()
 
Polygon getPolygon ()
 
synchronized Object clone ()
 
void nudge (int key)
 
void nudgeCorner (int key)
 
void draw (Graphics g)
 
void drawPixels ()
 
boolean contains (int x, int y)
 
int isHandle (int sx, int sy)
 
void modifyRoi ()
 
ImageProcessor getMask ()
 
void endPaste ()
 
void abortPaste ()
 
double getAngle (int x1, int y1, int x2, int y2)
 
String getName ()
 
void setName (String name)
 
int getPasteMode ()
 
boolean isArea ()
 
String getTypeAsString ()
 
String toString ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Roi
static Color getColor ()
 
static void setColor (Color c)
 
static void setPasteMode (int transferMode)
 
static int getCurrentPasteMode ()
 
- Static Public Attributes inherited from Roi
static final int CONSTRUCTING =0
 
static final int RECTANGLE =0
 
static final int HANDLE_SIZE = 5
 
static final int NOT_PASTING = -1
 
static Roi previousRoi
 
- Protected Member Functions inherited from Roi
void grow (int xNew, int yNew)
 
void moveHandle (int ox, int oy)
 
void updateClipRect ()
 
void handleMouseDrag (int sx, int sy, int flags)
 
void mouseDownInHandle (int handle, int sx, int sy)
 
void handleMouseDown (int sx, int sy)
 
void handleMouseUp (int screenX, int screenY)
 
void showStatus ()
 
- Protected Attributes inherited from Roi
int type
 
int xMax
 
ImagePlus imp
 
ImageCanvas ic
 
int oldX
 
int clipX
 
ImagePlus clipboard
 
boolean constrain
 
boolean center
 
boolean updateFullWindow
 
double mag = 1.0
 
String name
 
ImageProcessor cachedMask
 
- Static Protected Attributes inherited from Roi
static Color ROIColor = Prefs.getColor(Prefs.ROICOLOR,Color.yellow)
 
static int pasteMode = Blitter.COPY
 

Detailed Description

A subclass of ij.gui.Roi (2D Regions Of Interest) implemented in terms of java.awt.Shape. A ShapeRoi is constructed from a ij.gui.Roi object, or as a result of logical operators (i.e., union, intersection, exclusive or, and subtraction) provided by this class. These operators use the package java.awt.geom as a backend.
This code is in the public domain.

Author
Cezar M.Tigaret c.tig.nosp@m.aret.nosp@m.@ucl..nosp@m.ac.u.nosp@m.k

Definition at line 20 of file ShapeRoi.java.

Constructor & Destructor Documentation

ShapeRoi ( Roi  r)
inline

Constructs a ShapeRoi from an Roi.

Definition at line 79 of file ShapeRoi.java.

ShapeRoi ( float[]  shapeArray)
inline

Constructs a ShapeRoi from an array of variable length path segments. Each segment consists of the segment type followed by 0-3 end points and control points. Depending on the type, a segment uses from 1 to 7 elements of the array.

Definition at line 120 of file ShapeRoi.java.

Member Function Documentation

ShapeRoi and ( ShapeRoi  sr)
inline

Unary intersection operator. The caller is set to its intersection with the argument (i.e., the overlapping regions between the operands).

Returns
the overlapping regions between this and sr

Definition at line 182 of file ShapeRoi.java.

synchronized Object clone ( )
inline

Returns a deep copy of this.

Definition at line 144 of file ShapeRoi.java.

boolean contains ( int  x,
int  y 
)
inline

Checks whether the specified coordinates are inside a on this ROI's shape boundaries.

Definition at line 521 of file ShapeRoi.java.

void draw ( Graphics  g)
inline

Non-destructively draws the shape of this object on the associated ImagePlus.

Definition at line 943 of file ShapeRoi.java.

void drawPixels ( )
inline

Draws the shape of this object onto the associated ImagePlus.
This method will always draw a flattened version of the actual shape (i.e., all curve segments will be approximated by line segments).

Definition at line 982 of file ShapeRoi.java.

double getFeretsDiameter ( )
inline

Returns the maximum Feret diameter (i.e., the largest distance between the shape's boundaries).
This method returns the maximum between the width or height of the bounding rectangles of the rotating shape with one degree up to 270 degres, which effectively means the maximum of its projections in R2.

Definition at line 531 of file ShapeRoi.java.

double getLength ( )
inline

Returns the minimum Feret diameter (i.e., the smallest distance between the shape's boundaries).
This method returns the minimum between the width or height of the bounding rectangles of the rotating shape with one degree up to 270 degres, which effectively means the minimum of its projections in R2.Returns the length of this shape (perimeter, if shape is closed).

Definition at line 592 of file ShapeRoi.java.

ImageProcessor getMask ( )
inline

Returns this ROI's mask pixels as a ByteProcessor with pixels "in" the mask set to white (255) and pixels "outside" the mask set to black (0).

Definition at line 1019 of file ShapeRoi.java.

Roi [] getRois ( )
inline

Converts a Shape into Roi object(s).
This method parses the shape into (possibly more than one) Roi objects and returns them in an array.
A simple, "regular" path results in a single Roi following these simple rules:

<col><col> <thead>

Shape type

Roi class

Roi type </thead> <tbody>

java.awt.geom.Rectangle2D.Double

ij.gui.Roi

Roi.RECTANGLE

java.awt.geom.Ellipse2D.Double

ij.gui.OvalRoi

Roi.OVAL

java.awt.geom.Line2D.Double

ij.gui.Line

Roi.LINE

java.awt.Polygon

ij.gui.PolygonRoi

Roi.POLYGON </tbody>



Each subpath of a java.awt.geom.GeneralPath is converted following these rules:

<col><col><col><col><col> <thead>

Segment
types

Number of
segments

Closed
path

Value of
forceAngle

Value of
forceTrace

Roi type </thead> <tbody>

lines only:

0

ShapeRoi.NO_TYPE

1

ShapeRoi.NO_TYPE

2

Y

ShapeRoi.NO_TYPE

N

Roi.LINE

3

Y

N

Roi.POLYGON

N

Y

Roi.ANGLE

N

N

Roi.POLYLINE

4

Y

</td

Roi.RECTANGLE

N

Roi.POLYLINE

<= MAXPOLY

Y

Roi.POLYGON

N

Roi.POLYLINE

> MAXPOLY

Y

Y

Roi.TRACED_ROI

N

Roi.FREEROI

N

Roi.FREELINE

anything
else:

<= 2

ShapeRoi.NO_TYPE

> 2

ShapeRoi.SHAPE_ROI </tbody>

Returns
an array of ij.gui.Roi objects.

Definition at line 399 of file ShapeRoi.java.

float [] getShapeAsArray ( )
inline

Retrieves the end points and control points of the path as a float array. The array contains a sequence of variable length segments that use from from one to seven elements. The first element of a segment is the type as defined in the PathIterator interface. SEG_MOVETO and SEG_LINETO segments also include two coordinates, SEG_QUADTO segments include four coordinates and SEG_CUBICTO segments include six coordinates.

Definition at line 731 of file ShapeRoi.java.

ShapeRoi not ( ShapeRoi  sr)
inline

Unary subtraction operator. The caller is set to the result of the operation between the operands.

Returns
this subtracted from sr

Definition at line 194 of file ShapeRoi.java.

ShapeRoi or ( ShapeRoi  sr)
inline

Unary union operator. The caller is set to its union with the argument.

Returns
the union of this and sr

Definition at line 175 of file ShapeRoi.java.

ShapeRoi xor ( ShapeRoi  sr)
inline

Unary exclusive or operator. The caller is set to the non-overlapping regions between the operands.

Returns
the union of the non-overlapping regions of this and sr

Definition at line 188 of file ShapeRoi.java.


The documentation for this class was generated from the following file: