Package com.xinapse.multisliceimage.roi
Class OpenSplineROI
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.SplineROI
com.xinapse.multisliceimage.roi.OpenSplineROI
- All Implemented Interfaces:
EditableOutlineROI
,LinearROI
,RegularROI
,RotatableROI
,StretchableROI
,Cloneable
public class OpenSplineROI
extends SplineROI
implements Cloneable, StretchableROI, RotatableROI, EditableOutlineROI, LinearROI, RegularROI
A Class representing a curved line on an image, represented by
a set of knots, with spline interpolators between the knots to define the shape of the curve.
-
Field Summary
Fields inherited from class com.xinapse.multisliceimage.roi.SplineROI
closed, sMax, xpts, xSpline, ypts, ySpline
Fields inherited from class com.xinapse.multisliceimage.roi.ROI
BUTTON_ICON_SIZE, handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
-
Constructor Summary
ConstructorDescriptionOpenSplineROI
(double[] x, double[] y, byte userColour, ROIState state, boolean checkIntegrity) Creates a newOpenSplineROI
with the specified knot points in mm coordinates.OpenSplineROI
(double[] x, double[] y, ROIState state) Creates a newOpenSplineROI
with the specified knot points in mm coordinates.OpenSplineROI
(SplineROI splineROI) Creates a newOpenSplineROI
with the positions of the knot points taken from the supplied SplineROI. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
alignKnots
(OpenSplineROI s1, OpenSplineROI s2, int nKnots) Aligns the knot points in a pair of OpenSplineROIs, so that there is spatial correspondence as far as possible across the knots.clone()
Returns a clone of thisROI
.static Icon
Returns an Icon that can be used for a button to create this type of ROI.getCopy()
Returns a copy of thisROI
.static InteractionType
Returns the type of interaction needed to create anOpenSplineROI
.Return a description of this type ofROI
.Point2D[]
getIntensityProfile
(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode) double
Returns the length of this ROI in mm.double
getLengthPix
(float pixelXSize, float pixelYSize) Returns the length of this ROI in image pixels.static String
getName()
Returns a descriptive name for this type of ROI.double
Returns zero - an Open Spline has no area.getStats
(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, MaskMode maskMode, double maskValue, PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode) Returns statistics about thisROI
, and (optionally) performs a masking operation.Creates a new CurvedLineROI that is close to the shape of this OpenSplineROI.toString()
Methods inherited from class com.xinapse.multisliceimage.roi.SplineROI
alignKnots, alignKnots, approximate, close, contains, deleteVertex, draw, drawInOrthoView, equals, flipHorizontal, flipVertical, getCentre, getCentroid, getCurvature, getCurvature, getFeret, getFollowingVisibleHandle, getKnotPoint, getKnotPoints, getLocation, getNormal, getNormal, getNPoints, getPerimeter, getPrecedingVisibleHandle, getPrincipalAxisAngle, getSMax, getTheta, getVertexHandles, hashCode, insertTwoVertices, interpolate, intersect, isClosed, move, move, moveVertex, recalculateSplines, reduce, removeFirstKnotPoint, removeLastKnotPoint, selfIntersects, set, setKnotPoint, setKnotPoints, setKnotPoints, setKnotPoints, setKnotPoints, setTheta
Methods inherited from class com.xinapse.multisliceimage.roi.ROI
andNot, andNot, andNot, clearDeletionHistory, dilate, exclusiveOr, exclusiveOr, getAnnotation, getBoundingRectangle, getBoundingRectangle, getCentroid, getClasses, getColor, getDesignTextFontSize, getDisplayedBounds2D, getDisplayedBounds2D, getDisplayedRoiArea, getFeret, getGroupUid, getGroupUid, getHandles, getHandleUnderPoint, getImageSource, getPixelValue, getROIs, getROIs, getROIs, getROIs, getROIs, getSlice, getState, getStats, getStats, getTextColor, getUserColour, group, intersect, intersect, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, logicalUnion, main, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setGroupUid, setSlice, setState, setTextColor, setTextSize, setUserColour, ungroup, ungroup, union, union, write, write
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.xinapse.multisliceimage.roi.EditableOutlineROI
deleteVertex, getFollowingVisibleHandle, getPrecedingVisibleHandle, getVertexHandles, insertTwoVertices, moveVertex
Methods inherited from interface com.xinapse.multisliceimage.roi.RotatableROI
getCentre, getTheta, setTheta
Methods inherited from interface com.xinapse.multisliceimage.roi.StretchableROI
getDisplayedBounds2D, move
-
Constructor Details
-
OpenSplineROI
Creates a newOpenSplineROI
with the specified knot points in mm coordinates.- Parameters:
x
- an array of x-coordinates for the knot points.y
- an array of y-coordinates for the knot points.state
- theROIState
of the newly-createdROI
.- Throws:
ROIException
- if the OpenSplineROI cannot be created as specified.
-
OpenSplineROI
public OpenSplineROI(double[] x, double[] y, byte userColour, ROIState state, boolean checkIntegrity) throws ROIException Creates a newOpenSplineROI
with the specified knot points in mm coordinates.- Parameters:
x
- an array of x-coordinates for the knot points.y
- an array of y-coordinates for the knot points.userColour
- the colour of this ROI. A value of 0 indicates that the ROI will be drawn with the default colour for normal ROIs if unselected.state
- theROIState
of the newly-createdROI
.checkIntegrity
- whether to check the integrity of the ROI.- Throws:
ROIException
- if the OpenSplineROI cannot be created as specified.
-
OpenSplineROI
Creates a newOpenSplineROI
with the positions of the knot points taken from the supplied SplineROI.- Parameters:
splineROI
- the SplineROI from which the knot point positions will be taken.- Throws:
ROIException
- if the OpenSplineROI cannot be created as specified.
-
-
Method Details
-
getSquareArea
public double getSquareArea()Returns zero - an Open Spline has no area.- Specified by:
getSquareArea
in interfaceRegularROI
- Returns:
- zero.
-
getLength
public double getLength()Description copied from 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 interfaceLinearROI
- 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 Point2D[] getIntensityProfile(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode) Description copied from interface:LinearROI
Returns an array ofPoint2D
representing the pixel intensities along thisLinearROI
. The x-value of a point is a position along theLinearROI
, and the y-value is the intensity. The first and last points will be at the ends of theLinearROI
, but the location of the points in between is not prescribed by this interface.- Specified by:
getIntensityProfile
in interfaceLinearROI
- Parameters:
pix
- the array of pixel intensities for in which thisLinearROI
is positioned.dataType
- thePixelDataType
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.
-
getStats
public ROIStats getStats(Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, MaskAction maskAction, MaskMode maskMode, double maskValue, PrintStream intensityOutputStream, boolean isUnitsMM, ComplexMode complexMode) Description copied from class:ROI
Returns statistics about thisROI
, and (optionally) performs a masking operation.- Overrides:
getStats
in classROI
- 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 thisROI
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; orMaskAction.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.
maskMode
- how much of a pixel must be inside ROIs for the pixel to be part of the mask.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 thisPrintStream
.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 forPixelDataType.COMPLEX
images. The statistics returned will correspond to the mode: the real part, imaginary part, magnitude or phase.- Returns:
- statistics about the ROI.
-
toIrregular
Creates a new CurvedLineROI that is close to the shape of this OpenSplineROI.- Overrides:
toIrregular
in classSplineROI
- Returns:
- a new CurvedLineROI that is close to the shape of this OpenSplineROI.
-
alignKnots
Aligns the knot points in a pair of OpenSplineROIs, so that there is spatial correspondence as far as possible across the knots.The number of knot points in each of the ROIs will be set to the specified number of knot points, and the knots will be evenly spaced in the s-parameter.
- Parameters:
s1
- the first OpenSplineROI to align.s2
- the second OpenSplineROI to align.nKnots
- the number of knot points in the aligned ROIs.- Throws:
ROIException
- if the ROIs cannot be aligned.
-
getCopy
Description copied from class:ROI
Returns a copy of thisROI
. The copy will be identical in shape and annotation as the original ROI, but with a history of that of a newly-created ROI. -
clone
Description copied from class:ROI
-
toString
Description copied from class:ROI
-
getDescription
Description copied from class:ROI
Return a description of this type ofROI
.- Overrides:
getDescription
in classSplineROI
- Returns:
- a String describing the type of this
ROI
.
-
getCreateInteractionType
Returns the type of interaction needed to create anOpenSplineROI
.- Returns:
- type of interaction needed to create an
OpenSplineROI
-InteractionType.CLICK_POINTS
.
-
getName
Returns a descriptive name for this type of ROI.- Returns:
- a String describing this type of ROI.
-
getButtonIcon
Returns an Icon that can be used for a button to create this type of ROI.- Returns:
- an Icon that can be used to represent this type of ROI.
-