edu.uthscsa.ric.mango
Interface BasicController

All Known Subinterfaces:
ViewerController

public interface BasicController

BasicController serves as an interface between MangoPlugin and the viewer window and toolbox. It provides methods to gather information about viewer state, update the viewer, as well as methods to fetch MangoData and other ViewerController objects.


Field Summary
static int SLICE_DIRECTION_AXIAL
           
static int SLICE_DIRECTION_CORONAL
           
static int SLICE_DIRECTION_SAGITTAL
           
 
Method Summary
 void addKeyListener(KeyListener kl)
          Adds a key listener to the viewer.
 void addMouseListener(MouseListener ml, int sliceDir)
          Adds a mouse listener to a screen slice.
 void addMouseMotionListener(MouseMotionListener ml, int sliceDir)
          Adds a mouse motion listener to a screen slice.
 void addOverlay(URI uri, ImageVolume imageVolume, String colorTable, double transparency)
          Add an overlay to the viewer.
 void addSliceListener(SliceListener sl, int sliceDirection)
          Adds a slice listener, which will be notified anytime a slice's position has changed.
 void addTransform(int type, double[][] mat, String name)
          Deprecated.  
 void buildSurface()
          Build a surface using a default set of parameters.
 void convertIndexToWorldCoordinate(Coordinate coor)
          Converts in place a coordinate from index to world space.
 void convertWorldToIndexCoordinate(Coordinate coor)
          Converts in place a coordinate from world to index space.
 void doClickMenuItem(String name)
          Used to programmatically click a viewer menu item.
 void doMagicWandPreserve(Point point)
          Perform "magic wand" preserve operation on main slice.
 void doMagicWandRemove(Point point)
          Perform "magic wand" remove operation on main slice.
 Atlas getAtlas()
          Returns current atlas.
 int getCoordinateType()
          Returns the currently selected coordinate type.
 Coordinate getCurrentCoordinate(Coordinate coor)
          Returns the current coordinate.
 Coordinate getCurrentIndex(Coordinate coor)
          Returns the current coordinate index.
 int getCurrentOverlayIndex()
          Returns the index value of the currently selected overlay.
 int getCurrentROI()
          Deprecated.  
 int getCurrentTimepoint()
          Returns the currently selected timepoint.
 int getCurrentTransformIndex()
          Deprecated.  
 Coordinate getImageOrigin()
          Returns the image origin.
 String getImageTitle()
          Returns the name of the image.
 File getLoadedFile()
          Returns a file for the loaded base image of this viewer.
 BufferedImage getMainImage()
          Returns a rendering of the main slice view.
 BufferedImage getMainImage(boolean exclude)
          Returns a rendering of the main slice view.
 BufferedImage getMainImage(BufferedImage bi, int slice)
          Returns a rendering of the main slice view.
 BufferedImage getMainImage(BufferedImage bi, int slice, boolean exclude)
          Returns a rendering of the main slice view.
 BufferedImage getMainImage(BufferedImage bi, int slice, int timeIndex, boolean exclude)
          Returns a rendering of the main slice view.
 int getMainSliceDirection()
          Returns the slice direction of the main slice view.
 int getMainSlicePosition()
          Returns the slice position of the main slice view.
 MangoData getMangoData()
          This can be used to update the MangoData object.
 String getMangoVersion()
          Returns the Mango version.
 int getROIColor()
          Returns the current ROI color index.
 int getROITool()
          Returns the current ROI tool code.
 AffineTransform getScreenTransform(int dir)
          Returns the screen transform (can be used to convert mouse coordinates to image coordinates).
 Point getViewerLocation()
          Returns the location of the viewer on the screen.
 Dimension getViewerSize()
          Returns the viewer dimensions in pixels.
 void importROI(URI uri, boolean forceWorldSpace, boolean isMangoROI)
          Imports an image as an ROI.
 boolean isClosing()
          Returns true if viewer is in the process of closing.
 boolean isInWorkingState()
          Returns true if viewer is doing an ROI or image operation, analyzing statistics, saving, or if navigation is disabled.
 boolean isRadiologicalMode()
          Returns true if radiological mode is being used.
 boolean isVOIMode()
          Returns the VOI mode state.
 int lookupDefaultBlue(int index)
          Returns the blue lookup value for the default "Spectrum" lookup table.
 int lookupDefaultGreen(int index)
          Returns the green lookup value for the default "Spectrum" lookup table.
 int lookupDefaultRed(int index)
          Returns the red lookup value for the default "Spectrum" lookup table.
 ImageVolume makeNewVolume()
          Create a new ImageVolume object.
 BufferedImage makePluginOverlay(int sliceDirection)
          Makes a static slice overlay for painting by a plugin.
 ProgressMeter makeProgressMeter()
          Creates a progress meter.
 ProgressMeter makeProgressMeter(String des)
          Deprecated.  
 void pluginOperationCompleted()
          Notifies the viewer that plugin operation has been completed.
 void removeKeyListener(KeyListener kl)
          Removes a key listener from the viewer.
 void removeMouseListener(MouseListener ml, int sliceDir)
          Removes a mouse listener from a screen slice.
 void removeMouseMotionListener(MouseMotionListener ml, int sliceDir)
          Removes a mouse motion listener from a screen slice.
 void removePluginOverlays()
          Removes all plugin overlays.
 void removeSliceListener(SliceListener sl, int sliceDirection)
          Removes a slice listener.
 void removeTopOverlay()
          Removes the top overlay in the stack.
 void repaint()
          Repaints the viewer.
 void setCoordinateType(int type)
          Set the coordinate type.
 void setCurrentCoordinate(Coordinate coor)
          Sets the current coordinate.
 void setCurrentIndex(Coordinate coor)
          Sets the current index.
 void setCurrentTimepoint(int timepoint)
          Sets the current timepoint.
 void setCurrentTimepoint(int timepoint, ImageVolume volume)
          Sets the current timepoint.
 void setImageOrigin(Coordinate coor)
          Deprecated.  
 void setMainSliceDirection(int sliceDirection)
          Sets the slice direction of the main slice view.
 void setMainSlicePosition(int slicePos)
          Sets the main slice view position.
 void setNavigationDisabledState(boolean bool)
          Disables navigation, puts viewer into "working state".
 void setOriginTo(Coordinate coor)
          Sets the origin.
 void setROIColor(int color)
          Sets the current ROI color.
 void setROITool(int tool)
          Sets the current ROI tool code:
 void setShowLowerCrosshairs(boolean show)
          Used to toggle the display of the lower slice views crosshairs.
 void setShowMainCrosshairs(boolean show)
          Used to toggle the display of the main slice view crosshairs.
 void setStopPaintingState(boolean bool)
          Disables viewer painting.
 void updateRange()
          Scans the base image for its minimum and maximum values and updates the viewer with this range.
 void updateRange(ScreenImage si)
          Scans a ScreenImage for its minimum and maximum values.
 void updateToolBox()
          Updates the toolbox.
 void updateViewer()
          Updates the image and ROI slice data.
 void useTransform(boolean use)
          Toggles on/off the image transform.
 

