com.xinapse.multisliceimage.roi
Class CurvedLineROI

java.lang.Object
  extended by com.xinapse.multisliceimage.roi.ROI
      extended by com.xinapse.multisliceimage.roi.IrregularROI
          extended by com.xinapse.multisliceimage.roi.CurvedLineROI
All Implemented Interfaces:
EditableOutlineROI, LinearROI, RegularROI, RotatableROI, StretchableROI, java.lang.Cloneable

public class CurvedLineROI
extends IrregularROI
implements LinearROI, RegularROI

A Class representing a curved line on an image.


Field Summary
 
Fields inherited from class com.xinapse.multisliceimage.roi.IrregularROI
nPoints, POINTSTOKEN, xpts, ypts
 
Fields inherited from class com.xinapse.multisliceimage.roi.ROI
handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
 
Constructor Summary
CurvedLineROI(double[] x, double[] y, int n, ROIState state)
          Creates a new CurvedLineROI with the coordinates of the points forming the line given by the x and y arrays in mm coordinates.
CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state)
          Creates a new CurvedLineROI with the coordinates of the points forming the line given by the List of points in image pixel coordinates.
 
Method Summary
 java.util.List<ROI> add(ROI roi)
          Morphologically adds an ROI to this ROI to create a new java.util.List<ROI> of ROIs that is the result of adding the shapes to the two ROIs.
 java.lang.Object clone()
          Returns a clone of this ROI.
 boolean contains(ROI roi)
          Indicates whether this CurvedLineROI contains another ROI entirely within its borders.
 boolean deleteVertex(Handle handle)
          Delete a point on the outline of this CurvedLineROI that is under a handle.
 boolean draw(java.awt.Graphics g, java.awt.Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean drawAnnotation)
          Draws this ROI if it needs to be be drawn on screen.
 boolean equals(java.lang.Object o)
          Indicates whether some Object is equal to this ROI.
 java.util.List<ROI> erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints, float size, int nCols, int nRows, float pixelXSize, float pixelYSize)
          Erase points from this ROI.
 java.util.List<ROI> exclusiveOr(ROI roi)
          Performs an exclusive OR operation on the shape of this ROI with another ROI.
static javax.swing.Icon getButtonIcon()
          Returns an Icon that can be used to create this type of ROI.
 ROI getCopy()
          Returns a copy of this ROI.
static InteractionType getCreateInteractionType()
          Returns the type of interaction needed to create a CurvedLineROI.
 java.lang.String getDescription()
          Return a description of this type of ROI.
 Handle getFollowingHandle(Handle handle)
          Returns the Handle that is immediately after the specified handle, in the order in which they were placed around the ROI.
 java.awt.geom.Point2D[] getIntensityProfile(java.lang.Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode)
          Returns an array of Point2D representing the pixel intensities along this LinearROI.
 double getLength()
          Returns the length of this ROI in mm.
 double getLengthPix(float pixelXSize, float pixelYSize)
          Returns the length of this ROI in image pixels.
static java.lang.String getName()
          Returns a descriptive name for this type of ROI.
 double getPerimeter()
          Returns the perimeter length of this ROI.
 Handle getPrecedingHandle(Handle handle)
          Returns the Handle that is immediately before the specified handle, in the order in which they were placed around the ROI.
 double getSquareArea()
          Returns zero - a curved line has no area.
 ROIStats getStats(java.lang.Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, double maskValue, java.io.PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode)
          Returns statistics about this ROI, and (optionally) performs a masking operation.
 int hashCode()
          Returns a hash code value for this CurvedLine ROI.
 boolean insertTwoVertices(Handle handle)
          Insert two points into the outline of this CurvedLineROI: one just before the one that is under a handle, and one just after.
 java.util.List<ROI> intersect(ROI roi)
          Performs an intersection operation on the shape of this ROI with another ROI.
 void makeConvex(CanAddROIToFrame canAddROIToFrame, float pixelXSize, float pixelYSize, float minConcaveRadius)
          Make this Irregular ROI convex, or at least less concave.
 void move(double dx, double dy)
          Move this ROI by specified distances (in mm) in the x and y directions.
 void moveVertex(java.awt.geom.Point2D newPos, Handle handle, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean pixelSnap)
          Move a point on the outline of this IrregularROI to a new position.
 java.util.List<ROI> subtract(ROI roi)
          Morphologically subtracts an ROI from this ROI to create a new java.util.List<ROI> of ROIs that is the result of subtracting the shapes to the two ROIs.
 
