edu.uthscsa.ric.mango
Class MangoROI

java.lang.Object
  extended by edu.uthscsa.ric.mango.MangoROI

public class MangoROI
extends Object

MangoROI contains all of the ROI data associated with a viewer. Methods are provided to access and replace ROI data stored as area masks, line shapes, and points.


Field Summary
static int SLICE_DIRECTION_AXIAL
           
static int SLICE_DIRECTION_CORONAL
           
static int SLICE_DIRECTION_SAGITTAL
           
 
Constructor Summary
protected MangoROI(ROIMaskManager rm, ShapesManager[] sm, ShapesSpecialManager[] ssm, PointsManager pm, PointsSpecialManager psm)
           
 
Method Summary
 void addImmutablePoint(Coordinate point, Color color)
          Adds a point that cannot be moved by the user and can only be removed programatically.
 Shape addImmutableShape(int sliceDirection, int slice, Shape shape, Color color, Stroke stroke)
          Adds a shape that cannot be edited by the user and can only be removed programatically.
 Shape addImmutableStaticShape(int sliceDirection, Shape shape, Color color, Stroke stroke)
          Adds a shape that cannot be edited by the user, exists simultaneously on all slices, and can only be removed programatically.
 void addPoint(Coordinate point, int color)
          Adds a point.
 void addROIMaskValue(int xLoc, int yLoc, int zLoc, byte roiVal)
          Adds an ROI value at a specified XYZ index coordinate.
 Shape addShape(int sliceDirection, int slice, int color, Shape shape)
          Add a shape of a specified color within a slice.
 void addSpecialPoint(Coordinate point, Color color)
          Adds a point that can be moved by the user but can only be removed programatically.
 Shape addSpecialShape(int sliceDirection, int slice, Color color, Shape shape, Stroke stroke)
          Adds a shape that can be edited by the user but can only be removed programatically.
 Coordinate[] getPoints(int color)
          Gets all points of a specified color.
 ByteBuffer getROIMaskBuffer()
          Returns the ROI work buffer, for use with advanced methods.
 byte getROIMaskValue(int xLoc, int yLoc, int zLoc)
          Gets an ROI value at a specified XYZ index coordinate.
 byte getROISelectedMask()
          Returns the "selected" state of the ROI mask.
 byte getROIUsedMask()
          Returns the "used" state of the ROI mask.
 Shape[] getShapes(int sliceDirection, int slice, int color)
          Gets all shapes of a specified color within a slice.
 Coordinate[] getSpecialPoints(Color color)
          Gets all special points of a specified color.
 Shape[] getSpecialShapes(int sliceDirection, int slice, Color color)
          Gets all special shapes of a specified color within a slice.
 void removePoint(Coordinate point, int color)
          Removes a point.
 void removeShape(int sliceDirection, Shape shape)
          Remove a shape.
 void removeSpecialPoint(Coordinate point, Color color)
          Removes a special point.
 void removeSpecialShape(int sliceDirection, Shape shape)
          Remove a special shape.
 void replaceROIMaskValue(int xLoc, int yLoc, int zLoc, byte roiVal)
          Replace an ROI value at a specified XYZ index coordinate.
 void roiMaskOperationCompleted()
          Notifies ROI manager that an ROI operation has been performed.
 void roiMaskOperationCompleted(String des)
          Notifies ROI manager that an ROI operation has been performed.
 void setPointHighlightState(Coordinate point, Color color, boolean highlight)
          Sets the highlight state of a special point.
 void setShapeHighlightState(int sliceDirection, Shape shape, boolean highlight)
          Sets the highlight state of a special shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLICE_DIRECTION_AXIAL

public static final int SLICE_DIRECTION_AXIAL
See Also:
Constant Field Values

SLICE_DIRECTION_CORONAL

public static final int SLICE_DIRECTION_CORONAL
See Also:
Constant Field Values

SLICE_DIRECTION_SAGITTAL

public static final int SLICE_DIRECTION_SAGITTAL
See Also:
Constant Field Values
Constructor Detail

MangoROI

protected MangoROI(ROIMaskManager rm,
                   ShapesManager[] sm,
                   ShapesSpecialManager[] ssm,
                   PointsManager pm,
                   PointsSpecialManager psm)
Method Detail

replaceROIMaskValue

public void replaceROIMaskValue(int xLoc,
                                int yLoc,
                                int zLoc,
                                byte roiVal)
Replace an ROI value at a specified XYZ index coordinate. An ROI value is a one-byte bit map representing the state of eight possible ROIs for a voxel.

Parameters:
xLoc - the X index
yLoc - the Y index
zLoc - the Z index
roiVal - the value to write

addROIMaskValue

public void addROIMaskValue(int xLoc,
                            int yLoc,
                            int zLoc,
                            byte roiVal)
Adds an ROI value at a specified XYZ index coordinate. An ROI value is a one-byte bit map representing the state of eight possible ROIs for a voxel. The call addROIValue(0, 0, 0, 1) is equivalent to replaceROIValue(0, 0, 0, getROIValue(0, 0, 0) | 1).

Parameters:
xLoc - the X index
yLoc - the Y index
zLoc - the Z index
roiVal - the value to add

getROIMaskValue

public byte getROIMaskValue(int xLoc,
                            int yLoc,
                            int zLoc)