Field Detail

SLICE_DIRECTION_AXIAL

static final int SLICE_DIRECTION_AXIAL
See Also:
Constant Field Values

SLICE_DIRECTION_CORONAL

static final int SLICE_DIRECTION_CORONAL
See Also:
Constant Field Values

SLICE_DIRECTION_SAGITTAL

static final int SLICE_DIRECTION_SAGITTAL
See Also:
Constant Field Values
Method Detail

addKeyListener

void addKeyListener(KeyListener kl)
Adds a key listener to the viewer.

Parameters:
kl - the key listener to add

addMouseListener

void addMouseListener(MouseListener ml,
                      int sliceDir)
Adds a mouse listener to a screen slice.

Parameters:
ml - the mouse listener to add
sliceDir - the slice direction

addMouseMotionListener

void addMouseMotionListener(MouseMotionListener ml,
                            int sliceDir)
Adds a mouse motion listener to a screen slice.

Parameters:
ml - the mouse motion listener to add
sliceDir - the slice direction

addOverlay

void addOverlay(URI uri,
                ImageVolume imageVolume,
                String colorTable,
                double transparency)
Add an overlay to the viewer.

Parameters:
uri - header file
imageVolume - the volume to overlay
colorTable - name of color table (if null, color table is automatically selected)
transparency - transparency

addSliceListener

void addSliceListener(SliceListener sl,
                      int sliceDirection)
Adds a slice listener, which will be notified anytime a slice's position has changed.

Parameters:
sl - the SliceListener to add
sliceDirection - the slice direction

buildSurface

void buildSurface()
Build a surface using a default set of parameters.


convertIndexToWorldCoordinate

void convertIndexToWorldCoordinate(Coordinate coor)
Converts in place a coordinate from index to world space.