Methods inherited from class com.xinapse.multisliceimage.roi.IrregularROI
closestPoints, dilate, flipHorizontal, flipVertical, getCentre, getFeret, getNPoints, getTheta, getVertexHandles, getVertices, join, move, selfIntersects, set, setTheta, setVertices, setVertices, setVertices, toString
 
Methods inherited from class com.xinapse.multisliceimage.roi.ROI
add, clearDeletionHistory, clearStats, dilate, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCachedStatistics, getClasses, getColor, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getSlice, getState, getStats, getStats, getTextColor, getTextFontSize, getUserColour, isDeleted, isEditable, isReloaded, isSelected, join, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setSlice, setState, setTextColor, setTextSize, setUserColour, subtract, write, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xinapse.multisliceimage.roi.StretchableROI
getDisplayedBounds2D
 

Constructor Detail

CurvedLineROI

public CurvedLineROI(double[] x,
                     double[] y,
                     int n,
                     ROIState state)
              throws ROIException
Creates a new CurvedLineROI with the coordinates of the points forming the line given by the x and y arrays in mm coordinates.

Parameters:
x - an array of x-coordinates for the points forming the line.
y - an array of y-coordinates for the points forming the line.
n - the number points to be taken from the x and y arrays - must be less that or equal to then length of the smallest array.
state - the ROIState of the newly-created ROI.
Throws:
ROIException

CurvedLineROI

public CurvedLineROI(java.util.List<java.awt.geom.Point2D.Double> pointsList,
                     int nCols,
                     int nRows,
                     float pixelXSize,
                     float pixelYSize,
                     byte userColour,
                     ROIState state)
              throws ROIException
Creates a new CurvedLineROI with the coordinates of the points forming the line given by the List of points in image pixel coordinates.

Parameters:
pointsList - a List of points forming the line.
nCols - the number of columns in the image.
nRows - the number of rows in the image.
pixelXSize - the width of an image pixel in mm.
pixelYSize - the height of an image pixel in mm.
state - the ROIState of the newly-created ROI.
Throws:
ROIException
Method Detail

getCreateInteractionType

public static InteractionType getCreateInteractionType()
Returns the type of interaction needed to create a CurvedLineROI.

Returns:
type of interaction needed to create a CurvedLineROI - InteractionType.CLICK_OUTLINE.

move

public void move(double dx,
                 double dy)
Description copied from class: ROI
Move this ROI by specified distances (in mm) in the x and y directions.

Overrides:
move in class IrregularROI
Parameters:
dx - the distance to move in the x-direction.
dy - the distance to move in the y-direction.

getPrecedingHandle

public Handle getPrecedingHandle(Handle handle)
Description copied from interface: EditableOutlineROI
Returns the Handle that is immediately before the specified handle, in the order in which they were placed around the ROI.

Specified by:
getPrecedingHandle in interface EditableOutlineROI
Overrides:
getPrecedingHandle in class IrregularROI
Parameters:
handle - the handle for which to get the preceding handle.
Returns:
the preceding Handle, or null if there is no preceding handle.

getFollowingHandle

public Handle getFollowingHandle(Handle handle)
Description copied from interface: EditableOutlineROI
Returns the Handle that is immediately after the specified handle, in the order in which they were placed around the ROI.

Specified by:
getFollowingHandle in interface EditableOutlineROI
Overrides:
getFollowingHandle in class IrregularROI
Parameters:
handle - the handle for which to get the following handle.
Returns:
the following Handle, or null if there is no following handle.

moveVertex

public void moveVertex(java.awt.geom.Point2D newPos,
                       Handle handle,
                       int nCols,
                       int nRows,
                       float pixelXSize,
                       float pixelYSize,
                       boolean pixelSnap)
