com.vistech.roi
Class ROIManager

java.lang.Object
  |
  +--com.vistech.roi.ROIManager
All Implemented Interfaces:
java.awt.event.ActionListener, javax.swing.event.ChangeListener, java.util.EventListener, ShapeEventListener

public class ROIManager
extends java.lang.Object
implements ShapeEventListener, java.awt.event.ActionListener, javax.swing.event.ChangeListener

Creates a number of ROI-related objects required by the QuantAnalyzer application, and facilitates communication between them through events.

Version:
1.0 4 Oct 2000
Author:
Lawrence Rodrigues

Field Summary
protected  ROI2D currentROI
           
protected  CompositeCanvas2D destCanvas
           
protected  PanZoom destPanZoom
           
protected  java.awt.Color drawingColor
           
protected  int imageHeight
           
protected  int imageWidth
           
protected  int maskValue
           
protected  ReportPanel reportPan
           
protected  java.util.Vector roiCollection
           
protected  ROIContext roiContext
           
protected  int roiCount
           
protected  ShapeMarker roiMarker
           
protected  CompositeCanvas2D sourceCanvas
           
protected  PanZoom sourcePanZoom
           
protected  ThresholdAdjPanel thAdjuster
           
protected  int viewerHeight
           
protected  int viewerWidth
           
 
Constructor Summary
ROIManager()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is called when an action event is fired by the JTextField in the ThresholdAdjPanel.
protected  void createROI(java.awt.Shape shape)
          Creates a new ROI2D object for a specified shape, and deposits that ROI on the displayed image.
 javax.swing.JPanel createUI(java.awt.image.BufferedImage img)
          Creates various objects.
 void eraseShapes()
          Erases shapes drawn over the source as well as the destination canvas.
 ROI2D getCurrentROI()
          Returns the current ROI2D object.
 java.awt.Dimension getViewerSize()
          Returns the dimesnions of the viewer frame.
 void reset()
          Erases shapes drawn over the source as well as the destination canvas.
 void setDrawingColor(java.awt.Color color)
          Sets the drawing color of the ROI outline.
 void setMaskValue(int value)
          Sets the mask value of the current ROI.
 void setPanZoom(boolean state)
          Turns the pan/zoom feature on or off.
 void setShapeType(int mode)
          This is a proxy method that sets the current shape type in the roiMarker object.
 void shapeDrawn(ShapeEvent e)
          This method is called when a shape event is received.
 void stateChanged(javax.swing.event.ChangeEvent e)
          This method is called when a change eventis fired by the JSlider in the ThresholdAdjPanel.
protected  void thresholdROI(int thresh)
          Performs the threshold operation on the ROI.
 void updateROI(java.awt.Shape shape)
          For a specified shape, this method calls appropriate methods to create a new ROI object, and to update inforamtion related to this ROI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageWidth

protected int imageWidth

imageHeight

protected int imageHeight

viewerWidth

protected int viewerWidth

viewerHeight

protected int viewerHeight

sourceCanvas

protected CompositeCanvas2D sourceCanvas

destCanvas

protected CompositeCanvas2D destCanvas

roiCollection

protected java.util.Vector roiCollection

roiContext

protected ROIContext roiContext

roiMarker

protected ShapeMarker roiMarker

reportPan

protected ReportPanel reportPan

currentROI

protected ROI2D currentROI

roiCount

protected int roiCount

destPanZoom

protected PanZoom destPanZoom

sourcePanZoom

protected PanZoom sourcePanZoom

thAdjuster

protected ThresholdAdjPanel thAdjuster

drawingColor

protected java.awt.Color drawingColor

maskValue

protected int maskValue
Constructor Detail

ROIManager

public ROIManager()
Method Detail

createUI

public javax.swing.JPanel createUI(java.awt.image.BufferedImage img)
Creates various objects.
Parameters:
img - the image, which is needed for creating the ROIContext object.

shapeDrawn

public void shapeDrawn(ShapeEvent e)
This method is called when a shape event is received. Note that shape events are fired by the ShapeMarker when a shape is drawn. From the input parameter (i.e.,ShapeEvent object), this method extracts the Shape object.With that as the input parameter, this method calls updateROI() to create a new ROI object.
Specified by:
shapeDrawn in interface ShapeEventListener
Parameters:
e - the shape event state object.

updateROI

public void updateROI(java.awt.Shape shape)
For a specified shape, this method calls appropriate methods to create a new ROI object, and to update inforamtion related to this ROI. Before createing a new ROI object, this method performs inverse transformation of the input shape from the user space to the image space. Once a new ROI object is created, this method adds that ROI object to ReportPanel, which computes and displays histogram and other statistics. It then deposits the ROI object on the destination canvas.
Parameters:
shape - the ROI shape.

createROI

protected void createROI(java.awt.Shape shape)
Creates a new ROI2D object for a specified shape, and deposits that ROI on the displayed image.
Parameters:
shape - the ROI shape.

getCurrentROI

public ROI2D getCurrentROI()
Returns the current ROI2D object. There may be multiple ROIs deposited on an image. This method returns the one that is set as the current ROT. Typically, the current ROI is the one that was deposited last.
Returns:
the current ROI2D object.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
This method is called when a change eventis fired by the JSlider in the ThresholdAdjPanel. From the input parameter, this method retrieves the the threshold value set by the JSlider, and with that value it then calls thresholdROI() to change the threshold.
Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - the ChangeEvent object, which carries the threshold value.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This method is called when an action event is fired by the JTextField in the ThresholdAdjPanel. From the input parameter, this method retrieves the the threshold value entered by the user on the JTextField, and with that value it then calls thresholdROI() to change the threshold.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the ActionEvent object, which carries the threshold value.

thresholdROI

protected void thresholdROI(int thresh)
Performs the threshold operation on the ROI. Change in the threshold value is reflected on the ROI shape drawn on the destination canvas.

setPanZoom

public void setPanZoom(boolean state)
Turns the pan/zoom feature on or off.
Parameters:
state - if true, turns on pan/zoom.

setShapeType

public void setShapeType(int mode)
This is a proxy method that sets the current shape type in the roiMarker object. The ROIManager class acts as intermediary between the GUI that selects the shape type and the ShapeMarker class.
Parameters:
mode - the shape type, which is one of ShapeMarker.FREEHAND, ShapeMarker.ELLIPSE, and ShapeMarker.RECTANGLE.

setDrawingColor

public void setDrawingColor(java.awt.Color color)
Sets the drawing color of the ROI outline.
Parameters:
color - the drawing color of the ROI outline.

setMaskValue

public void setMaskValue(int value)
Sets the mask value of the current ROI. This is the value with which the thresholded pixels are highlighted.
Parameters:
value - the mask value.

getViewerSize

public java.awt.Dimension getViewerSize()
Returns the dimesnions of the viewer frame.
Returns:
the dimensions of the viewer frame.

eraseShapes

public void eraseShapes()
Erases shapes drawn over the source as well as the destination canvas. Also resets the report panel.

reset

public void reset()
Erases shapes drawn over the source as well as the destination canvas.