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:
java.io.Serializable
,java.lang.Cloneable
public class VOI extends ModelSerialCloneable
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
active
static int
ADDITIVE
Mask as ones - i.e. put ones to indicate VOI locationstatic int
ANNOTATION
Indicates that the VOI is of type ANNOTATION for adding text annotations to an image.static int
BACK
Static Variables for VOI and VOI Contour selection.static int
BACKWARD
Static Variables for VOI and VOI Contour selection.static int
BOUNDARY
Indicates only the boundary of the VOI should be displayed.private boolean
boundingBox
If true the bounding box of the VOI should be displayed.static int
CARDIOLOGY
Indicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.private java.awt.Color
color
Indicates the color or the VOI.private java.util.ArrayList<java.lang.String>
comments
static int
CONTOUR
Indicates that the VOI is of type CONTOUR.private ViewJFrameGraph
contourGraph
ViewJFrameGraph for graphing contours in this VOIprivate VOIBaseVector
curves
A vector array of curves per slice.private int
curveType
Indicates the type of VOI (i.e.private int
displayMode
Indicates if the VOI should be shown as a boundary or a solid.private java.lang.String
extension
extension of voi file name of voi was read in through fileprivate boolean
fixed
If true the VOI cannot be moved, if false this VOI can be moved.static int
FORWARD
Static Variables for VOI and VOI Contour selection.static int
FRONT
Static Variables for VOI and VOI Contour selection.private short
ID
ID of the VOI, also used when choosing the display color.private float
ignoreMax
Sets the maximum intensity value for operations on B & W images segmented by this VOIprivate float
ignoreMaxB
Sets the maximum blue intensity value for operations on RGB images segmented by this VOIprivate float
ignoreMaxG
Sets the maximum green intensity value for operations on RGB images segmented by this VOIprivate float
ignoreMaxR
Sets the maximum red intensity value for operations on RGB images segmented by this VOIprivate float
ignoreMin
Sets the minimum intensity value for operations on B & W images segmented by this VOIprivate float
ignoreMinB
Sets the minimum blue intensity value for operations on RGB images segmented by this VOIprivate float
ignoreMinG
Sets the minimum green intensity value for operations on RGB images segmented by this VOIprivate float
ignoreMinR
Sets the minimum red intensity value for operations on RGB images segmented by this VOIstatic int
LINE
Indicates that the VOI is of type Line made up of two points.javax.swing.event.EventListenerList
listenerList
VOIListeners that are updated when this VOI changesprivate java.lang.String
name
Name of the VOI stored as a string.int
NOT_A_POINT
int indicating that no point was found.private float
opacity
When in the solid display mode indicates how opaque the VOI should be.static int
POINT
Indicates that the POINT is of type Line made up of a single point.private int
polarity
Indicates if the VOI should mask ones or mask as zeros.static int
POLYLINE
Indicates that the VOI is of type POLYLINE type of contour - end points NOT connected.static int
POLYLINE_SLICE
Indicates that the VOI is of type POLYLINE that will go through more than one slice.private boolean
process
If true this flag indicates that the VOI should be included (applied) when processing the image.static int
PROTRACTOR
Indicates that the VOI is of type PROTRACTOR used to measure angles.private static long
serialVersionUID
Use serialVersionUID for interoperability.static int
SOLID
Indicates that the VOI should be displayed as a solid and not just a boundary.static int
SUBTRACTIVE
Mask as zeros - i.e. put zeros to indicate where the VOI is locatedprivate int
thickness
The thickness of the VOI linesprivate int
UID
Unique ID for saving & retrieving.private boolean
visible
If true the VOI is visible.private short
watershedID
Used to objects a label or ID inconjuction with the watershed algorithm.private float[]
xBounds
The x - dimension bounds: xBounds [0] = min and xBounds[1] = max.private float[]
yBounds
The y - dimension bounds: yBounds [0] = min and yBounds[1] = max.private float[]
zBounds
The z - dimension bounds: zBounds [0] = min and zBounds[1] = max.
-
Constructor Summary
Constructors Constructor Description VOI(short id, java.lang.String name)
Create a VOI with the given id and name.VOI(short id, java.lang.String name, int curveType, float presetHue)
Constructs a Volume of Interest (VOI).VOI(short id, java.lang.String name, int curveType, float presetHue, int initialCapacity)
Constructs a Volume of Interest (VOI).VOI(VOI kVOI)
Copies the VOI into a new VOI object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addVOIListener(VOIListener listener)
adds the update listener.double
area()
Finds the area of the entire VOI of the VOIContour type only.double
calcLargestDistance(java.util.BitSet mask, int[] extents, float[] res)
Calculate the distance of the largest line segment contained entirely within the VOIstatic double
calcLargestDistance(java.util.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)
java.lang.Object
clone()
Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)void
createActiveContourBinaryMask(java.util.BitSet mask, int xDim, int yDim)
Creates a binary mask at every slice.void
createBinaryImage(ModelImage image, boolean XOR, boolean onlyActive)
Forms a binary representation of the VOI into the image.java.util.BitSet
createBinaryMask(int xDim, int yDim, int slice)
Creates a binary mask at a slice for that slice only.java.util.BitSet
createBinaryMask(int xDim, int yDim, int slice, VOIBase contour)
Creates a binary mask at a slice for that slice and element only.void
createBinaryMask(int xDim, int yDim, int slice, java.util.BitSet mask, boolean XOR, boolean onlyActive)
Creates a binary mask at a slice.void
createBinaryMask3D(java.util.BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive)
Creates a 3D binary mask.void
createOneElementBinaryMask3D(java.util.BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive, int elementNum)
Creates a 3D binary mask.void
createShortImage(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.void
createUByteImage(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 intervalsvoid
dispose()
boolean
equals(java.lang.String str)
two VOIs are the same if they have the same name.WildMagic.LibFoundation.Mathematics.Vector3f[]
exportAllPoints()
Get Vector3fs from the VOI; can only use with Point.WildMagic.LibFoundation.Mathematics.Vector3f
exportPoint()
Returns the first point.java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f>
exportPoints(int slice)
Get Vector3fs from the VOI; can only use with Point.java.util.Vector<java.awt.Polygon>
exportPolygon(int iSlice)
void
finalize()
private WildMagic.LibFoundation.Mathematics.Vector3f
findMaxWidth(WildMagic.LibFoundation.Mathematics.Vector3f pt, double[] maxDistance, boolean bOnlyActive)
This is used by the method maxWidth.protected void
fireVOIBaseAdded(VOIBase curve)
Fires a VOI event based on the VOI. calls the listener'saddedVOI()
method.protected void
fireVOIBaseRemoved(VOIBase curve)
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
method.protected void
fireVOIColorChange(java.awt.Color color)
Deprecated.protected void
fireVOIselection()
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
method.private static void
gatherBoundedPoints(java.util.ArrayList<java.lang.Integer> orig, java.util.ArrayList<java.lang.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 boundsboolean
getBoundingBoxFlag()
Accessor that returns the bounding box flag.void
getBounds(float[] x, float[] y, float[] z)
Calculates the extents or boundary of the voi in x, y, and z.void
getBounds(int[] x, int[] y, int[] z)
Calculates the extents or boundary of the voi in x, y, and z.java.awt.Color
getColor()
Accessor that returns the VOI's color.java.util.ArrayList<java.lang.String>
getComments()
ViewJFrameGraph
getContourGraph()
Returns the contour graph associated with this voi.VOIBaseVector
getCurves()
Accessor that returns the curves making up the VOI.int
getCurveType()
Accessor that returns the curve type.int
getDisplayMode()
Accessor that returns the display mode.java.lang.String
getExtension()
Accessor that returns the VOI extension.WildMagic.LibFoundation.Mathematics.Vector3f
getGeometricCenter()
Returns the geometric center of the VOI (only contour).short
getID()
Accessor that returns the ID.private static double
getLargest(java.util.BitSet mask, int[] extents, java.util.ArrayList<java.lang.Integer> orig, java.util.ArrayList<java.lang.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.float
getMaximumIgnore()
Accessor that returns the maximum of the range of intensities to ignore.float
getMaximumIgnoreB()
Accessor that returns the maximum of the range of blue intensities to ignore.float
getMaximumIgnoreG()
Accessor that returns the maximum of the range of green intensities to ignore.float
getMaximumIgnoreR()
Accessor that returns the maximum of the range of red intensities to ignore.float
getMinimumIgnore()
Accessor that returns the minimum of the range of intensities to ignore.float
getMinimumIgnoreB()
Accessor that returns the minimum of the range of blue intensities to ignore.float
getMinimumIgnoreG()
Accessor that returns the minimum of the range of green intensities to ignore.float
getMinimumIgnoreR()
Accessor that returns the minimum of the range of red intensities to ignore.java.lang.String
getName()
Accessor that returns the name of the VOI.int
getNumPoints()
Get the number of points in the VOI file.float
getOpacity()
Accessor that returns the opacity of the VOI.void
getPointCoordinates(float[] coord)
This method is used to get the coordinates of a single VOIPoint.int
getPolarity()
Accessor that returns.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.boolean
getProcess()
Accessor that returns whether voi is included in processing.int
getSize()
Returns the number of contours in this VOI.java.util.Vector<VOIBase>
getSliceCurves(int iSlice)
Returns a list of contours on a given slice.java.util.Vector<VOIBase>
getSliceCurves(int iPlane, int iSlice)
Returns a list of contours for the given image orientation and slice.int
getSliceSize(int iSlice)
Returns the number of contours for a given slice.int
getSliceSize(int iPlane, int iSlice)
Returns the number of contours for a given image orientation and slice in a 3D image.java.util.Vector<VOIBase>[]
getSortedCurves(int iDim)
Sorts the contours based on the image default orientation.java.util.Vector<VOIBase>[]
getSortedCurves(int iPlane, int iDim)
Sorts the contours based on a given image orientation and the desired image depth for that orientation.int
getThickness()
Returns the thickness of the VOIint
getUID()
Accessor that returns the Unique ID (original hash code for object).int
getVOISlices()
Returns the number of z slices actually containing part of the voishort
getWatershedID()
getWatershedID - accessor that returns the watershedID.boolean
hasListener(VOIListener listener)
VOIBase
importCurve(float[] x, float[] y, float[] z)
Imports a new curve into this voi.void
importCurve(int[] x, int[] y, int[] z)
void
importCurve(VOIBase curve)
Imports the curve into the VOI.void
importCurve(WildMagic.LibFoundation.Mathematics.Vector3f[] pt)
Imports the curve into the VOI, testing for which type.void
importNewVOI(int slice, int voiSlice, VOI voi, boolean resize)
Imports just the VOIs in a slice into this VOI.void
importPoint(WildMagic.LibFoundation.Mathematics.Vector3f point)
Import a new point into this VOI.void
importPoint(WildMagic.LibFoundation.Mathematics.Vector3f point, boolean notifyListener)
Import a new point into this VOI.void
importPolygon(java.awt.Polygon gon, int slice)
Imports the polygon into the VOI (must be a contour).boolean
isActive()
Accessor that tells if the VOI is active.boolean
isAllActive()
Returns true iff all contours in this VOI are active.boolean
isEmpty()
Test whether or not the VOI is empty.boolean
isFixed()
Accessor that tells if VOI is fixed.boolean
isVisible()
Accessor 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.void
moveVOI(int slice, int xDim, int yDim, int zDim, int xM, int yM, int zM)
Move VOI to a new position.boolean
nearLine(int x, int y, int slice)
Tests if a point is near a line.boolean
nearPoint(int x, int y, int slice)
Tests if a point is near a point.(package private) void
notifyParentVOIProcess(boolean flag)
Allows VOIBase's to set their parent's process flag without affecting other contours.float
pointToContour(int x, int y, int z)
Finds the minimum distance from a point to a contour.void
removeAllVOIListeners()
void
removeCurve(VOIBase kCurve)
Clears VOI of all curves at a slice.void
removeCurves()
Clears VOI of all curves.void
removeCurves(int slice)
Deprecated.void
removeVOIListener(VOIListener listener)
removes the update listener.void
setActive(boolean act)
Sets whether or not the VOI is active.void
setAllActive(boolean flag)
Sets all contours in the VOI as active or inactive.void
setBoundingBoxFlag(boolean flag)
Accessor that sets the flag to the parameter.void
setColor(float hue)
Accessor that sets the color to the parameter.void
setColor(java.awt.Color color)
Accessor that sets the color to the parameter.void
setComments(java.lang.String comment)
void
setContourGraph(ViewJFrameGraph newGraph)
Accessor that sets the contourGraph to the parameter.void
setCurves(VOIBaseVector newCurves)
Sets the list of contours in this VOI to a new list.void
setCurveType(int curveType)
Accessor that sets the curveType to the parameter.void
setDisplayMode(int mode)
Accessor that sets the display mode to the parameter.void
setExtension(java.lang.String extension)
Sets the VOI extenstion of voi file name of voi was read in through filevoid
setFixed(boolean fixed)
Sets whether or not the VOI is fixed.void
setID(short ID)
Accessor that sets the ID to the parameter.void
setMaximumIgnore(float max)
Accessor that sets the maximum of the range of intensities to ignore.void
setMaximumIgnoreB(float max)
Accessor that sets the maximum of the range of blue intensities to ignore.void
setMaximumIgnoreG(float max)
Accessor that sets the maximum of the range of green intensities to ignore.void
setMaximumIgnoreR(float max)
Accessor that sets the maximum of the range of red intensities to ignore.void
setMinimumIgnore(float min)
Accessor that sets the minimum of the range of intensities to ignore.void
setMinimumIgnoreB(float min)
Accessor that sets the minimum of the range of blue intensities to ignore.void
setMinimumIgnoreG(float min)
Accessor that sets the minimum of the range of green intensities to ignore.void
setMinimumIgnoreR(float min)
Accessor that sets the minimum of the range of red intensities to ignore.void
setName(java.lang.String name)
Accessor that sets the VOI's name to the parameter.void
setOnlyID(short ID)
Accessor that sets the ID to the parameter.void
setOpacity(float opacity)
Accessor that sets the opacity to the parameter.void
setPolarity(int polarity)
Accessor that sets the polarity to the parameter.void
setProcess(boolean flag)
Accessor that sets the flag to the parameter.void
setThickness(int newThickness)
Sets the thickness of the VOIvoid
setUID(int uid)
Sets the unique ID (for saving/retreiving treatment details).void
setWatershedID(short wID)
Accessor that sets the ID to the parameter.void
setXYDim(int xDim, int yDim)
Deprecated.java.lang.String
toString()
void
trim()
Trims all active contours in the VOI based on the Preferences getTrim and getTrimAdjacent values.void
update()
void
updateActive()
-
Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
FORWARD
public static final int FORWARD
Static Variables for VOI and VOI Contour selection.- See Also:
- Constant Field Values
-
BACKWARD
public static final int BACKWARD
Static Variables for VOI and VOI Contour selection.- See Also:
- Constant Field Values
-
FRONT
public static final int FRONT
Static Variables for VOI and VOI Contour selection.- See Also:
- Constant Field Values
-
BACK
public static final int BACK
Static Variables for VOI and VOI Contour selection.- See Also:
- Constant Field Values
-
BOUNDARY
public static final int BOUNDARY
Indicates only the boundary of the VOI should be displayed.- See Also:
- Constant Field Values
-
SOLID
public static final int SOLID
Indicates that the VOI should be displayed as a solid and not just a boundary.- See Also:
- Constant Field Values
-
ADDITIVE
public static final int ADDITIVE
Mask as ones - i.e. put ones to indicate VOI location- See Also:
- Constant Field Values
-
SUBTRACTIVE
public static final int SUBTRACTIVE
Mask as zeros - i.e. put zeros to indicate where the VOI is located- See Also:
- Constant Field Values
-
CONTOUR
public static final int CONTOUR
Indicates that the VOI is of type CONTOUR.- See Also:
- Constant Field Values
-
POLYLINE
public static final int POLYLINE
Indicates that the VOI is of type POLYLINE type of contour - end points NOT connected.- See Also:
- Constant Field Values
-
LINE
public static final int LINE
Indicates that the VOI is of type Line made up of two points.- See Also:
- Constant Field Values
-
POINT
public static final int POINT
Indicates that the POINT is of type Line made up of a single point.- See Also:
- Constant Field Values
-
PROTRACTOR
public static final int PROTRACTOR
Indicates that the VOI is of type PROTRACTOR used to measure angles.- See Also:
- Constant Field Values
-
ANNOTATION
public static final int ANNOTATION
Indicates that the VOI is of type ANNOTATION for adding text annotations to an image.- See Also:
- Constant Field Values
-
CARDIOLOGY
public static final int CARDIOLOGY
Indicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.- See Also:
- Constant Field Values
-
POLYLINE_SLICE
public static final int POLYLINE_SLICE
Indicates that the VOI is of type POLYLINE that will go through more than one slice.- See Also:
- Constant Field Values
-
NOT_A_POINT
public final int NOT_A_POINT
int indicating that no point was found.- See Also:
- Constant Field Values
-
boundingBox
private boolean boundingBox
If true the bounding box of the VOI should be displayed.
-
color
private java.awt.Color color
Indicates the color or the VOI.
-
thickness
private int thickness
The thickness of the VOI lines
-
contourGraph
private transient ViewJFrameGraph contourGraph
ViewJFrameGraph for graphing contours in this VOI
-
curves
private VOIBaseVector curves
A vector array of curves per slice.
-
curveType
private int curveType
Indicates the type of VOI (i.e. CONTOUR, POLYLINE, LINE, POINT, PROTRACTOR, etc. ... )
-
displayMode
private int displayMode
Indicates if the VOI should be shown as a boundary or a solid.
-
fixed
private boolean fixed
If true the VOI cannot be moved, if false this VOI can be moved.
-
ID
private short ID
ID of the VOI, also used when choosing the display color.
-
ignoreMax
private float ignoreMax
Sets the maximum intensity value for operations on B & W images segmented by this VOI
-
ignoreMin
private float ignoreMin
Sets the minimum intensity value for operations on B & W images segmented by this VOI
-
ignoreMaxR
private float ignoreMaxR
Sets the maximum red intensity value for operations on RGB images segmented by this VOI
-
ignoreMinR
private float ignoreMinR
Sets the minimum red intensity value for operations on RGB images segmented by this VOI
-
ignoreMaxG
private float ignoreMaxG
Sets the maximum green intensity value for operations on RGB images segmented by this VOI
-
ignoreMinG
private float ignoreMinG
Sets the minimum green intensity value for operations on RGB images segmented by this VOI
-
ignoreMaxB
private float ignoreMaxB
Sets the maximum blue intensity value for operations on RGB images segmented by this VOI
-
ignoreMinB
private float ignoreMinB
Sets the minimum blue intensity value for operations on RGB images segmented by this VOI
-
name
private java.lang.String name
Name of the VOI stored as a string.
-
opacity
private float opacity
When in the solid display mode indicates how opaque the VOI should be. Zero is transparent and one is opaque.
-
polarity
private int polarity
Indicates if the VOI should mask ones or mask as zeros.
-
process
private boolean process
If true this flag indicates that the VOI should be included (applied) when processing the image.
-
UID
private int UID
Unique ID for saving & retrieving.
-
visible
private boolean visible
If true the VOI is visible.
-
watershedID
private short watershedID
Used to objects a label or ID inconjuction with the watershed algorithm.
-
xBounds
private float[] xBounds
The x - dimension bounds: xBounds [0] = min and xBounds[1] = max.
-
yBounds
private float[] yBounds
The y - dimension bounds: yBounds [0] = min and yBounds[1] = max.
-
zBounds
private float[] zBounds
The z - dimension bounds: zBounds [0] = min and zBounds[1] = max.
-
extension
private java.lang.String extension
extension of voi file name of voi was read in through file
-
active
private boolean active
-
listenerList
public transient javax.swing.event.EventListenerList listenerList
VOIListeners that are updated when this VOI changes
-
comments
private java.util.ArrayList<java.lang.String> comments
-
-
Constructor Detail
-
VOI
public VOI(short id, java.lang.String name)
Create a VOI with the given id and name.- Parameters:
id
- identifier of VOIname
- name of the VOI
-
VOI
public VOI(short id, java.lang.String name, int curveType, float presetHue)
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
public VOI(short id, java.lang.String name, int curveType, float presetHue, int initialCapacity)
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
public VOI(VOI kVOI)
Copies the VOI into a new VOI object.- Parameters:
kVOI
- VOI to copy.
-
-
Method Detail
-
calcLargestDistance
public static double calcLargestDistance(java.util.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(java.util.ArrayList<java.lang.Integer> orig, java.util.ArrayList<java.lang.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(java.util.BitSet mask, int[] extents, java.util.ArrayList<java.lang.Integer> orig, java.util.ArrayList<java.lang.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
public void addVOIListener(VOIListener listener)
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
public double calcLargestDistance(java.util.BitSet mask, int[] extents, float[] res)
Calculate the distance of the largest line segment contained entirely within the VOI- Parameters:
xRes
-yRes
-zRes
-- Returns:
- largestDistance
-
clone
public java.lang.Object clone()
Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)- Overrides:
clone
in classModelSerialCloneable
- Returns:
- The cloned object. Null if there was an error.
-
createActiveContourBinaryMask
public void createActiveContourBinaryMask(java.util.BitSet mask, int xDim, int yDim)
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
public void createBinaryImage(ModelImage image, boolean XOR, boolean onlyActive)
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
public java.util.BitSet createBinaryMask(int xDim, int yDim, int slice)
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, java.util.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
public java.util.BitSet createBinaryMask(int xDim, int yDim, int slice, VOIBase contour)
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
public void createBinaryMask3D(java.util.BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive)
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(java.util.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
public void createShortImage(ModelImage image, int offset, boolean XOR, boolean onlyActive)
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
public void createUByteImage(ModelImage image, int offset, boolean XOR, boolean onlyActive)
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
public boolean equals(java.lang.String str)
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
public java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> exportPoints(int slice)
Get Vector3fs from the VOI; can only use with Point.- Parameters:
slice
- index of slice- Returns:
- array of points at the slice
-
finalize
public void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
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
public java.awt.Color getColor()
Accessor that returns the VOI's color.- Returns:
- the color
-
getComments
public java.util.ArrayList<java.lang.String> getComments()
-
getContourGraph
public ViewJFrameGraph getContourGraph()
Returns the contour graph associated with this voi.- Returns:
- contour graph associated with this voi.
-
getCurves
public VOIBaseVector 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
public java.lang.String 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
public java.lang.String 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
public java.util.Vector<VOIBase> getSliceCurves(int iSlice)
Returns a list of contours on a given slice.- Parameters:
iSlice
- the slice in the image.- Returns:
- list of contours for the slice.
-
getSliceCurves
public java.util.Vector<VOIBase> getSliceCurves(int iPlane, int iSlice)
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
public java.util.Vector<VOIBase>[] getSortedCurves(int iDim)
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
public java.util.Vector<VOIBase>[] getSortedCurves(int iPlane, int iDim)
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
public boolean hasListener(VOIListener listener)
-
importCurve
public VOIBase importCurve(float[] x, float[] y, float[] z)
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
public void importCurve(VOIBase curve)
Imports the curve into the VOI.- Parameters:
curve
- curve to import
-
importNewVOI
public void importNewVOI(int slice, int voiSlice, VOI voi, boolean resize)
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
public void importPolygon(java.awt.Polygon gon, int slice)
Imports the polygon into the VOI (must be a contour).- Parameters:
gon
- polygon to importslice
- index of slice of new polygon
-
exportPolygon
public java.util.Vector<java.awt.Polygon> exportPolygon(int iSlice)
-
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
public void removeCurve(VOIBase kCurve)
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 public void removeCurves(int slice)
Deprecated.Clears VOI of all curves at a slice.- Parameters:
slice
- index of slice of curves to remove
-
removeVOIListener
public void removeVOIListener(VOIListener listener)
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
public void setColor(java.awt.Color color)
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
public void setComments(java.lang.String comment)
-
setContourGraph
public void setContourGraph(ViewJFrameGraph newGraph)
Accessor that sets the contourGraph to the parameter.- Parameters:
newGraph
- the graph
-
setCurves
public void setCurves(VOIBaseVector newCurves)
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
public void setExtension(java.lang.String extension)
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
public void setName(java.lang.String name)
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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
protected void fireVOIBaseAdded(VOIBase curve)
Fires a VOI event based on the VOI. calls the listener'saddedVOI()
method.- Parameters:
curve
- new curve added to this VOI.
-
fireVOIBaseRemoved
protected void fireVOIBaseRemoved(VOIBase curve)
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
method.- Parameters:
curve
- curve removed from this VOI.
-
fireVOIColorChange
protected void fireVOIColorChange(java.awt.Color color)
Deprecated.- Parameters:
color
-
-
fireVOIselection
protected void fireVOIselection()
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
method.
-
-