Description copied from class: IrregularROI
Move a point on the outline of this IrregularROI to a new position.

Specified by:
moveVertex in interface EditableOutlineROI
Overrides:
moveVertex in class IrregularROI
Parameters:
newPos - the new location of the vertex in pixel coordinates.
handle - the Handle that the user has grabbed, used to identify the vertex to be moved.
nCols - the number of image columns.
nRows - the number of image rows.
pixelXSize - the pixel width in mm.
pixelYSize - the pixel height in mm.
pixelSnap - whether pixel snap is turned on.

getSquareArea

public double getSquareArea()
Returns zero - a curved line has no area.

Specified by:
getSquareArea in interface RegularROI
Returns:
zero.

deleteVertex

public boolean deleteVertex(Handle handle)
Description copied from interface: EditableOutlineROI
Delete a point on the outline of this CurvedLineROI that is under a handle.

Specified by:
deleteVertex in interface EditableOutlineROI
Overrides:
deleteVertex in class IrregularROI
Parameters:
handle - the Handle that the user has grabbed, used to identify the vertex to be deleted.
Returns:
true if a point is successfully deleted.

insertTwoVertices

public boolean insertTwoVertices(Handle handle)
Description copied from interface: EditableOutlineROI
Insert two points into the outline of this CurvedLineROI: one just before the one that is under a handle, and one just after.

Specified by:
insertTwoVertices in interface EditableOutlineROI
Overrides:
insertTwoVertices in class IrregularROI
Parameters:
handle - the Handle that the user has grabbed, used to identify the vertex around which the new vertices are to be placed.
Returns:
true if a point is successfully inserted.

erasePoints

public java.util.List<ROI> erasePoints(java.util.List<java.awt.geom.Point2D> erasePoints,
                                       float size,
                                       int nCols,
                                       int nRows,
                                       float pixelXSize,
                                       float pixelYSize)
Description copied from interface: EditableOutlineROI
Erase points from this ROI. erasePoints may edit this ROI by deleting points, or it may split this ROI into two or more new ROIs. If more than one ROI is returned, then the (edited) original ROI will be in the list of returned ROIs, and will be the remaining ROI which is biggest (has the most points).

Specified by:
erasePoints in interface EditableOutlineROI
Overrides:
erasePoints in class IrregularROI
Parameters:
erasePoints - a List of points through which the erasing pen has passed.
size - the size of the erasing pen in mm.
nCols - the number of image columns.
nRows - the number of image rows.
pixelXSize - the pixel width in mm.
pixelYSize - the pixel height in mm.
Returns:
a List of ROIs resulting from the points erasure.

makeConvex

public void makeConvex(CanAddROIToFrame canAddROIToFrame,
                       float pixelXSize,
                       float pixelYSize,
                       float minConcaveRadius)
Description copied from interface: EditableOutlineROI
Make this Irregular ROI convex, or at least less concave. The supplied pixel sizes are used to decide on the separation between data points around the ROI. A minimum radius of curvature for concave radii of curvature is given. The action of making the ROI convex will be executed asynchronously using a javax.swing.SwingWorker that will update the ImageDisplayer when finished.

Specified by:
makeConvex in interface EditableOutlineROI
Overrides:
makeConvex in class IrregularROI
Parameters:
canAddROIToFrame - the CanAddROIToFrame to be updated when the operation is complete.
pixelXSize - the width of an image pixel in mm.
pixelYSize - the height of an image pixel in mm.
minConcaveRadius - the minimum radius of curvature for concave parts of this ROI.

getLength

public double getLength()
Description copied from interface: LinearROI
Returns the length of this ROI in mm.

Specified by:
getLength in interface LinearROI
Returns:
the length of this ROI in mm.

getLengthPix

public double getLengthPix(float pixelXSize,
                           float pixelYSize)
Description copied from interface: LinearROI
Returns the length of this ROI in image pixels.

Specified by:
getLengthPix in interface LinearROI
Parameters:
pixelXSize - the size of image pixels in the horizontal direction.
pixelYSize - the size of image pixels in the vertical direction.
Returns:
the length of this ROI in image pixels.