Parameters:
coor - the coordinate

convertWorldToIndexCoordinate

void convertWorldToIndexCoordinate(Coordinate coor)
Converts in place a coordinate from world to index space.

Parameters:
coor - the coordinate

doClickMenuItem

void doClickMenuItem(String name)
Used to programmatically click a viewer menu item.

Parameters:
name - menu item name

doMagicWandPreserve

void doMagicWandPreserve(Point point)
Perform "magic wand" preserve operation on main slice. Removes unconnected ROIs, leaving ROI at location unchanged.

Parameters:
point - point in current slice to perform operation

doMagicWandRemove

void doMagicWandRemove(Point point)
Perform "magic wand" remove operation on main slice. Removes ROI at location, leaving unconnected ROIs unchanged.

Parameters:
point - point in current slice to perform operation

getAtlas

Atlas getAtlas()
Returns current atlas.

Returns:
the atlas, or null if none were found by that name

getCoordinateType

int getCoordinateType()
Returns the currently selected coordinate type.

Returns:
the currently selected coordinate type

getCurrentCoordinate

Coordinate getCurrentCoordinate(Coordinate coor)
Returns the current coordinate. The returned values reflect the currently selected coordinate type.

Parameters:
coor - (optional) this Coordinate's values will be replaced with that of the current coordinate
Returns:
a new Coordinate with the values of the current coordinate, or if the param is not null, then coor

getCurrentIndex

Coordinate getCurrentIndex(Coordinate coor)
Returns the current coordinate index.

Parameters:
coor - (optional) this Coordinate's values will be replaced with that of the current coordinate
Returns:
a new Coordinate with the values of the current coordinate, or if the param is not null, then coor

getCurrentOverlayIndex

int getCurrentOverlayIndex()
Returns the index value of the currently selected overlay.

Returns:
index value of the currently selected overlay

getCurrentTimepoint

int getCurrentTimepoint()
Returns the currently selected timepoint.

Returns:
the current timepoint

getImageOrigin

Coordinate getImageOrigin()
Returns the image origin.

Returns:
the image origin

getImageTitle

String getImageTitle()
Returns the name of the image.

Returns:
the name of the image

getLoadedFile

File getLoadedFile()
Returns a file for the loaded base image of this viewer.

Returns:
the loaded file

getMainImage

BufferedImage getMainImage()
Returns a rendering of the main slice view. If operating in a new thread, you may want to call setStopPaintingState() and setNavigationDisabledState() first. If several slices are needed, successive calls can use getMainImage(BufferedImage bi, int slice).

Returns:
the rendered image

getMainImage

BufferedImage getMainImage(boolean exclude)
Returns a rendering of the main slice view. If operating in a new thread, you may want to call setStopPaintingState() and setNavigationDisabledState() first. If several slices are needed, successive calls can use getMainImage(BufferedImage bi, int slice, boolean exclude).

Parameters:
exclude - exclude non-image information (e.g., ROIs)
Returns:
the rendered image

getMainImage

BufferedImage getMainImage(BufferedImage bi,
                           int slice)
Returns a rendering of the main slice view.

Parameters:
bi - the image in which to store the image (typical to call after calling the no-arg method first)
slice - the slice to render
Returns:
the rendered image

getMainImage

BufferedImage getMainImage(BufferedImage bi,
                           int slice,
                           boolean exclude)
Returns a rendering of the main slice view.

Parameters:
bi - the image in which to store the image (typical to call after calling the no-arg method first)
slice - the slice to render
exclude - exclude non-image information (e.g., ROIs)
Returns:
the rendered image

getMainImage

BufferedImage getMainImage(BufferedImage bi,
                           int slice,
                           int timeIndex,
                           boolean exclude)
Returns a rendering of the main slice view.

Parameters:
bi - the image in which to store the image (typical to call after calling the no-arg method first)
slice - the slice to render
timeIndex - the timepoint to render (note, you must manually set the timepoint back to the correct position after this method is called)
exclude - exclude non-image information (e.g., ROIs)
Returns:
the rendered image

getMainSliceDirection

int getMainSliceDirection()
Returns the slice direction of the main slice view.

Returns:
slice direction of the main slice view

getMainSlicePosition

int getMainSlicePosition()
Returns the slice position of the main slice view.

Returns:
slice position of the main slice view

getMangoData

MangoData getMangoData()
This can be used to update the MangoData object.