Gets an ROI value at a specified XYZ index coordinate. An ROI value is a one-byte bit map representing the state of eight possible ROIs for a voxel.

Parameters:
xLoc - the X index
yLoc - the Y index
zLoc - the Z index
Returns:
the ROI value at the specified index coordinate

addShape

public Shape addShape(int sliceDirection,
                      int slice,
                      int color,
                      Shape shape)
Add a shape of a specified color within a slice.

Parameters:
sliceDirection - axial, coronal, or sagittal
slice - the slice index
color - the color value
shape - the shape to add

addSpecialShape

public Shape addSpecialShape(int sliceDirection,
                             int slice,
                             Color color,
                             Shape shape,
                             Stroke stroke)
Adds a shape that can be edited by the user but can only be removed programatically.

Parameters:
sliceDirection - axial, coronal, or sagittal
slice - the slice index
color - the color value
shape - the shape to add

addImmutableShape

public Shape addImmutableShape(int sliceDirection,
                               int slice,
                               Shape shape,
                               Color color,
                               Stroke stroke)
Adds a shape that cannot be edited by the user and can only be removed programatically.

Parameters:
sliceDirection - axial, coronal, or sagittal
slice - the slice index
shape - the shape to add
color - the color value
stroke - the shape line style

addImmutableStaticShape

public Shape addImmutableStaticShape(int sliceDirection,
                                     Shape shape,
                                     Color color,
                                     Stroke stroke)
Adds a shape that cannot be edited by the user, exists simultaneously on all slices, and can only be removed programatically.

Parameters:
sliceDirection - axial, coronal, or sagittal
shape - the shape to add
color - the color value
stroke - the shape line style

removeShape

public void removeShape(int sliceDirection,
                        Shape shape)
Remove a shape.

Parameters:
sliceDirection - axial, coronal, or sagittal
shape - the shape to remove

removeSpecialShape

public void removeSpecialShape(int sliceDirection,
                               Shape shape)
Remove a special shape.

Parameters:
sliceDirection - axial, coronal, or sagittal
shape - the shape to remove

getShapes

public Shape[] getShapes(int sliceDirection,
                         int slice,
                         int color)
Gets all shapes of a specified color within a slice. For example, getShapes(0, 0, 0) will return all shapes in the first axial slice matching color value 0.

Parameters:
sliceDirection - axial, coronal, or sagittal
slice - the slice index
color - the color value
Returns:
an array of Shapes or null if none are found

getSpecialShapes

public Shape[] getSpecialShapes(int sliceDirection,
                                int slice,
                                Color color)
Gets all special shapes of a specified color within a slice. For example, getShapes(0, 0, 0) will return all shapes in the first axial slice matching color value 0.

Parameters:
sliceDirection - axial, coronal, or sagittal
slice - the slice index
color - the color value
Returns:
an array of Shapes or null if none are found

setShapeHighlightState

public void setShapeHighlightState(int sliceDirection,
                                   Shape shape,
                                   boolean highlight)
Sets the highlight state of a special shape.

Parameters:
sliceDirection - axial, coronal, or sagittal
shape - the shape to change
highlight - true, to set as highlighted

addPoint

public void addPoint(Coordinate point,
                     int color)
Adds a point.

Parameters:
point - the point to add
color - the color value

addSpecialPoint

public void addSpecialPoint(Coordinate point,
                            Color color)
Adds a point that can be moved by the user but can only be removed programatically.

Parameters:
point - the point to add
color - the color value

addImmutablePoint

public void addImmutablePoint(Coordinate point,
                              Color color)
Adds a point that cannot be moved by the user and can only be removed programatically.

Parameters:
point - the point to add
color - the color value

removePoint

public void removePoint(Coordinate point,
                        int color)
Removes a point.

Parameters:
point - the point to remove
color - the color value

removeSpecialPoint

public void removeSpecialPoint(Coordinate point,
                               Color color)
Removes a special point.

Parameters:
point - the point to remove
color - the color value

setPointHighlightState

public void setPointHighlightState(Coordinate point,
                                   Color color,
                                   boolean highlight)
Sets the highlight state of a special point.

Parameters:
point - the point to change
color - the color value
highlight - true, to set as highlighted

getPoints

public Coordinate[] getPoints(int color)
Gets all points of a specified color.

Parameters:
color - the color value
Returns:
an array of all points of the specified color

getSpecialPoints

public Coordinate[] getSpecialPoints(Color color)
Gets all special points of a specified color.

Parameters:
color - the color value
Returns:
an array of all points of the specified color

roiMaskOperationCompleted

public void roiMaskOperationCompleted()
Notifies ROI manager that an ROI operation has been performed.


roiMaskOperationCompleted

public void roiMaskOperationCompleted(String des)
Notifies ROI manager that an ROI operation has been performed.

Parameters:
des - a short description of the operation

getROIUsedMask

public byte getROIUsedMask()
Returns the "used" state of the ROI mask.

Returns:
a byte mask

getROISelectedMask

public byte getROISelectedMask()
Returns the "selected" state of the ROI mask.

Returns:
a byte mask

getROIMaskBuffer

public ByteBuffer getROIMaskBuffer()
Returns the ROI work buffer, for use with advanced methods. The ROI buffer is one greater in each dimension than the image dimensions. ROI buffer data is always stored in XYZ+-- data orientation.

Returns:
the ROI work buffer