getIntensityProfile

public java.awt.geom.Point2D[] getIntensityProfile(java.lang.Object pix,
                                                   PixelDataType dataType,
                                                   int nCols,
                                                   int nRows,
                                                   int offset,
                                                   float pixelXSize,
                                                   float pixelYSize,
                                                   ComplexMode complexMode)
Description copied from interface: LinearROI
Returns an array of Point2D representing the pixel intensities along this LinearROI. The x-value of a point is a position along the LinearROI, and the y-value is the intensity. The first and last points will be at the ends of the LinearROI, but the location of the points in between is not prescribed by this interface.

Specified by:
getIntensityProfile in interface LinearROI
Parameters:
pix - the array of pixel intensities for in which this LinearROI is positioned.
dataType - the PixelDataType of the array of pixel intensities.
nCols - the number of columns in the slice.
nRows - the number of rows in the slice.
offset - an offset (in pixels) into the pixel value array for the starting pixel of the slice on which this ROI is defined.
pixelXSize - the size of image pixels in the horizontal direction.
pixelYSize - the size of image pixels in the vertical direction.
complexMode - the calculation mode for Complex images. The intensity profile returned will correspond to the mode: the real part, imaginary part, magnitude or phase.
Returns:
an array of Point2D representing the pixel intensities along this LinearROI.

getPerimeter

public double getPerimeter()
Returns the perimeter length of this ROI. The perimeter of a CurvedLineROI is defined as twice its length.

Overrides:
getPerimeter in class IrregularROI
Returns:
the perimeter length of this ROI.

add

public java.util.List<ROI> add(ROI roi)
Description copied from class: ROI
Morphologically adds an ROI to this ROI to create a new java.util.List<ROI> of ROIs that is the result of adding the shapes to the two ROIs.

Overrides:
add in class ROI
Parameters:
roi - the ROI to add.
Returns:
a List of ROIs that results from the addition of the shapes.

subtract

public java.util.List<ROI> subtract(ROI roi)
Description copied from class: ROI
Morphologically subtracts an ROI from this ROI to create a new java.util.List<ROI> of ROIs that is the result of subtracting the shapes to the two ROIs.

Overrides:
subtract in class ROI
Parameters:
roi - the ROI to add.
Returns:
a List of ROIs that results from the addition of the shapes.

intersect

public java.util.List<ROI> intersect(ROI roi)
Description copied from class: ROI
Performs an intersection operation on the shape of this ROI with another ROI.

Overrides:
intersect in class ROI
Parameters:
roi - the ROI with which to perform the intersection operation.
Returns:
a List of ROIs that result from the operation.

exclusiveOr

public java.util.List<ROI> exclusiveOr(ROI roi)
Description copied from class: ROI
Performs an exclusive OR operation on the shape of this ROI with another ROI.

Overrides:
exclusiveOr in class ROI
Parameters:
roi - the ROI with which to perform the XOR operation.
Returns:
a List of ROIs that result from the operation.

draw

public boolean draw(java.awt.Graphics g,
                    java.awt.Rectangle visibleRectangle,
                    int imageDrawCols,
                    int imageDrawRows,
                    int xOffset,
                    int yOffset,
                    int nCols,
                    int nRows,
                    float pixelXSize,
                    float pixelYSize,
                    boolean drawAnnotation)
Description copied from class: ROI
Draws this ROI if it needs to be be drawn on screen.

Overrides:
draw in class IrregularROI
Parameters:
g - the graphics context for the drawing operation.
visibleRectangle - the part of the image that can be seen on-screen.
imageDrawCols - width of the area in which this portion of the image is to be drawn.
imageDrawRows - height of the area in which this portion of the image is to be drawn.
xOffset - a horizontal offset for drawing operations.
yOffset - a vertical offset for drawing operations.
nCols - the number of columns in the image on which this ROI is defined.
nRows - the number of rows in the image on which this ROI is defined.
pixelXSize - pixel width for the image on which this ROI is defined.
pixelYSize - pixel height for the image on which this ROI is defined.
drawAnnotation - a flag to indicate whether annotation should be drawn.
Returns:
true if the ROI is visible and been drawn on screen; false otherwise.