Returns:
an updated MangoData object

getMangoVersion

String getMangoVersion()
Returns the Mango version.

Returns:
version

getROIColor

int getROIColor()
Returns the current ROI color index.

Returns:
the current ROI color index

getROITool

int getROITool()
Returns the current ROI tool code. (See http://rii.uthscsa.edu/mango/webmango_control.html for a list of codes.)

Returns:
the current ROI tool code

getScreenTransform

AffineTransform getScreenTransform(int dir)
Returns the screen transform (can be used to convert mouse coordinates to image coordinates).

Parameters:
dir - the slice direction
Returns:
the screen transform

getViewerLocation

Point getViewerLocation()
Returns the location of the viewer on the screen.

Returns:
the location of the viewer

getViewerSize

Dimension getViewerSize()
Returns the viewer dimensions in pixels.

Returns:
the viewer dimensions

importROI

void importROI(URI uri,
               boolean forceWorldSpace,
               boolean isMangoROI)
Imports an image as an ROI. Any non-zero voxel in the loaded image sets the ROI to the current color at that location. If in world mode, the ROI is positioned relative to the origin, otherwise it is based on millimeter distance from the LAS corner.

Parameters:
uri - the image file to load
forceWorldSpace - true if it is necessary that the image be added in world space
isMangoROI - true if this file represents a MangoROI

isClosing

boolean isClosing()
Returns true if viewer is in the process of closing.

Returns:
true if viewer is closing

isInWorkingState

boolean isInWorkingState()
Returns true if viewer is doing an ROI or image operation, analyzing statistics, saving, or if navigation is disabled.

Returns:
true if viewer is in working state

isRadiologicalMode

boolean isRadiologicalMode()
Returns true if radiological mode is being used.

Returns:
true if radiological mode

isVOIMode

boolean isVOIMode()
Returns the VOI mode state. In VOI mode, an ROI is considered as a volume. In ROI mode, an ROI is considered as an area.

Returns:
the VOI mode state

lookupDefaultBlue

int lookupDefaultBlue(int index)
Returns the blue lookup value for the default "Spectrum" lookup table.

Parameters:
index - the index to lookup (0 - 255).
Returns:
the blue lookup value

lookupDefaultGreen

int lookupDefaultGreen(int index)
Returns the green lookup value for the default "Spectrum" lookup table.

Parameters:
index - the index to lookup (0 - 255).
Returns:
the green lookup value

lookupDefaultRed

int lookupDefaultRed(int index)
Returns the red lookup value for the default "Spectrum" lookup table.

Parameters:
index - the index to lookup (0 - 255).
Returns:
the red lookup value

makeNewVolume

ImageVolume makeNewVolume()
Create a new ImageVolume object. Useful if plugin is loading volume resources. See ImageVolume.readFiles().

Returns:
new ImageVolume object

makePluginOverlay

BufferedImage makePluginOverlay(int sliceDirection)
Makes a static slice overlay for painting by a plugin.

Parameters:
sliceDirection - slice direction of the main slice view
Returns:
the overlay data as an ARGB BufferedImage

makeProgressMeter

ProgressMeter makeProgressMeter()
Creates a progress meter.

Returns:
the progress meter

pluginOperationCompleted

void pluginOperationCompleted()
Notifies the viewer that plugin operation has been completed.


removeKeyListener

void removeKeyListener(KeyListener kl)
Removes a key listener from the viewer.

Parameters:
kl - the key listener to remove

removeMouseListener

void removeMouseListener(MouseListener ml,
                         int sliceDir)
Removes a mouse listener from a screen slice.

Parameters:
ml - the mouse listener to remove
sliceDir - the slice direction

removeMouseMotionListener

void removeMouseMotionListener(MouseMotionListener ml,
                               int sliceDir)
Removes a mouse motion listener from a screen slice.

Parameters:
ml - the mouse motion listener to remove
sliceDir - the slice direction

removePluginOverlays

void removePluginOverlays()
Removes all plugin overlays.


removeSliceListener

void removeSliceListener(SliceListener sl,
                         int sliceDirection)
Removes a slice listener.

Parameters:
sl - the SliceListener to remove
sliceDirection - the slice direction

removeTopOverlay

void removeTopOverlay()
Removes the top overlay in the stack.


repaint

void repaint()
Repaints the viewer.


setCoordinateType

void setCoordinateType(int type)
Set the coordinate type.

Parameters:
type - the coordinate type

setCurrentCoordinate

void setCurrentCoordinate(Coordinate coor)
Sets the current coordinate. The values of coor are considered relative to the currently selected coordinate space.

Parameters:
coor - the Coordinate to set the current coordinate values

setCurrentIndex

void setCurrentIndex(Coordinate coor)
Sets the current index.

Parameters:
coor - the Coordinate to set the current coordinate values

setCurrentTimepoint

void setCurrentTimepoint(int timepoint)
Sets the current timepoint.

Parameters:
timepoint - current timepoint

setCurrentTimepoint

void setCurrentTimepoint(int timepoint,
                         ImageVolume volume)
Sets the current timepoint.

Parameters:
timepoint - current timepoint
volume - if multiple overlay timeseries are loaded, all other overlays will be aligned in time to this volume

setMainSliceDirection

void setMainSliceDirection(int sliceDirection)
Sets the slice direction of the main slice view.

Parameters:
sliceDirection - slice direction of the main slice view

setMainSlicePosition

void setMainSlicePosition(int slicePos)
Sets the main slice view position.

Parameters:
slicePos - main slice view position

setNavigationDisabledState

void setNavigationDisabledState(boolean bool)
Disables navigation, puts viewer into "working state".

Parameters:
bool - true to enable navigation disabled state

setOriginTo

void setOriginTo(Coordinate coor)
Sets the origin.

Parameters:
coor - the new origin

setROIColor

void setROIColor(int color)
Sets the current ROI color.

Parameters:
color - index (0=red, 1=green, etc.)

setROITool

void setROITool(int tool)
Sets the current ROI tool code:
 Navigation:
         0 = navigation
 
 Painting tools:
   1 = ellipse edit
   2 = ellipse erase
   3 = ellipse paint
   4 = rectangle edit
   5 = rectangle erase
   6 = rectangle paint
   
 Drawing tools:
   7 = draw rectangle
   8 = draw ellipse
   9 = trace region
   10 = trace line
   11 = add point
   
 Magic wand tools:
   12 = add region
   13 = preserve region
   14 = remove region
   15 = dilate/erode region
   16 = copy regiom
 

Parameters:
tool - code

setShowLowerCrosshairs

void setShowLowerCrosshairs(boolean show)
Used to toggle the display of the lower slice views crosshairs.

Parameters:
show - if true, the lower slice views crosshairs will be displayed

setShowMainCrosshairs

void setShowMainCrosshairs(boolean show)
Used to toggle the display of the main slice view crosshairs.

Parameters:
show - if true, the main slice view crosshairs will be displayed

setStopPaintingState

void setStopPaintingState(boolean bool)
Disables viewer painting.

Parameters:
bool - true to enable "stop painting" state

updateRange

void updateRange()
Scans the base image for its minimum and maximum values and updates the viewer with this range. The same as calling udpateRange(getMangoData().getBaseImage().getScreenImage()).


updateRange

void updateRange(ScreenImage si)
Scans a ScreenImage for its minimum and maximum values. If this ScreenImage is currently selected on the toolbox image stack, then its values will be updated.

Parameters:
si - the ScreenImage to update

updateToolBox

void updateToolBox()
Updates the toolbox.


updateViewer

void updateViewer()
Updates the image and ROI slice data.


useTransform

void useTransform(boolean use)
Toggles on/off the image transform.

Parameters:
use - true to turn on the transform, false otherwise.

addTransform

@Deprecated
void addTransform(int type,
                             double[][] mat,
                             String name)
Deprecated. 

Adds a transform to the viewer.

Parameters:
type - the ImageTransform type
mat - new transformation matrix as a 4x4 two-dimensional array
name - a name for the transform

getCurrentROI

@Deprecated
int getCurrentROI()
Deprecated. 

Returns the current ROI index. [Use getROIColor() instead.]

Returns:
the current ROI index

getCurrentTransformIndex

@Deprecated
int getCurrentTransformIndex()
Deprecated. 

Returns the index value of the currently selected transform.

Returns:
index value of the currently selected transform

makeProgressMeter

@Deprecated
ProgressMeter makeProgressMeter(String des)
Deprecated. 

Creates a progress meter.

Parameters:
des - the text to be displayed on the progress meter
Returns:
the progress meter
See Also:
makeProgressMeter()

setImageOrigin

@Deprecated
void setImageOrigin(Coordinate coor)
Deprecated. 

Sets the image origin.

Parameters:
coor - the new image origin