Package gov.nih.mipav.model.structures
Class VOI
java.lang.Object
gov.nih.mipav.model.structures.ModelSerialCloneable
gov.nih.mipav.model.structures.VOI
- All Implemented Interfaces:
Serializable,Cloneable
This the Volume Of Interest (VOI) structure. An image can have 32565 different VOIs. A VOI can have multiple contours
in a single slice or in other slices. VOIs can be additive or subtractive so that doughnut like objects can be made.
A VOI can be different types: annotation, point, line, protractor, polyline and contour.
Event-handling routines:
to add this object to send out events for listening objects, at least the following 3 methods must be present: addListener, removeListener, fireEvent as present below.
- Version:
- 0.1 Oct 27, 1997
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanstatic final intMask as ones - i.e. put ones to indicate VOI locationstatic final intIndicates that the VOI is of type ANNOTATION for adding text annotations to an image.static final intStatic Variables for VOI and VOI Contour selection.static final intStatic Variables for VOI and VOI Contour selection.static final intIndicates only the boundary of the VOI should be displayed.private booleanIf true the bounding box of the VOI should be displayed.static final intIndicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.private ColorIndicates the color or the VOI.static final intIndicates that the VOI is of type CONTOUR.private ViewJFrameGraphViewJFrameGraph for graphing contours in this VOIprivate VOIBaseVectorA vector array of curves per slice.private intIndicates the type of VOI (i.e.private intIndicates if the VOI should be shown as a boundary or a solid.private Stringextension of voi file name of voi was read in through fileprivate booleanIf true the VOI cannot be moved, if false this VOI can be moved.static final intStatic Variables for VOI and VOI Contour selection.static final intStatic Variables for VOI and VOI Contour selection.private shortID of the VOI, also used when choosing the display color.private floatSets the maximum intensity value for operations on B invalid input: '&' W images segmented by this VOIprivate floatSets the maximum blue intensity value for operations on RGB images segmented by this VOIprivate floatSets the maximum green intensity value for operations on RGB images segmented by this VOIprivate floatSets the maximum red intensity value for operations on RGB images segmented by this VOIprivate floatSets the minimum intensity value for operations on B invalid input: '&' W images segmented by this VOIprivate floatSets the minimum blue intensity value for operations on RGB images segmented by this VOIprivate floatSets the minimum green intensity value for operations on RGB images segmented by this VOIprivate floatSets the minimum red intensity value for operations on RGB images segmented by this VOIstatic final intIndicates that the VOI is of type Line made up of two points.VOIListeners that are updated when this VOI changesprivate StringName of the VOI stored as a string.final intint indicating that no point was found.private floatWhen in the solid display mode indicates how opaque the VOI should be.static final intIndicates that the POINT is of type Line made up of a single point.private intIndicates if the VOI should mask ones or mask as zeros.static final intIndicates that the VOI is of type POLYLINE type of contour - end points NOT connected.static final intIndicates that the VOI is of type POLYLINE that will go through more than one slice.private booleanIf true this flag indicates that the VOI should be included (applied) when processing the image.static final intIndicates that the VOI is of type PROTRACTOR used to measure angles.private static final longUse serialVersionUID for interoperability.static final intIndicates that the VOI should be displayed as a solid and not just a boundary.static final intMask as zeros - i.e. put zeros to indicate where the VOI is locatedprivate intThe thickness of the VOI linesprivate intUnique ID for saving invalid input: '&' retrieving.private booleanIf true the VOI is visible.private shortUsed to objects a label or ID inconjuction with the watershed algorithm.private float[]The x - dimension bounds: xBounds [0] = min and xBounds[1] = max.private float[]The y - dimension bounds: yBounds [0] = min and yBounds[1] = max.private float[]The z - dimension bounds: zBounds [0] = min and zBounds[1] = max. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a VOI with the given id and name.Constructs a Volume of Interest (VOI).Constructs a Volume of Interest (VOI).Copies the VOI into a new VOI object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVOIListener(VOIListener listener) adds the update listener.doublearea()Finds the area of the entire VOI of the VOIContour type only.doublecalcLargestDistance(BitSet mask, int[] extents, float[] res) Calculate the distance of the largest line segment contained entirely within the VOIstatic doublecalcLargestDistance(BitSet mask, int[] extents, float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts, WildMagic.LibFoundation.Mathematics.Vector3f kPos1, WildMagic.LibFoundation.Mathematics.Vector3f kPos2) clone()Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)voidcreateActiveContourBinaryMask(BitSet mask, int xDim, int yDim) Creates a binary mask at every slice.voidcreateBinaryImage(ModelImage image, boolean XOR, boolean onlyActive) Forms a binary representation of the VOI into the image.createBinaryMask(int xDim, int yDim, int slice) Creates a binary mask at a slice for that slice only.createBinaryMask(int xDim, int yDim, int slice, VOIBase contour) Creates a binary mask at a slice for that slice and element only.voidcreateBinaryMask(int xDim, int yDim, int slice, BitSet mask, boolean XOR, boolean onlyActive) Creates a binary mask at a slice.voidcreateBinaryMask3D(BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive) Creates a 3D binary mask.voidcreateOneElementBinaryMask3D(BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive, int elementNum) Creates a 3D binary mask.voidcreateShortImage(ModelImage image, int offset, boolean XOR, boolean onlyActive) Creates a short image of the VOI.short[]createShortMask(short[] mask, int xDim, int yDim, int zDim, boolean XOR) Creates a short mask at a slice.voidcreateUByteImage(ModelImage image, int offset, boolean XOR, boolean onlyActive) Creates a short image of the VOI.private static double[]determineMaxAvg(float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts) Gathers max and average statistics to build guessing intervalsvoiddispose()booleantwo VOIs are the same if they have the same name.WildMagic.LibFoundation.Mathematics.Vector3f[]Get Vector3fs from the VOI; can only use with Point.WildMagic.LibFoundation.Mathematics.Vector3fReturns the first point.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> exportPoints(int slice) Get Vector3fs from the VOI; can only use with Point.exportPolygon(int iSlice) voidfinalize()private WildMagic.LibFoundation.Mathematics.Vector3ffindMaxWidth(WildMagic.LibFoundation.Mathematics.Vector3f pt, double[] maxDistance, boolean bOnlyActive) This is used by the method maxWidth.protected voidfireVOIBaseAdded(VOIBase curve) Fires a VOI event based on the VOI. calls the listener'saddedVOI()method.protected voidfireVOIBaseRemoved(VOIBase curve) Fires a VOI event based on the VOI. calls the listener'sremovedVOI()method.protected voidfireVOIColorChange(Color color) Deprecated.protected voidFires a VOI event based on the VOI. calls the listener'sremovedVOI()method.private static voidgatherBoundedPoints(ArrayList<Integer> orig, ArrayList<Integer> term, double lowerBound, double upperBound, float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts) Gathers the points that fall within the required boundsbooleanAccessor that returns the bounding box flag.voidgetBounds(float[] x, float[] y, float[] z) Calculates the extents or boundary of the voi in x, y, and z.voidgetBounds(int[] x, int[] y, int[] z) Calculates the extents or boundary of the voi in x, y, and z.getColor()Accessor that returns the VOI's color.Returns the contour graph associated with this voi.Accessor that returns the curves making up the VOI.intAccessor that returns the curve type.intAccessor that returns the display mode.Accessor that returns the VOI extension.WildMagic.LibFoundation.Mathematics.Vector3fReturns the geometric center of the VOI (only contour).shortgetID()Accessor that returns the ID.private static doublegetLargest(BitSet mask, int[] extents, ArrayList<Integer> orig, ArrayList<Integer> term, float xRes, float yRes, float zRes, float[] xPoints, float[] yPoints, float[] zPoints, WildMagic.LibFoundation.Mathematics.Vector3f kPos1, WildMagic.LibFoundation.Mathematics.Vector3f kPos2) Finds the largest line that lies within entirely within the VOI.floatAccessor that returns the maximum of the range of intensities to ignore.floatAccessor that returns the maximum of the range of blue intensities to ignore.floatAccessor that returns the maximum of the range of green intensities to ignore.floatAccessor that returns the maximum of the range of red intensities to ignore.floatAccessor that returns the minimum of the range of intensities to ignore.floatAccessor that returns the minimum of the range of blue intensities to ignore.floatAccessor that returns the minimum of the range of green intensities to ignore.floatAccessor that returns the minimum of the range of red intensities to ignore.getName()Accessor that returns the name of the VOI.intGet the number of points in the VOI file.floatAccessor that returns the opacity of the VOI.voidgetPointCoordinates(float[] coord) This method is used to get the coordinates of a single VOIPoint.intAccessor that returns.intgetPositionAndIntensity(int slice, int contourNo, WildMagic.LibFoundation.Mathematics.Vector3f[] position, float[] intensity, float[] imageBuffer, int xDim) Gets the position and intensity for this VOI if it's a line.booleanAccessor that returns whether voi is included in processing.intgetSize()Returns the number of contours in this VOI.getSliceCurves(int iSlice) Returns a list of contours on a given slice.getSliceCurves(int iPlane, int iSlice) Returns a list of contours for the given image orientation and slice.intgetSliceSize(int iSlice) Returns the number of contours for a given slice.intgetSliceSize(int iPlane, int iSlice) Returns the number of contours for a given image orientation and slice in a 3D image.getSortedCurves(int iDim) Sorts the contours based on the image default orientation.getSortedCurves(int iPlane, int iDim) Sorts the contours based on a given image orientation and the desired image depth for that orientation.intReturns the thickness of the VOIintgetUID()Accessor that returns the Unique ID (original hash code for object).intReturns the number of z slices actually containing part of the voishortgetWatershedID - accessor that returns the watershedID.booleanhasListener(VOIListener listener) importCurve(float[] x, float[] y, float[] z) Imports a new curve into this voi.voidimportCurve(int[] x, int[] y, int[] z) voidimportCurve(VOIBase curve) Imports the curve into the VOI.voidimportCurve(WildMagic.LibFoundation.Mathematics.Vector3f[] pt) Imports the curve into the VOI, testing for which type.voidimportNewVOI(int slice, int voiSlice, VOI voi, boolean resize) Imports just the VOIs in a slice into this VOI.voidimportPoint(WildMagic.LibFoundation.Mathematics.Vector3f point) Import a new point into this VOI.voidimportPoint(WildMagic.LibFoundation.Mathematics.Vector3f point, boolean notifyListener) Import a new point into this VOI.voidimportPolygon(Polygon gon, int slice) Imports the polygon into the VOI (must be a contour).booleanisActive()Accessor that tells if the VOI is active.booleanReturns true iff all contours in this VOI are active.booleanisEmpty()Test whether or not the VOI is empty.booleanisFixed()Accessor that tells if VOI is fixed.booleanAccessor that tells if the VOI is visible.WildMagic.LibFoundation.Mathematics.Vector3f[]maxWidth(boolean bOnlyActive) Finds 2 points that form the maximum width of the VOI.voidmoveVOI(int slice, int xDim, int yDim, int zDim, int xM, int yM, int zM) Move VOI to a new position.booleannearLine(int x, int y, int slice) Tests if a point is near a line.booleannearPoint(int x, int y, int slice) Tests if a point is near a point.(package private) voidnotifyParentVOIProcess(boolean flag) Allows VOIBase's to set their parent's process flag without affecting other contours.floatpointToContour(int x, int y, int z) Finds the minimum distance from a point to a contour.voidvoidremoveCurve(VOIBase kCurve) Clears VOI of all curves at a slice.voidClears VOI of all curves.voidremoveCurves(int slice) Deprecated.voidremoveVOIListener(VOIListener listener) removes the update listener.voidsetActive(boolean act) Sets whether or not the VOI is active.voidsetAllActive(boolean flag) Sets all contours in the VOI as active or inactive.voidsetBoundingBoxFlag(boolean flag) Accessor that sets the flag to the parameter.voidsetColor(float hue) Accessor that sets the color to the parameter.voidAccessor that sets the color to the parameter.voidsetComments(String comment) voidsetContourGraph(ViewJFrameGraph newGraph) Accessor that sets the contourGraph to the parameter.voidsetCurves(VOIBaseVector newCurves) Sets the list of contours in this VOI to a new list.voidsetCurveType(int curveType) Accessor that sets the curveType to the parameter.voidsetDisplayMode(int mode) Accessor that sets the display mode to the parameter.voidsetExtension(String extension) Sets the VOI extenstion of voi file name of voi was read in through filevoidsetFixed(boolean fixed) Sets whether or not the VOI is fixed.voidsetID(short ID) Accessor that sets the ID to the parameter.voidsetMaximumIgnore(float max) Accessor that sets the maximum of the range of intensities to ignore.voidsetMaximumIgnoreB(float max) Accessor that sets the maximum of the range of blue intensities to ignore.voidsetMaximumIgnoreG(float max) Accessor that sets the maximum of the range of green intensities to ignore.voidsetMaximumIgnoreR(float max) Accessor that sets the maximum of the range of red intensities to ignore.voidsetMinimumIgnore(float min) Accessor that sets the minimum of the range of intensities to ignore.voidsetMinimumIgnoreB(float min) Accessor that sets the minimum of the range of blue intensities to ignore.voidsetMinimumIgnoreG(float min) Accessor that sets the minimum of the range of green intensities to ignore.voidsetMinimumIgnoreR(float min) Accessor that sets the minimum of the range of red intensities to ignore.voidAccessor that sets the VOI's name to the parameter.voidsetOnlyID(short ID) Accessor that sets the ID to the parameter.voidsetOpacity(float opacity) Accessor that sets the opacity to the parameter.voidsetPolarity(int polarity) Accessor that sets the polarity to the parameter.voidsetProcess(boolean flag) Accessor that sets the flag to the parameter.voidsetThickness(int newThickness) Sets the thickness of the VOIvoidsetUID(int uid) Sets the unique ID (for saving/retreiving treatment details).voidsetWatershedID(short wID) Accessor that sets the ID to the parameter.voidsetXYDim(int xDim, int yDim) Deprecated.toString()voidtrim()Trims all active contours in the VOI based on the Preferences getTrim and getTrimAdjacent values.voidupdate()voidMethods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
FORWARD
public static final int FORWARDStatic Variables for VOI and VOI Contour selection.- See Also:
-
BACKWARD
public static final int BACKWARDStatic Variables for VOI and VOI Contour selection.- See Also:
-
FRONT
public static final int FRONTStatic Variables for VOI and VOI Contour selection.- See Also:
-
BACK
public static final int BACKStatic Variables for VOI and VOI Contour selection.- See Also:
-
BOUNDARY
public static final int BOUNDARYIndicates only the boundary of the VOI should be displayed.- See Also:
-
SOLID
public static final int SOLIDIndicates that the VOI should be displayed as a solid and not just a boundary.- See Also:
-
ADDITIVE
public static final int ADDITIVEMask as ones - i.e. put ones to indicate VOI location- See Also:
-
SUBTRACTIVE
public static final int SUBTRACTIVEMask as zeros - i.e. put zeros to indicate where the VOI is located- See Also:
-
CONTOUR
public static final int CONTOURIndicates that the VOI is of type CONTOUR.- See Also:
-
POLYLINE
public static final int POLYLINEIndicates that the VOI is of type POLYLINE type of contour - end points NOT connected.- See Also:
-
LINE
public static final int LINEIndicates that the VOI is of type Line made up of two points.- See Also:
-
POINT
public static final int POINTIndicates that the POINT is of type Line made up of a single point.- See Also:
-
PROTRACTOR
public static final int PROTRACTORIndicates that the VOI is of type PROTRACTOR used to measure angles.- See Also:
-
ANNOTATION
public static final int ANNOTATIONIndicates that the VOI is of type ANNOTATION for adding text annotations to an image.- See Also:
-
CARDIOLOGY
public static final int CARDIOLOGYIndicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.- See Also:
-
POLYLINE_SLICE
public static final int POLYLINE_SLICEIndicates that the VOI is of type POLYLINE that will go through more than one slice.- See Also:
-
NOT_A_POINT
public final int NOT_A_POINTint indicating that no point was found.- See Also:
-
boundingBox
private boolean boundingBoxIf true the bounding box of the VOI should be displayed. -
color
Indicates the color or the VOI. -
thickness
private int thicknessThe thickness of the VOI lines -
contourGraph
ViewJFrameGraph for graphing contours in this VOI -
curves
A vector array of curves per slice. -
curveType
private int curveTypeIndicates the type of VOI (i.e. CONTOUR, POLYLINE, LINE, POINT, PROTRACTOR, etc. ... ) -
displayMode
private int displayModeIndicates if the VOI should be shown as a boundary or a solid. -
fixed
private boolean fixedIf true the VOI cannot be moved, if false this VOI can be moved. -
ID
private short IDID of the VOI, also used when choosing the display color. -
ignoreMax
private float ignoreMaxSets the maximum intensity value for operations on B invalid input: '&' W images segmented by this VOI -
ignoreMin
private float ignoreMinSets the minimum intensity value for operations on B invalid input: '&' W images segmented by this VOI -
ignoreMaxR
private float ignoreMaxRSets the maximum red intensity value for operations on RGB images segmented by this VOI -
ignoreMinR
private float ignoreMinRSets the minimum red intensity value for operations on RGB images segmented by this VOI -
ignoreMaxG
private float ignoreMaxGSets the maximum green intensity value for operations on RGB images segmented by this VOI -
ignoreMinG
private float ignoreMinGSets the minimum green intensity value for operations on RGB images segmented by this VOI -
ignoreMaxB
private float ignoreMaxBSets the maximum blue intensity value for operations on RGB images segmented by this VOI -
ignoreMinB
private float ignoreMinBSets the minimum blue intensity value for operations on RGB images segmented by this VOI -
name
Name of the VOI stored as a string. -
opacity
private float opacityWhen in the solid display mode indicates how opaque the VOI should be. Zero is transparent and one is opaque. -
polarity
private int polarityIndicates if the VOI should mask ones or mask as zeros. -
process
private boolean processIf true this flag indicates that the VOI should be included (applied) when processing the image. -
UID
private int UIDUnique ID for saving invalid input: '&' retrieving. -
visible
private boolean visibleIf true the VOI is visible. -
watershedID
private short watershedIDUsed to objects a label or ID inconjuction with the watershed algorithm. -
xBounds
private float[] xBoundsThe x - dimension bounds: xBounds [0] = min and xBounds[1] = max. -
yBounds
private float[] yBoundsThe y - dimension bounds: yBounds [0] = min and yBounds[1] = max. -
zBounds
private float[] zBoundsThe z - dimension bounds: zBounds [0] = min and zBounds[1] = max. -
extension
extension of voi file name of voi was read in through file -
active
private boolean active -
listenerList
VOIListeners that are updated when this VOI changes -
comments
-
-
Constructor Details
-
VOI
Create a VOI with the given id and name.- Parameters:
id- identifier of VOIname- name of the VOI
-
VOI
Constructs a Volume of Interest (VOI).- Parameters:
id- identifier of VOIname- name of the VOIcurveType- type of curve, either a line or a contourpresetHue- If presetHue >= 0.0, use this value as the hue
-
VOI
Constructs a Volume of Interest (VOI).- Parameters:
id- identifier of VOIname- name of the VOIcurveType- type of curve, either a line or a contourpresetHue- If presetHue >= 0.0, use this value as the hue
-
VOI
Copies the VOI into a new VOI object.- Parameters:
kVOI- VOI to copy.
-
-
Method Details
-
calcLargestDistance
public static double calcLargestDistance(BitSet mask, int[] extents, float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts, WildMagic.LibFoundation.Mathematics.Vector3f kPos1, WildMagic.LibFoundation.Mathematics.Vector3f kPos2) -
determineMaxAvg
private static double[] determineMaxAvg(float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts) Gathers max and average statistics to build guessing intervals -
gatherBoundedPoints
private static void gatherBoundedPoints(ArrayList<Integer> orig, ArrayList<Integer> term, double lowerBound, double upperBound, float xRes, float yRes, float zRes, float[] xPts, float[] yPts, float[] zPts) Gathers the points that fall within the required bounds -
getLargest
private static double getLargest(BitSet mask, int[] extents, ArrayList<Integer> orig, ArrayList<Integer> term, float xRes, float yRes, float zRes, float[] xPoints, float[] yPoints, float[] zPoints, WildMagic.LibFoundation.Mathematics.Vector3f kPos1, WildMagic.LibFoundation.Mathematics.Vector3f kPos2) Finds the largest line that lies within entirely within the VOI. -
addVOIListener
adds the update listener.- Parameters:
listener- VOIListener.
-
area
public double area()Finds the area of the entire VOI of the VOIContour type only.- Returns:
- returns the area
-
calcLargestDistance
Calculate the distance of the largest line segment contained entirely within the VOI- Parameters:
xRes-yRes-zRes-- Returns:
- largestDistance
-
clone
Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)- Overrides:
clonein classModelSerialCloneable- Returns:
- The cloned object. Null if there was an error.
-
createActiveContourBinaryMask
Creates a binary mask at every slice.- Parameters:
mask- the binary maskxDim- x dimension, used to index into the imageyDim- y dimension, used to index into the image
-
createBinaryImage
Forms a binary representation of the VOI into the image.- Parameters:
image- boolean image where VOI bits are to be set.XOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
createBinaryMask
Creates a binary mask at a slice for that slice only.- Parameters:
xDim- x dimension, used to index into the imageyDim- y dimension, used to index into the imageslice- slice to create mask at- Returns:
- mask the binary mask
-
createBinaryMask
public void createBinaryMask(int xDim, int yDim, int slice, BitSet mask, boolean XOR, boolean onlyActive) Creates a binary mask at a slice.- Parameters:
xDim- x dimension, used to index into the imageyDim- y dimension, used to index into the imageslice- slice to create mask atmask- the binary maskXOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
createBinaryMask
Creates a binary mask at a slice for that slice and element only.- Parameters:
xDim- x dimension, used to index into the imageyDim- y dimension, used to index into the imageslice- slice to create mask atcontour- element of VOI- Returns:
- mask the binary mask
-
createBinaryMask3D
Creates a 3D binary mask.- Parameters:
mask- mask written intoxDim- x-dimensions of the image.yDim- y-dimensions of the images.XOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
createOneElementBinaryMask3D
public void createOneElementBinaryMask3D(BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive, int elementNum) Creates a 3D binary mask.- Parameters:
mask- mask written intoxDim- x-dimensions of the image.yDim- y-dimensions of the images.XOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
createShortImage
Creates a short image of the VOI. Positions within the VOI are set to the VOI's watershed ID.- Parameters:
image- short image where VOI labels are to be set.offset- value added to watershedID - normally 1XOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
createShortMask
public short[] createShortMask(short[] mask, int xDim, int yDim, int zDim, boolean XOR) Creates a short mask at a slice.- Parameters:
mask- the short maskxDim- x dimension, used to index into the imageyDim- y dimension, used to index into the imagezDim- z dimension, used to index into the imageXOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOI- Returns:
- returns the mask
-
createUByteImage
Creates a short image of the VOI. Positions within the VOI are set to the VOI's watershed ID.- Parameters:
image- short image where VOI labels are to be set.offset- value added to watershedID - normally 1XOR- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive- Only mask regions that are active (i.e. selected )
-
dispose
public void dispose() -
equals
two VOIs are the same if they have the same name.- Parameters:
str- name of the VOI to compare this to.- Returns:
- true if the names of the VOIs are equal.
-
exportAllPoints
public WildMagic.LibFoundation.Mathematics.Vector3f[] exportAllPoints()Get Vector3fs from the VOI; can only use with Point.- Returns:
- array of points at the slice
-
exportPoint
public WildMagic.LibFoundation.Mathematics.Vector3f exportPoint()Returns the first point.- Returns:
- return the first point from the VOIPoint object
-
exportPoints
Get Vector3fs from the VOI; can only use with Point.- Parameters:
slice- index of slice- Returns:
- array of points at the slice
-
finalize
-
getBoundingBoxFlag
public boolean getBoundingBoxFlag()Accessor that returns the bounding box flag.- Returns:
- the process
-
getBounds
public void getBounds(float[] x, float[] y, float[] z) Calculates the extents or boundary of the voi in x, y, and z.- Parameters:
x- two element array where x[0] = min extent of the Contour and x[1] = max extent of the Contour in the x dimensiony- two element array where y[0] = min extent of the Contour and y[1] = max extent of the Contour in the y dimensionz- two element array where z[0] = min extent of the Contour and z[1] = max extent of the Contour in the z dimension
-
getBounds
public void getBounds(int[] x, int[] y, int[] z) Calculates the extents or boundary of the voi in x, y, and z.- Parameters:
x- two element array where x[0] = min extent of the Contour and x[1] = max extent of the Contour in the x dimensiony- two element array where y[0] = min extent of the Contour and y[1] = max extent of the Contour in the y dimensionz- two element array where z[0] = min extent of the Contour and z[1] = max extent of the Contour in the z dimension
-
getColor
Accessor that returns the VOI's color.- Returns:
- the color
-
getComments
-
getContourGraph
Returns the contour graph associated with this voi.- Returns:
- contour graph associated with this voi.
-
getCurves
Accessor that returns the curves making up the VOI.- Returns:
- the curves
-
getCurveType
public int getCurveType()Accessor that returns the curve type.- Returns:
- the curve type
-
getDisplayMode
public int getDisplayMode()Accessor that returns the display mode.- Returns:
- the display mode
-
getExtension
Accessor that returns the VOI extension.- Returns:
- extension of voi file name of voi was read in through file
-
getGeometricCenter
public WildMagic.LibFoundation.Mathematics.Vector3f getGeometricCenter()Returns the geometric center of the VOI (only contour).- Returns:
- returns the geometric center
-
getID
public short getID()Accessor that returns the ID.- Returns:
- the ID
-
getMaximumIgnore
public float getMaximumIgnore()Accessor that returns the maximum of the range of intensities to ignore.- Returns:
- The maximum.
-
getMinimumIgnore
public float getMinimumIgnore()Accessor that returns the minimum of the range of intensities to ignore.- Returns:
- The minimum.
-
getMaximumIgnoreR
public float getMaximumIgnoreR()Accessor that returns the maximum of the range of red intensities to ignore.- Returns:
- The maximum.
-
getMinimumIgnoreR
public float getMinimumIgnoreR()Accessor that returns the minimum of the range of red intensities to ignore.- Returns:
- The minimum.
-
getMaximumIgnoreG
public float getMaximumIgnoreG()Accessor that returns the maximum of the range of green intensities to ignore.- Returns:
- The maximum.
-
getMinimumIgnoreG
public float getMinimumIgnoreG()Accessor that returns the minimum of the range of green intensities to ignore.- Returns:
- The minimum.
-
getMaximumIgnoreB
public float getMaximumIgnoreB()Accessor that returns the maximum of the range of blue intensities to ignore.- Returns:
- The maximum.
-
getMinimumIgnoreB
public float getMinimumIgnoreB()Accessor that returns the minimum of the range of blue intensities to ignore.- Returns:
- The minimum.
-
getName
Accessor that returns the name of the VOI.- Returns:
- the name
-
getNumPoints
public int getNumPoints()Get the number of points in the VOI file.- Returns:
- numPoints number of points
-
getOpacity
public float getOpacity()Accessor that returns the opacity of the VOI.- Returns:
- the opacity
-
getPointCoordinates
public void getPointCoordinates(float[] coord) This method is used to get the coordinates of a single VOIPoint.- Parameters:
coord- this float array contains the x-coordinate in the first element and the y coordinate in the second element
-
getPolarity
public int getPolarity()Accessor that returns.- Returns:
- the polarity
-
getPositionAndIntensity
public int getPositionAndIntensity(int slice, int contourNo, WildMagic.LibFoundation.Mathematics.Vector3f[] position, float[] intensity, float[] imageBuffer, int xDim) Gets the position and intensity for this VOI if it's a line.- Parameters:
slice- slice where the line is locatedcontourNo- the contour within the image sliceposition- position of the line (x-coordinates)intensity- intensity of the line (y-coordinates)imageBuffer- image bufferxDim- x dimension- Returns:
- the number of points in the position and intensity array that have a valid data.
-
getProcess
public boolean getProcess()Accessor that returns whether voi is included in processing.- Returns:
- the process
-
getSize
public int getSize()Returns the number of contours in this VOI.- Returns:
- number of contours in this VOI.
-
getSliceCurves
Returns a list of contours on a given slice.- Parameters:
iSlice- the slice in the image.- Returns:
- list of contours for the slice.
-
getSliceCurves
Returns a list of contours for the given image orientation and slice.- Parameters:
iPlane- , the plane direction to slice the 3D image (x, y, or z).iSlice- the slice number.- Returns:
- list of contours.
-
getSliceSize
public int getSliceSize(int iSlice) Returns the number of contours for a given slice.- Parameters:
iSlice- the slice number in the 3D image.- Returns:
- number of contours for the slice.
-
getSliceSize
public int getSliceSize(int iPlane, int iSlice) Returns the number of contours for a given image orientation and slice in a 3D image.- Parameters:
iPlane- the plane direction to slice the 3D image (x,y, or z).iSlice- the slice number.- Returns:
- the number of contours.
-
getSortedCurves
Sorts the contours based on the image default orientation.- Parameters:
iDim- the number of slices in the image for the default z-direction of the image.- Returns:
- an array of contour lists, one list per slice in the image.
-
getSortedCurves
Sorts the contours based on a given image orientation and the desired image depth for that orientation.- Parameters:
iPlane- the direction to slice the 3D image (x, y, or z).iDim- the number of slice in the given orientation.- Returns:
- an array of contour lists, one per slice in the image.
-
getThickness
public int getThickness()Returns the thickness of the VOI- Returns:
-
getUID
public int getUID()Accessor that returns the Unique ID (original hash code for object).- Returns:
- the unique ID
-
getVOISlices
public int getVOISlices()Returns the number of z slices actually containing part of the voi- Returns:
-
getWatershedID
public short getWatershedID()getWatershedID - accessor that returns the watershedID.- Returns:
- the ID
-
hasListener
-
importCurve
Imports a new curve into this voi.- Parameters:
x- x-positions of the curve.y- y-positions of the curve.z- z-positions of the curve.- Returns:
- the new VOIBase object created by the importCurve.
-
importCurve
public void importCurve(int[] x, int[] y, int[] z) -
importCurve
public void importCurve(WildMagic.LibFoundation.Mathematics.Vector3f[] pt) Imports the curve into the VOI, testing for which type.- Parameters:
pt- array of 3D points to import
-
importCurve
Imports the curve into the VOI.- Parameters:
curve- curve to import
-
importNewVOI
Imports just the VOIs in a slice into this VOI.- Parameters:
slice- slice indicates the slice where the contour(s) is to be locatedvoiSlice- voiSlice indicates the slice where the contour(s) is to be copied fromvoi- added to VOIresize- when true clear the existing curves.
-
importPoint
public void importPoint(WildMagic.LibFoundation.Mathematics.Vector3f point) Import a new point into this VOI. This VOI must be of type POINT.- Parameters:
point-
-
importPoint
public void importPoint(WildMagic.LibFoundation.Mathematics.Vector3f point, boolean notifyListener) Import a new point into this VOI. This VOI must be of type POINT.- Parameters:
point-
-
importPolygon
Imports the polygon into the VOI (must be a contour).- Parameters:
gon- polygon to importslice- index of slice of new polygon
-
exportPolygon
-
isActive
public boolean isActive()Accessor that tells if the VOI is active.- Returns:
- boolean active
-
isAllActive
public boolean isAllActive()Returns true iff all contours in this VOI are active.- Returns:
- true iff all contours in this VOI are active.
-
isEmpty
public boolean isEmpty()Test whether or not the VOI is empty.- Returns:
- boolean result of test
-
isFixed
public boolean isFixed()Accessor that tells if VOI is fixed. A fixed VOI cannot be modified.- Returns:
- boolean fixed
-
isVisible
public boolean isVisible()Accessor that tells if the VOI is visible.- Returns:
- boolean visible
-
maxWidth
public WildMagic.LibFoundation.Mathematics.Vector3f[] maxWidth(boolean bOnlyActive) Finds 2 points that form the maximum width of the VOI.- Returns:
- returns the two points.
-
moveVOI
public void moveVOI(int slice, int xDim, int yDim, int zDim, int xM, int yM, int zM) Move VOI to a new position.- Parameters:
slice- slice where the VOI is locatedxDim- x dimension maximumyDim- y dimension maximumzDim- z dimension maximumxM- amount in pixels to move the line in the x directionyM- amount in pixels to move the line in the y directionzM- amount in pixels to move the line in the z direction
-
nearLine
public boolean nearLine(int x, int y, int slice) Tests if a point is near a line.- Parameters:
x- x coordinate of liney- y coordinate of lineslice- index of slice in curve array- Returns:
- result of test
-
nearPoint
public boolean nearPoint(int x, int y, int slice) Tests if a point is near a point.- Parameters:
x- x coordinate of pointy- y coordinate of pointslice- index of slice in curve array- Returns:
- result of test
-
pointToContour
public float pointToContour(int x, int y, int z) Finds the minimum distance from a point to a contour. If the point is in a contour, the distance is given a negative sign. If the point is outside contours, the distance is given a positive sign. The contour points are connected by straight line segments between the points so simply find the distances from the point to each line segment comprising the contours.- Parameters:
x- input x-positiony- input y-positionz- input z-position- Returns:
- minDistance
-
removeAllVOIListeners
public void removeAllVOIListeners() -
removeCurve
Clears VOI of all curves at a slice.- Parameters:
slice- index of slice of curves to remove
-
removeCurves
public void removeCurves()Clears VOI of all curves.- Parameters:
slice- index of slice of curves to remove
-
removeCurves
Deprecated.Clears VOI of all curves at a slice.- Parameters:
slice- index of slice of curves to remove
-
removeVOIListener
removes the update listener.- Parameters:
listener- VOIListener to remove.
-
setActive
public void setActive(boolean act) Sets whether or not the VOI is active.- Parameters:
act- boolean to set active to
-
setAllActive
public void setAllActive(boolean flag) Sets all contours in the VOI as active or inactive.- Parameters:
flag- boolean to set VOI active or inactive
-
setBoundingBoxFlag
public void setBoundingBoxFlag(boolean flag) Accessor that sets the flag to the parameter.- Parameters:
flag- the visible flag
-
setColor
Accessor that sets the color to the parameter.- Parameters:
color- the color
-
setColor
public void setColor(float hue) Accessor that sets the color to the parameter.- Parameters:
hue- the color of the VOI
-
setComments
-
setContourGraph
Accessor that sets the contourGraph to the parameter.- Parameters:
newGraph- the graph
-
setCurves
Sets the list of contours in this VOI to a new list.- Parameters:
newCurves- new list of VOIBase contours.
-
setCurveType
public void setCurveType(int curveType) Accessor that sets the curveType to the parameter.- Parameters:
curveType- the curve type
-
setDisplayMode
public void setDisplayMode(int mode) Accessor that sets the display mode to the parameter.- Parameters:
mode- the display mode
-
setExtension
Sets the VOI extenstion of voi file name of voi was read in through file- Parameters:
extension-
-
setFixed
public void setFixed(boolean fixed) Sets whether or not the VOI is fixed.- Parameters:
fixed- boolean to set fixed to
-
setID
public void setID(short ID) Accessor that sets the ID to the parameter.- Parameters:
ID- the ID
-
setMaximumIgnore
public void setMaximumIgnore(float max) Accessor that sets the maximum of the range of intensities to ignore.- Parameters:
max- The maximum.
-
setMinimumIgnore
public void setMinimumIgnore(float min) Accessor that sets the minimum of the range of intensities to ignore.- Parameters:
min- The minimum.
-
setMaximumIgnoreR
public void setMaximumIgnoreR(float max) Accessor that sets the maximum of the range of red intensities to ignore.- Parameters:
max- The maximum.
-
setMinimumIgnoreR
public void setMinimumIgnoreR(float min) Accessor that sets the minimum of the range of red intensities to ignore.- Parameters:
min- The minimum.
-
setMaximumIgnoreG
public void setMaximumIgnoreG(float max) Accessor that sets the maximum of the range of green intensities to ignore.- Parameters:
max- The maximum.
-
setMinimumIgnoreG
public void setMinimumIgnoreG(float min) Accessor that sets the minimum of the range of green intensities to ignore.- Parameters:
min- The minimum.
-
setMaximumIgnoreB
public void setMaximumIgnoreB(float max) Accessor that sets the maximum of the range of blue intensities to ignore.- Parameters:
max- The maximum.
-
setMinimumIgnoreB
public void setMinimumIgnoreB(float min) Accessor that sets the minimum of the range of blue intensities to ignore.- Parameters:
min- The minimum.
-
setName
Accessor that sets the VOI's name to the parameter.- Parameters:
name- the name
-
setOnlyID
public void setOnlyID(short ID) Accessor that sets the ID to the parameter.- Parameters:
ID- the ID
-
setOpacity
public void setOpacity(float opacity) Accessor that sets the opacity to the parameter.- Parameters:
opacity- the opacity
-
setPolarity
public void setPolarity(int polarity) Accessor that sets the polarity to the parameter.- Parameters:
polarity- the polarity
-
setProcess
public void setProcess(boolean flag) Accessor that sets the flag to the parameter.- Parameters:
flag- the process flag
-
notifyParentVOIProcess
void notifyParentVOIProcess(boolean flag) Allows VOIBase's to set their parent's process flag without affecting other contours. If not all contours are in the same state, this will not be set.- Parameters:
flag- the process flag
-
setThickness
public void setThickness(int newThickness) Sets the thickness of the VOI- Parameters:
newThickness- the new thickness
-
setUID
public void setUID(int uid) Sets the unique ID (for saving/retreiving treatment details).- Parameters:
uid- - unique ID
-
setWatershedID
public void setWatershedID(short wID) Accessor that sets the ID to the parameter.- Parameters:
wID- the ID
-
setXYDim
public void setXYDim(int xDim, int yDim) Deprecated.Accessor that sets xDim and yDim.- Parameters:
xDim- x dimensionyDim- y dimension
-
toString
-
trim
public void trim()Trims all active contours in the VOI based on the Preferences getTrim and getTrimAdjacent values. -
update
public void update() -
updateActive
public void updateActive() -
findMaxWidth
private WildMagic.LibFoundation.Mathematics.Vector3f findMaxWidth(WildMagic.LibFoundation.Mathematics.Vector3f pt, double[] maxDistance, boolean bOnlyActive) This is used by the method maxWidth.- Parameters:
pt- calculate the distance from this point to any point on any of the contours which form the VOI.maxDistance- single array value to keep track of the largest- Returns:
- the maximum width of the VOI
-
fireVOIBaseAdded
Fires a VOI event based on the VOI. calls the listener'saddedVOI()method.- Parameters:
curve- new curve added to this VOI.
-
fireVOIBaseRemoved
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()method.- Parameters:
curve- curve removed from this VOI.
-
fireVOIColorChange
Deprecated.- Parameters:
color-
-
fireVOIselection
protected void fireVOIselection()Fires a VOI event based on the VOI. calls the listener'sremovedVOI()method.
-