Package com.xinapse.multisliceimage.roi
Class ContourROI
java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.IrregularROI
com.xinapse.multisliceimage.roi.ContourROI
- All Implemented Interfaces:
EditableOutlineROI,RotatableROI,StretchableROI,Cloneable
A class for edge detection and contour following. A
ContourROI is an
IrregularROI formed by contour following, at a certain intensity level on an image
slice. The intensity level can be retrieved from the ContourROI using its
getLevel() method.
The points that form the vertices of a contour are generally on the boundaries between pixels (of the image on which the contour was formed). However, this depends on whether pixel snap is turned on.
A contour may be formed on any type of image.
For colour images (PixelDataType.RGB_BY_PLANE, PixelDataType.RGB_INTERLACED,
PixelDataType.COLOURPACKED) contouring is performed on the luminance value
(= (0.299 * Red) + (0.587 * Green) + (0.114 * Blue)). For PixelDataType.COMPLEX
images, contouring is performed on the real part, imaginary part, magnitude or phase of the
image, depending on the ComplexMode argument to the contouring method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe size of the area of pixels to search for the maximum gradient.Fields inherited from class com.xinapse.multisliceimage.roi.IrregularROI
nPoints, POINTSTOKEN, xpts, yptsFields inherited from class com.xinapse.multisliceimage.roi.ROI
BUTTON_ICON_SIZE, handles, PREFERENCES_NODE_NAME, XTOKEN, YTOKEN -
Method Summary
Modifier and TypeMethodDescriptionstatic IconReturns an Icon that can be used for a button to create this type of ROI.static InteractionTypeReturns the type of interaction needed to create aContourROI.Return a description of this type ofROI.static List<ContourROI>getInstances(Object pixels, PixelDataType dataType, ComplexMode complexMode, BitSet mask, int slice, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, double level, IntensityRelation intensityRelation, boolean pixelSnap, boolean snapCentre) Returns ajava.util.ListofContourROIs that form all the contours at a certain intensity level on a slice of pixels.getInstances(org.jogamp.vecmath.Point3i startPoint, ContourMode contourMode, double level, IntensityRelation intensityRelation, boolean threeDEdgeDetection, boolean threeDPropagation, short plusMinusSlices, Object pixels, PixelDataType dataType, ComplexMode complexMode, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, float pixelZSize, byte userColour, boolean pixelSnap, boolean snapCentre, ContourWorker contourWorker) Create aContourROIby contouring from a start point on the image.doublegetLevel()Returns the intensity level that thisContourROIfollowed.static StringgetName()Returns the name of the type of ROI.static voidRun the self-test on this class.Methods inherited from class com.xinapse.multisliceimage.roi.IrregularROI
clone, closestPoints, contains, containsVertex, deleteVertex, draw, drawInOrthoView, equals, erasePoints, flipHorizontal, flipVertical, getCentre, getCentroid, getCopy, getFeret, getFollowingVisibleHandle, getNormal, getNPoints, getPerimeter, getPrecedingVisibleHandle, getPrincipalAxisAngle, getTheta, getVertex, getVertexHandles, getVertices, hashCode, insertTwoVertices, intersect, join, makeConvex, makeConvex, move, move, moveVertex, orderPoints, removeSelfIntersections, selfIntersects, set, setTheta, setVertex, setVertices, setVertices, setVertices, setVertices, simplify, toSpline, toSpline, toStringMethods 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, getStats, getTextColor, getUserColour, group, intersect, intersect, intersects, isDeleted, isEditable, isGroup, isReloaded, isSameAnnotation, isSameColour, isSelected, join, logicalUnion, markDeleted, mmPosToPix, moveROIs, pixPosToMm, printStats, selectDeselect, setAnnotation, setCreationHistory, setGroupUid, setSlice, setState, setTextColor, setTextSize, setUserColour, ungroup, ungroup, union, union, write, writeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.xinapse.multisliceimage.roi.StretchableROI
getDisplayedBounds2D
-
Field Details
-
SEARCH_SIZE
public static final int SEARCH_SIZEThe size of the area of pixels to search for the maximum gradient. This will apply for images with square pixels (2-D search) or cubic (3-D search) voxels. For images with non-isotropic pixel size, the area searched will be approximately square or cubic, and the number of number of pixels searched will be adapted to make it so. Should be an odd number.- See Also:
-
-
Method Details
-
getLevel
public double getLevel()Returns the intensity level that thisContourROIfollowed.- Returns:
- the intensity level that this
ContourROIfollowed.
-
getCreateInteractionType
Returns the type of interaction needed to create aContourROI.- Returns:
- type of interaction needed to create a
ContourROI-InteractionType.CLICK.
-
getInstances
public static List<ROI> getInstances(org.jogamp.vecmath.Point3i startPoint, ContourMode contourMode, double level, IntensityRelation intensityRelation, boolean threeDEdgeDetection, boolean threeDPropagation, short plusMinusSlices, Object pixels, PixelDataType dataType, ComplexMode complexMode, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, float pixelZSize, byte userColour, boolean pixelSnap, boolean snapCentre, ContourWorker contourWorker) throws ROIException, CancelledException Create aContourROIby contouring from a start point on the image.- Parameters:
startPoint- the starting location (mouse click point, in image pixel coordinates) within the image slice from which edge detection or contour following is initiated.contourMode- theContourModefor finding the start point of the contour.level- the intensity level.intensityRelation- the intensity relationship between the contoured feature and the background.threeDEdgeDetection- whether edge detection should be in 3-D.threeDPropagation- whether contour propagation should be in 3-D.plusMinusSlices- for 3-D propagation, the maximum number of slices either side of the seed slice to propagate.pixels- the arrays of image intensity values.dataType- thePixelDataTypeof the image pixels.complexMode- theComplexModefor contouring onCompleximages.nCols- the number of columns in the image.nRows- the number of rows in the image.nSlices- the number of slices in the image.pixelXSize- the width of an image pixel.pixelYSize- the height of an image pixel.pixelZSize- the depth of an image pixel.userColour- an index into the palette of user-defined ROI colours.pixelSnap- whether to snap the contours to the nearest pixel corners/centres.snapCentre- if true, snap to the centre of pixels; if false snap to the corners.contourWorker- if non-null, a check is made ofcontourWorkerto see if creation of contours has been cancelled. Cancellation causes aCancelledExceptionto be thrown.- Returns:
- a
java.util.List<ContourROI>ofContourROIs representing the contour(s) generated from thestartPoint. For 2-D contouring, the list will contain a single contour. IfthreeDPropagationistrue, contours are propagated to adjacent slices, and the list contains all ROIs in all slices. - Throws:
ROIException- if contour following fails.CancelledException- if contouring is cancelled by the user, or programmatically.
-
getInstances
public static List<ContourROI> getInstances(Object pixels, PixelDataType dataType, ComplexMode complexMode, BitSet mask, int slice, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, double level, IntensityRelation intensityRelation, boolean pixelSnap, boolean snapCentre) Returns ajava.util.ListofContourROIs that form all the contours at a certain intensity level on a slice of pixels.- Parameters:
pixels- the 1-D array of pixels representing a 2- or more dimensional raster of intensities.dataType- thePixelDataTypeof the image pixels.complexMode- theComplexModefor contouring onPixelDataType.COMPLEXimages.mask- a binary mask of pixels to be considered for contouring.slice- the image slice on which the contours will be formed.nCols- the number of columns in the image.nRows- the number of rows in the image.pixelXSize- the width of an image pixel.pixelYSize- the height of an image pixel.userColour- an index into the palette of user-defined ROI colours.level- the intensity level of the contours.intensityRelation- the intensity relationship between the contoured feature and the background.pixelSnap- whether to snap the contours to the nearest pixel corners/centres.snapCentre- if true, snap to the centre of pixels; if false snap to the corners.- Returns:
- a
java.util.List<ROI>ofContourROIs that represent the contours on the image slice.
-
getDescription
Description copied from class:ROIReturn a description of this type ofROI.- Overrides:
getDescriptionin classIrregularROI- Returns:
- a String describing the type of this
ROI.
-
getName
Returns the name of the type of ROI.- Returns:
- the name "Contour".
-
main
Run the self-test on this class.- Parameters:
args- the program arguments. The first argument should be the name of an image for which contours will be created. Contour will only be created for the first slice of the image. The second argument should be the name of an ROI file for the ContourROIs created.
-
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.
-