getStats

public ROIStats getStats(java.lang.Object pix,
                         PixelDataType dataType,
                         int nCols,
                         int nRows,
                         int offset,
                         float pixelXSize,
                         float pixelYSize,
                         MaskAction maskAction,
                         double maskValue,
                         java.io.PrintStream intensityOutputStream,
                         boolean isUnitsMM,
                         ComplexMode complexMode)
                  throws ROIException
Description copied from class: ROI
Returns statistics about this ROI, and (optionally) performs a masking operation.

Overrides:
getStats in class ROI
Parameters:
pix - the whole image pixel value array. If pix is null, then the intensity-related stats will all be set to zero.
dataType - the type of pixels.
nCols - the number of columns in the slice.
nRows - the number of rows in the slice.
offset - an offset (in pixels) into the pixel value array for the starting pixel of the slice on which this ROI is defined.
pixelXSize - the size of image pixels in the horizontal direction.
pixelYSize - the size of image pixels in the vertical direction.
maskAction - one of:
  • MaskAction.NONE for no masking;
  • MaskAction.MASK_INSIDE to set pixel values to maskValue inside the shape; or
  • MaskAction.MASK_OUTSIDE to set the pixel values to maskValue outside the shape.
  • MaskAction.MASK_INSIDE_SOFT to perform soft masking inside the shape;
  • MaskAction.MASK_OUTSIDE_SOFT to perform soft masking outside the shape.
maskValue - the pixel value to set outside/inside the shape when performing masking ops.
intensityOutputStream - if non-null, pixel intensities within the ROI will be printed to this PrintStream.
isUnitsMM - true if the (x,y) coordinates of the pixel intensities are to be written in mm, false if the coordinates are to be writtn in pixel units.
complexMode - the calculation mode for PixelDataType.Complex images. The statistics returned will correspond to the mode: the real part, imaginary part, magnitude or phase.
Returns:
statistics about the ROI.
Throws:
ROIException - if an error occurs.

contains

public boolean contains(ROI roi)
Indicates whether this CurvedLineROI contains another ROI entirely within its borders. A CurvedLineROI never contains another ROI, since it has zero area.

Overrides:
contains in class IrregularROI
Parameters:
roi - the ROI to be tested for containment within this ROI.
Returns:
false always.

equals

public boolean equals(java.lang.Object o)
Description copied from class: ROI
Indicates whether some Object is equal to this ROI. To be equal, the Object must be an ROI of the same type, and of the same shape and location as this ROI.

Overrides:
equals in class IrregularROI
Parameters:
o - the Object to be tested for equality to this ROI.
Returns:
true if the supplied Object is an ROI of the same type, shape and location as this ROI; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this CurvedLine ROI.

Overrides:
hashCode in class IrregularROI
Returns:
a hash code value for this CurvedLine ROI.

getCopy

public ROI getCopy()
Description copied from class: ROI
Returns a copy of this ROI. The copy will be identical in shape and annotation as the original ROI, but with a history of that of a newly-created ROI.

Overrides:
getCopy in class IrregularROI
Returns:
a copy of this ROI, cast to an Object.

clone

public java.lang.Object clone()
Description copied from class: ROI
Returns a clone of this ROI. The copy will be identical in shape and annotation as the original ROI, and with a history identical to the cloned ROI.

Overrides:
clone in class IrregularROI
Returns:
a clone of this ROI, cast to an Object.

getDescription

public java.lang.String getDescription()
Description copied from class: ROI
Return a description of this type of ROI.

Overrides:
getDescription in class IrregularROI
Returns:
a String describing the type of this ROI.

getName

public static java.lang.String getName()
Returns a descriptive name for this type of ROI.

Returns:
a String describing this type of ROI.

getButtonIcon

public static javax.swing.Icon getButtonIcon()
Returns an Icon that can be used to create this type of ROI.

Returns:
an Icon that can be used to represent this type of ROI.


Copyright 2006-2008 Xinapse Systems Limited. All Rights Reserved.