Class VOI

All Implemented Interfaces:
Serializable, 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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
    static final int
    Mask as ones - i.e. put ones to indicate VOI location
    static final int
    Indicates that the VOI is of type ANNOTATION for adding text annotations to an image.
    static final int
    Static Variables for VOI and VOI Contour selection.
    static final int
    Static Variables for VOI and VOI Contour selection.
    static final int
    Indicates only the boundary of the VOI should be displayed.
    private boolean
    If true the bounding box of the VOI should be displayed.
    static final int
    Indicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.
    private Color
    Indicates the color or the VOI.
    private ArrayList<String>
     
    static final int
    Indicates that the VOI is of type CONTOUR.
    ViewJFrameGraph for graphing contours in this VOI
    A vector array of curves per slice.
    private int
    Indicates the type of VOI (i.e.
    private int
    Indicates if the VOI should be shown as a boundary or a solid.
    private String
    extension of voi file name of voi was read in through file
    private boolean
    If true the VOI cannot be moved, if false this VOI can be moved.
    static final int
    Static Variables for VOI and VOI Contour selection.
    static final int
    Static Variables for VOI and VOI Contour selection.
    private short
    ID of the VOI, also used when choosing the display color.
    private float
    Sets the maximum intensity value for operations on B invalid input: '&' W images segmented by this VOI
    private float
    Sets the maximum blue intensity value for operations on RGB images segmented by this VOI
    private float
    Sets the maximum green intensity value for operations on RGB images segmented by this VOI
    private float
    Sets the maximum red intensity value for operations on RGB images segmented by this VOI
    private float
    Sets the minimum intensity value for operations on B invalid input: '&' W images segmented by this VOI
    private float
    Sets the minimum blue intensity value for operations on RGB images segmented by this VOI
    private float
    Sets the minimum green intensity value for operations on RGB images segmented by this VOI
    private float
    Sets the minimum red intensity value for operations on RGB images segmented by this VOI
    static final int
    Indicates that the VOI is of type Line made up of two points.
    VOIListeners that are updated when this VOI changes
    private String
    Name of the VOI stored as a string.
    final int
    int indicating that no point was found.
    private float
    When in the solid display mode indicates how opaque the VOI should be.
    static final int
    Indicates that the POINT is of type Line made up of a single point.
    private int
    Indicates if the VOI should mask ones or mask as zeros.
    static final int
    Indicates that the VOI is of type POLYLINE type of contour - end points NOT connected.
    static final int
    Indicates that the VOI is of type POLYLINE that will go through more than one slice.
    private boolean
    If true this flag indicates that the VOI should be included (applied) when processing the image.
    static final int
    Indicates that the VOI is of type PROTRACTOR used to measure angles.
    private static final long
    Use serialVersionUID for interoperability.
    static final int
    Indicates that the VOI should be displayed as a solid and not just a boundary.
    static final int
    Mask as zeros - i.e. put zeros to indicate where the VOI is located
    private int
    The thickness of the VOI lines
    private int
    Unique ID for saving invalid input: '&' retrieving.
    private boolean
    If true the VOI is visible.
    private short
    Used 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

    Constructors
    Constructor
    Description
    VOI(short id, String name)
    Create a VOI with the given id and name.
    VOI(short id, String name, int curveType, float presetHue)
    Constructs a Volume of Interest (VOI).
    VOI(short id, 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

    Modifier and Type
    Method
    Description
    void
    adds the update listener.
    double
    Finds the area of the entire VOI of the VOIContour type only.
    double
    calcLargestDistance(BitSet mask, int[] extents, float[] res)
    Calculate the distance of the largest line segment contained entirely within the VOI
    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)
     
    Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)
    void
    createActiveContourBinaryMask(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.
    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.
    void
    createBinaryMask(int xDim, int yDim, int slice, BitSet mask, boolean XOR, boolean onlyActive)
    Creates a binary mask at a slice.
    void
    createBinaryMask3D(BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive)
    Creates a 3D binary mask.
    void
    createOneElementBinaryMask3D(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 intervals
    void
     
    boolean
    two 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.Vector3f
    Returns the first point.
    Vector<WildMagic.LibFoundation.Mathematics.Vector3f>
    exportPoints(int slice)
    Get Vector3fs from the VOI; can only use with Point.
    exportPolygon(int iSlice)
     
    void
     
    private WildMagic.LibFoundation.Mathematics.Vector3f
    findMaxWidth(WildMagic.LibFoundation.Mathematics.Vector3f pt, double[] maxDistance, boolean bOnlyActive)
    This is used by the method maxWidth.
    protected void
    Fires a VOI event based on the VOI. calls the listener's addedVOI() method.
    protected void
    Fires a VOI event based on the VOI. calls the listener's removedVOI() method.
    protected void
    Deprecated.
    protected void
    Fires a VOI event based on the VOI. calls the listener's removedVOI() method.
    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
    boolean
    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.
    Accessor that returns the VOI's color.
     
    Returns the contour graph associated with this voi.
    Accessor that returns the curves making up the VOI.
    int
    Accessor that returns the curve type.
    int
    Accessor that returns the display mode.
    Accessor that returns the VOI extension.
    WildMagic.LibFoundation.Mathematics.Vector3f
    Returns the geometric center of the VOI (only contour).
    short
    Accessor that returns the ID.
    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.
    float
    Accessor that returns the maximum of the range of intensities to ignore.
    float
    Accessor that returns the maximum of the range of blue intensities to ignore.
    float
    Accessor that returns the maximum of the range of green intensities to ignore.
    float
    Accessor that returns the maximum of the range of red intensities to ignore.
    float
    Accessor that returns the minimum of the range of intensities to ignore.
    float
    Accessor that returns the minimum of the range of blue intensities to ignore.
    float
    Accessor that returns the minimum of the range of green intensities to ignore.
    float
    Accessor that returns the minimum of the range of red intensities to ignore.
    Accessor that returns the name of the VOI.
    int
    Get the number of points in the VOI file.
    float
    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
    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
    Accessor that returns whether voi is included in processing.
    int
    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.
    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.
    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.
    int
    Returns the thickness of the VOI
    int
    Accessor that returns the Unique ID (original hash code for object).
    int
    Returns the number of z slices actually containing part of the voi
    short
    getWatershedID - accessor that returns the watershedID.
    boolean
     
    importCurve(float[] x, float[] y, float[] z)
    Imports a new curve into this voi.
    void
    importCurve(int[] x, int[] y, int[] z)
     
    void
    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(Polygon gon, int slice)
    Imports the polygon into the VOI (must be a contour).
    boolean
    Accessor that tells if the VOI is active.
    boolean
    Returns true iff all contours in this VOI are active.
    boolean
    Test whether or not the VOI is empty.
    boolean
    Accessor that tells if VOI is fixed.
    boolean
    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
     
    void
    Clears VOI of all curves at a slice.
    void
    Clears VOI of all curves.
    void
    removeCurves(int slice)
    Deprecated. 
    void
    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(Color color)
    Accessor that sets the color to the parameter.
    void
     
    void
    Accessor that sets the contourGraph to the parameter.
    void
    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(String extension)
    Sets the VOI extenstion of voi file name of voi was read in through file
    void
    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
    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 VOI
    void
    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. 
     
    void
    Trims all active contours in the VOI based on the Preferences getTrim and getTrimAdjacent values.
    void
     
    void
     

    Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable

    nativeClone

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • FORWARD

      public static final int FORWARD
      Static Variables for VOI and VOI Contour selection.
      See Also:
    • BACKWARD

      public static final int BACKWARD
      Static Variables for VOI and VOI Contour selection.
      See Also:
    • FRONT

      public static final int FRONT
      Static Variables for VOI and VOI Contour selection.
      See Also:
    • BACK

      public static final int BACK
      Static Variables for VOI and VOI Contour selection.
      See Also:
    • BOUNDARY

      public static final int BOUNDARY
      Indicates only the boundary of the VOI should be displayed.
      See Also:
    • SOLID

      public static final int SOLID
      Indicates that the VOI should be displayed as a solid and not just a boundary.
      See Also:
    • ADDITIVE

      public static final int ADDITIVE
      Mask as ones - i.e. put ones to indicate VOI location
      See Also:
    • SUBTRACTIVE

      public static final int SUBTRACTIVE
      Mask as zeros - i.e. put zeros to indicate where the VOI is located
      See Also:
    • CONTOUR

      public static final int CONTOUR
      Indicates that the VOI is of type CONTOUR.
      See Also:
    • POLYLINE

      public static final int POLYLINE
      Indicates that the VOI is of type POLYLINE type of contour - end points NOT connected.
      See Also:
    • LINE

      public static final int LINE
      Indicates that the VOI is of type Line made up of two points.
      See Also:
    • POINT

      public static final int POINT
      Indicates that the POINT is of type Line made up of a single point.
      See Also:
    • PROTRACTOR

      public static final int PROTRACTOR
      Indicates that the VOI is of type PROTRACTOR used to measure angles.
      See Also:
    • ANNOTATION

      public static final int ANNOTATION
      Indicates that the VOI is of type ANNOTATION for adding text annotations to an image.
      See Also:
    • CARDIOLOGY

      public static final int CARDIOLOGY
      Indicates that the VOI is of type CARDIOLOGY, special VOI for specific tasks needed in cardiology.
      See Also:
    • 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:
    • NOT_A_POINT

      public final int NOT_A_POINT
      int indicating that no point was found.
      See Also:
    • boundingBox

      private boolean boundingBox
      If true the bounding box of the VOI should be displayed.
    • color

      private 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 invalid input: '&' W images segmented by this VOI
    • ignoreMin

      private float ignoreMin
      Sets the minimum intensity value for operations on B invalid input: '&' 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 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 invalid input: '&' 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 String extension
      extension of voi file name of voi was read in through file
    • active

      private boolean active
    • listenerList

      public transient EventListenerList listenerList
      VOIListeners that are updated when this VOI changes
    • comments

      private ArrayList<String> comments
  • Constructor Details

    • VOI

      public VOI(short id, String name)
      Create a VOI with the given id and name.
      Parameters:
      id - identifier of VOI
      name - name of the VOI
    • VOI

      public VOI(short id, String name, int curveType, float presetHue)
      Constructs a Volume of Interest (VOI).
      Parameters:
      id - identifier of VOI
      name - name of the VOI
      curveType - type of curve, either a line or a contour
      presetHue - If presetHue >= 0.0, use this value as the hue
    • VOI

      public VOI(short id, String name, int curveType, float presetHue, int initialCapacity)
      Constructs a Volume of Interest (VOI).
      Parameters:
      id - identifier of VOI
      name - name of the VOI
      curveType - type of curve, either a line or a contour
      presetHue - 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 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

      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(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 Object clone()
      Clone function that calls the super (modelserializable) clone and then manually copies references to the transient VOIListeners (eventlistenerlist)
      Overrides:
      clone in class ModelSerialCloneable
      Returns:
      The cloned object. Null if there was an error.
    • createActiveContourBinaryMask

      public void createActiveContourBinaryMask(BitSet mask, int xDim, int yDim)
      Creates a binary mask at every slice.
      Parameters:
      mask - the binary mask
      xDim - x dimension, used to index into the image
      yDim - 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 VOI
      onlyActive - Only mask regions that are active (i.e. selected )
    • createBinaryMask

      public 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 image
      yDim - y dimension, used to index into the image
      slice - 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 image
      yDim - y dimension, used to index into the image
      slice - slice to create mask at
      mask - the binary mask
      XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
      onlyActive - Only mask regions that are active (i.e. selected )
    • createBinaryMask

      public 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 image
      yDim - y dimension, used to index into the image
      slice - slice to create mask at
      contour - element of VOI
      Returns:
      mask the binary mask
    • createBinaryMask3D

      public void createBinaryMask3D(BitSet mask, int xDim, int yDim, boolean XOR, boolean onlyActive)
      Creates a 3D binary mask.
      Parameters:
      mask - mask written into
      xDim - 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 VOI
      onlyActive - 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 into
      xDim - 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 VOI
      onlyActive - 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 1
      XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
      onlyActive - 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 mask
      xDim - x dimension, used to index into the image
      yDim - y dimension, used to index into the image
      zDim - z dimension, used to index into the image
      XOR - 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 1
      XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
      onlyActive - Only mask regions that are active (i.e. selected )
    • dispose

      public void dispose()
    • equals

      public boolean equals(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 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 Throwable
      Overrides:
      finalize in class Object
      Throws:
      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 dimension
      y - two element array where y[0] = min extent of the Contour and y[1] = max extent of the Contour in the y dimension
      z - 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 dimension
      y - two element array where y[0] = min extent of the Contour and y[1] = max extent of the Contour in the y dimension
      z - 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 Color getColor()
      Accessor that returns the VOI's color.
      Returns:
      the color
    • getComments

      public ArrayList<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 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 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 located
      contourNo - the contour within the image slice
      position - position of the line (x-coordinates)
      intensity - intensity of the line (y-coordinates)
      imageBuffer - image buffer
      xDim - 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 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 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 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 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 located
      voiSlice - voiSlice indicates the slice where the contour(s) is to be copied from
      voi - added to VOI
      resize - 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(Polygon gon, int slice)
      Imports the polygon into the VOI (must be a contour).
      Parameters:
      gon - polygon to import
      slice - index of slice of new polygon
    • exportPolygon

      public Vector<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 located
      xDim - x dimension maximum
      yDim - y dimension maximum
      zDim - z dimension maximum
      xM - amount in pixels to move the line in the x direction
      yM - amount in pixels to move the line in the y direction
      zM - 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 line
      y - y coordinate of line
      slice - 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 point
      y - y coordinate of point
      slice - 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-position
      y - input y-position
      z - 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(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(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(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(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 dimension
      yDim - y dimension
    • toString

      public String toString()
      Overrides:
      toString in class 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's addedVOI() 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's removedVOI() method.
      Parameters:
      curve - curve removed from this VOI.
    • fireVOIColorChange

      protected void fireVOIColorChange(Color color)
      Deprecated.
      Parameters:
      color -
    • fireVOIselection

      protected void fireVOIselection()
      Fires a VOI event based on the VOI. calls the listener's removedVOI() method.