Package com.xinapse.multisliceimage.roi
Class RadialDivider
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.RadialDivider
- All Implemented Interfaces:
Cloneable
A radial divider, for cardiac segental analysis.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The token written to ROI output files to represent the number of segments.static final String
The token written to ROI output files to represent the insertion point angle (in degrees).Fields inherited from class com.xinapse.multisliceimage.roi.ROI
BUTTON_ICON_SIZE, handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN
-
Constructor Summary
ConstructorDescriptionRadialDivider
(int physicalSlice, int nSegments, double theta, Integer endoEpicardiumSplitPercent) Creates a RadialDivider to be applied to one physical slice of a (possibly) multi-slice, multiple time-point dataset. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of thisROI
.boolean
Indicates whether thisRadialDivider
ROI contains anotherROI
entirely within its borders.dilate
(double radius, AtomicInteger opCounter, CancellableThread.Flag cancelFlag) Dilation of a RadialDivider has no effect.void
draw
(Graphics g, int imageSlice, int movieFrame, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, List<ROI> rois) Draws thisRadialDivider
if it needs to be be drawn on screen.void
drawInOrthoView
(Image orthoView, org.jogamp.vecmath.Point3f viewPosition, org.jogamp.java3d.Transform3D imageToViewTx, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled) Draws this ROI on top of an orthogonal view of an image.boolean
void
flipHorizontal
(Point2D flipPoint) This method does nothing.void
flipVertical
(Point2D flipPoint) This method does nothing.double[]
getAnnularThickness
(ROI[] rois, int nMeasuresPerSegment) Returns an array of annular thicknesses - one for each segment of this RadialDivider.org.jogamp.vecmath.Point2d
getCentre
(int movieFrame) Returns the centre position for this RadialDivider for the given movie frame number.org.jogamp.vecmath.Point2d
Returns null.getCopy()
Returns a copy of thisROI
.Return a description of this type ofROI
.static Color
Returns the Color to be used for drawing the end/epicardium divider.getFeret()
Returns zero.getHandleUnder
(Point mousePoint, int movieFrame) If the mouse is over the InsertionPointHandle, returns the InsertionPointHandle.getHollowROI
(ROI[] rois, int movieFrame) Returns the HollowROI that is formed from a pair of ROIs.static String
getName()
Returns a descriptive name for this type of ROI.int
Returns the number of segments.double
Returns zero.ROIStats[]
getStats
(ROI[] rois, int movieFrame, Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode) Returns an array of ROIStats - one for each segment, or two for each segment if there is an endo- epi-cardial split.double
getTheta()
Returns the insertion point angle.intersect
(ROI roi, IndeterminateProgressMonitor progressMonitor) Performs an intersection operation on the shape of this ROI with another ROI.boolean
Returns whether thisRadialDivider
is visible on screen.void
move
(double dx, double dy) This method does nothing.void
removeROIsUsed
(List<ROI> rois) From a List of ROIs, remove those used to create a HollowROI forming an annulus, which can then be used for segmental analysis using this RadialDivider.void
void
setEndoEpicardiumSplitPercent
(Integer endoEpicardiumSplitPercent) Sets the endo- epi-cardium split percentage.void
setNSegments
(int nSegments) Sets the number of segments.void
setTheta
(double theta) Sets the insertion point angle.void
Sets the insertion point angle, using the mouse location.toString()
Methods inherited from class com.xinapse.multisliceimage.roi.ROI
andNot, andNot, andNot, clearDeletionHistory, dilate, draw, 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, getStats, getTextColor, getUserColour, group, hashCode, 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
-
Field Details
-
THETA_TOKEN
The token written to ROI output files to represent the insertion point angle (in degrees).- See Also:
-
NSEG_TOKEN
The token written to ROI output files to represent the number of segments.- See Also:
-
-
Constructor Details
-
RadialDivider
public RadialDivider(int physicalSlice, int nSegments, double theta, Integer endoEpicardiumSplitPercent) Creates a RadialDivider to be applied to one physical slice of a (possibly) multi-slice, multiple time-point dataset. The RadialDivider will apply at all time points for the given physical slice.- Parameters:
physicalSlice
- the hysical slice to which this RadialDivider is to be applied.nSegments
- the number of segments for this RadialDivider.theta
- the initial insertion point angle.endoEpicardiumSplitPercent
- if non-null, the split percentage between endocardium and epicardium. The value refers to the percentage of endocardium.
-
-
Method Details
-
setNSegments
public void setNSegments(int nSegments) Sets the number of segments.- Parameters:
nSegments
- the number of segments.
-
getNSegments
public int getNSegments()Returns the number of segments.- Returns:
- the number of segments.
-
setTheta
public void setTheta(double theta) Sets the insertion point angle.- Parameters:
theta
- the insertion point angle.
-
setTheta
Sets the insertion point angle, using the mouse location.- Parameters:
mousePoint
- the location of the mouse on screen.movieFrame
- the cine frame number on which the insertion is being manipulated.
-
getCentre
public org.jogamp.vecmath.Point2d getCentre(int movieFrame) Returns the centre position for this RadialDivider for the given movie frame number.- Parameters:
movieFrame
- the cine movie frame number.- Returns:
- the position of the RadialDivider in the given movie frame.
-
getTheta
public double getTheta()Returns the insertion point angle.- Returns:
- the insertion point angle.
-
setEndoEpicardiumSplitPercent
Sets the endo- epi-cardium split percentage.- Parameters:
endoEpicardiumSplitPercent
- the split percentage, with zero being no endocardium, and 100 being no endocardium. Anull
value indicates that there should be no split.
-
getHollowROI
Returns the HollowROI that is formed from a pair of ROIs.- Parameters:
rois
- the array of ROIs, of length at least 2.movieFrame
- the cine movie frame to which the ROIs apply.- Returns:
- a HollowROI formed from a pair of ROIs.
- Throws:
ROIException
- if a HollowROI cannot be formed.
-
removeROIsUsed
From a List of ROIs, remove those used to create a HollowROI forming an annulus, which can then be used for segmental analysis using this RadialDivider.- Parameters:
rois
- the ROIs that include those used to create the annulus. The ROIs used will be removed from the List by this method.- Throws:
ROIException
- if an ROI-related error occurs.
-
getStats
public ROIStats[] getStats(ROI[] rois, int movieFrame, Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode) throws ROIException Returns an array of ROIStats - one for each segment, or two for each segment if there is an endo- epi-cardial split.- Parameters:
rois
- the ROIs from which an annulus will be formed.movieFrame
- the cine frame.pix
- the image pixels.dataType
- the data type of the image pixels.nCols
- the number of columns in the array of pixels.nRows
- the number of columns in the array of pixels.offset
- the ofset into the array of pixels at which to get the slice pixel values.pixelXSize
- the pixel width.pixelYSize
- the pixel height.complexMode
- if non-null, the complex calculation mode for complex images.- Returns:
- an array of ROIStats for the segments. If there is an endo- epi-cardial split, then the endocardial stats are the first in the array, followed by the epicardial stats.
- Throws:
ROIException
- if an ROI-related error occurs.
-
getAnnularThickness
Returns an array of annular thicknesses - one for each segment of this RadialDivider.- Parameters:
rois
- an array of length 2 - the ROIs from which an annulus will be formed.nMeasuresPerSegment
- the numbers of measures of thickness that will be measured for each segment.- Returns:
- an array of annular thicknesses - one element for each of the segments.
- Throws:
ROIException
- if an ROI-related error occurs.
-
set
Description copied from class:ROI
- Specified by:
set
in classROI
- Parameters:
roi
- the ROI from which the shape is set.- Throws:
ClassCastException
- if the sub-class of the argumentROI
is not the same as thisROI
.
-
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
.- Specified by:
getDescription
in classROI
- Returns:
- a String describing the type of this
ROI
.
-
getName
Returns a descriptive name for this type of ROI.- Returns:
- a String describing this type of ROI.
-
getFeret
Returns zero. -
getPerimeter
public double getPerimeter()Returns zero.- Specified by:
getPerimeter
in classROI
- Returns:
- zero.
-
getCentroid
public org.jogamp.vecmath.Point2d getCentroid()Returns null.- Specified by:
getCentroid
in classROI
- Returns:
- null.
-
getDividerColor
Returns the Color to be used for drawing the end/epicardium divider.- Returns:
- the Color of the end/epicardium divider.
-
isVisible
Returns whether thisRadialDivider
is visible on screen.- Parameters:
movieFrame
- the cine frame number.rois
- a List of ROIs that this RadialDivider divides.- Returns:
- whether this
RadialDivider
is visible on screen.
-
draw
public void draw(Graphics g, int imageSlice, int movieFrame, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, List<ROI> rois) throws ROIException Draws thisRadialDivider
if it needs to be be drawn on screen.- Parameters:
g
- the graphics context for the drawing operation.imageSlice
- the image physical slice number.movieFrame
- the cine frame number.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 thisROI
is defined.nRows
- the number of rows in the image on which thisROI
is defined.pixelXSize
- pixel width for the image on which thisROI
is defined.pixelYSize
- pixel height for the image on which thisROI
is defined.rois
- a List of ROIs that this RadialDivider divides.- Throws:
ROIException
- if an ROI-related error occurs.
-
drawInOrthoView
public void drawInOrthoView(Image orthoView, org.jogamp.vecmath.Point3f viewPosition, org.jogamp.java3d.Transform3D imageToViewTx, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled) Description copied from class:ROI
Draws this ROI on top of an orthogonal view of an image.- Specified by:
drawInOrthoView
in classROI
- Parameters:
orthoView
- theImage
into which the ROI is to be drawn.viewPosition
- the coordinates (col, row, slice position) of the orthogonal view in the original image.imageToViewTx
- theTransform3D
that maps original image pixel coordinates to pixel coordinates in the orthogonal view.nCols
- the number of columns in the original image.nRows
- the number of rows in the original image.nSlices
- the number of slices in the original image.pixelXSize
- the pixel width in the original image.pixelYSize
- the pixel height in the original image.filled
- whether the ROI should be drawn filled (effective only for ROIs that enclose an area).
-
getHandleUnder
If the mouse is over the InsertionPointHandle, returns the InsertionPointHandle.- Parameters:
mousePoint
- the location of the mouse.movieFrame
- the cine frame number.- Returns:
- the InsertionPointHandle over which the mouse is positioned, or null.
-
intersect
Description copied from class:ROI
Performs an intersection operation on the shape of this ROI with another ROI. -
flipVertical
This method does nothing.- Specified by:
flipVertical
in classROI
- Parameters:
flipPoint
- the point about which the ROI will be flipped.
-
flipHorizontal
This method does nothing.- Specified by:
flipHorizontal
in classROI
- Parameters:
flipPoint
- the point about which the ROI will be flipped.
-
move
public void move(double dx, double dy) This method does nothing. -
dilate
Dilation of a RadialDivider has no effect. The List of ROIs returned contains a copy of this RadialDivider.- Parameters:
radius
- the radius of dilation.opCounter
- a counter for the number of sub-operations that was performed to execute the dilation operation.cancelFlag
- a flag that, if set externally, cancels the operation.- Returns:
- a
List
containing a clone of this Text ROI.
-
contains
Indicates whether thisRadialDivider
ROI contains anotherROI
entirely within its borders. -
equals
Description copied from class:ROI
-