Class ncsa.horizon.viewer.GraphicsSelectionViewer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.viewer.GraphicsSelectionViewer

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ncsa.horizon.viewer.Viewer
                                   |
                                   +----ncsa.horizon.viewer.SelectionViewer
                                           |
                                           +----ncsa.horizon.viewer.GraphicsSelectionViewer

public class GraphicsSelectionViewer
extends SelectionViewer
implements Guiedable
This Viewer provides an implementation of the methods needed for a SelectionViewer.

Programmer's are encouraged to inspect this code for examples of how to implement the various Viewer methods.


Variable Index

 o butPanel
 o coord
CoordinateSystem object for converting between data pixels and world coordinates
 o defaultDisplayHeight
default height of display area if not specified in constructor
 o defaultDisplayWidth
default width of display area if not specified in constructor
 o display
A canvas used to display the image and hanle the selection events
 o editselsBut
 o editselsWin
 o freeposBox
 o newViewable
a flag that is true if a new viewable has been attached
 o onselectBox
 o pixelMap
ImageDisplayMap object for converting between display pixels and data pixels
 o posPanel
A panel displaying current mouse data position and coordinates.
 o selection
SelectionDatas
 o slice
the last slice requested from the current viewable
 o sliceData
the NdArrayData corresponding to current slice.
 o valueLabel
 o viewable
the current viewable
 o viewerImpl
 o xCoordPos
 o xDataPos
 o xLabel
 o yCoordPos
 o yDataPos
 o yLabel

Constructor Index

 o GraphicsSelectionViewer()
create a viewer with a display of a default size (256 by 256).
 o GraphicsSelectionViewer(boolean)
create a viewer with a display of a default size (256 by 256).
 o GraphicsSelectionViewer(int, int)
create a viewer with a given display size
 o GraphicsSelectionViewer(int, int, boolean)
create a viewer with a given display size

Method Index

 o action(Event, Object)
 o addViewable(Viewable)
replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
 o constructDisplay(int, int)
Set up the display area with the requested size.
 o constructVariables()
Initialize member variables except display.
 o createDefaultSlice(Viewable)
Given a concrete viewable, create a slice.
 o displaySlice()
Display a default slice of the current Viewable.
 o displaySlice(Slice)
display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
 o displaySlicebyImpl()
Delegate displaySlice action to viewerImpl.
 o getBoxSelection()
get the current selected display box.
 o getDisplaySize()
This method returns the size in display pixel units of the region that displays a Viewable
 o getGui()
Return the Selection Editing Panel associated with this panel.
 o getLineSelection()
get the current selected display Line.
 o getPixelSelection()
get the current selected display pixel.
 o getSliceSelection()
return the current selected Slice, or null if there is no current Viewable;
 o getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
 o getViewSlice()
return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
 o getVoxelSelection()
return the current selected Voxel, or null if there is no current Viewable.
 o imagePlacement(int, int)
Return a rectangle that describes where an image of a particular size will be placed.
 o layoutButtonPanel()
layout the panel contain the buttons (actually one Button and 2 Checkboxes.
 o layoutComponents()
Here is where the awt.compoents are layouted.
 o layoutPosPanel()
Here is how posPanel is layouted.
 o positionIsFree()
if false, then the display coordinate position will correspond the center of the data voxel beneath the mouse cursor; if true, the position will correspond to a the fractional voxel position beneath the mouse cursor.
 o positionOnSelect()
if true, the coordinate display will only be updated if when a pixel selection has been made; if false, it will be updated whenever the mouse cursor moves over the image display.
 o registerGUIWindow(Window)
This method tells the Viewer that another object will be managing the Selection editing panel, returned by the getGui() method.
 o reshape(int, int, int, int)
resize the viewer so that the display area takes up as much of the available space as possible.
 o setBoxSelection(int, int, int, int)
set the current selected display box.
 o setDisplaySize(Dimension)
set the size of the display area
 o setDisplaySize(int, int)
set the size of the display area
 o setFreePosition(boolean)
set whether displayed coordinate positions correspond to whole or fractional positions.
 o setLineSelection(int, int, int, int)
set the current selected display line.
 o setPixelmap()
set the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the current Viewable It's called at the change from state1 to (state2, state3).
 o setPixelSelection(int, int)
set the current selected display pixel.
 o setPositionOnSelect(boolean)
set whether the coordinate display is updated whenever the mouse cursor moves.
 o setSlice(Slice)
Set current slice.
 o setSliceData(Slice)
 o setSliceSelection(Volume)
set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
 o setVoxelSelection(Voxel)
set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
 o showingButtons()
if this method returns true, the Viewer contains three buttons:
Edit Selections
pop up a Frame that contains a GUI for editing selections (i.e.
 o update(Observable, Object)
 o updateDataLabel(double, double)
update Data Lable.
 o updateDataValueLabel(double, double)
update valueLable
 o updatePixelmap()
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updatePixelmap(Slice, Rectangle)
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updatePosDisplay(int, int)
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updateWorldlabel(String, String)
update worldlabel.

Variables

 o viewable
  protected Viewable viewable
the current viewable
 o slice
  protected Slice slice
the last slice requested from the current viewable
 o pixelMap
  protected ImageDisplayMap pixelMap
ImageDisplayMap object for converting between display pixels and data pixels
 o coord
  protected CoordinateSystem coord
CoordinateSystem object for converting between data pixels and world coordinates
 o viewerImpl
  protected ImageCanvasViewerImpl viewerImpl
 o newViewable
  protected boolean newViewable
a flag that is true if a new viewable has been attached
 o display
  protected GraphicsSelectionImageCanvas display
A canvas used to display the image and hanle the selection events
 o selection
  protected SelectionData selection
SelectionDatas
 o posPanel
  protected Panel posPanel
A panel displaying current mouse data position and coordinates.
 o xDataPos
  protected Label xDataPos
 o yDataPos
  protected Label yDataPos
 o xLabel
  protected Label xLabel
 o yLabel
  protected Label yLabel
 o xCoordPos
  protected Label xCoordPos
 o yCoordPos
  protected Label yCoordPos
 o butPanel
  protected Panel butPanel
 o freeposBox
  protected Checkbox freeposBox
 o onselectBox
  protected Checkbox onselectBox
 o editselsBut
  protected Button editselsBut
 o editselsWin
  protected Window editselsWin
 o defaultDisplayWidth
  public final static int defaultDisplayWidth
default width of display area if not specified in constructor
 o defaultDisplayHeight
  public final static int defaultDisplayHeight
default height of display area if not specified in constructor
 o sliceData
  protected NdArrayData sliceData
the NdArrayData corresponding to current slice. It is used to determine the data value for each pixel.
 o valueLabel
  protected Label valueLabel

Constructors

 o GraphicsSelectionViewer
  public GraphicsSelectionViewer()
create a viewer with a display of a default size (256 by 256).
 o GraphicsSelectionViewer
  public GraphicsSelectionViewer(boolean showButtons)
create a viewer with a display of a default size (256 by 256).
Parameters:
showButtons - if true, the Viewer will contain 3 buttons at the bottom of its Panel; see showingButtons() for details
 o GraphicsSelectionViewer
  public GraphicsSelectionViewer(int width,
                                 int height)
create a viewer with a given display size
Parameters:
width - width of the display area
height - height of the display area
 o GraphicsSelectionViewer
  public GraphicsSelectionViewer(int width,
                                 int height,
                                 boolean showButtons)
create a viewer with a given display size
Parameters:
width - width of the display area
height - height of the display area
showButtons - if true, the Viewer will contain 3 buttons at the bottom of its Panel; see showingButtons() for details

Methods

 o constructDisplay
  protected void constructDisplay(int width,
                                  int height)
Set up the display area with the requested size. Works only for constructors.
 o constructVariables
  protected void constructVariables()
Initialize member variables except display. This method works only for constructors. It should be called after display has been constructed.
 o addViewable
  public synchronized void addViewable(Viewable data)
replace the current Viewable object with a new one; the display will not be affected until displaySlice() is called.
Overrides:
addViewable in class Viewer
 o createDefaultSlice
  protected Slice createDefaultSlice(Viewable v)
Given a concrete viewable, create a slice. This method is used to create a default slice.
 o displaySlice
  public void displaySlice()
Display a default slice of the current Viewable.
Overrides:
displaySlice in class Viewer
 o displaySlice
  public synchronized void displaySlice(Slice sl)
display a slice from the current Viewable data, or do nothing if the current Viewable is not set.
Parameters:
sl - slice to be displayed. if sl== null, same as displaySlice()
Overrides:
displaySlice in class Viewer
 o displaySlicebyImpl
  protected void displaySlicebyImpl()
Delegate displaySlice action to viewerImpl.
 o getBoxSelection
  public Rectangle getBoxSelection()
get the current selected display box.
Overrides:
getBoxSelection in class SelectionViewer
 o getDisplaySize
  public Dimension getDisplaySize()
This method returns the size in display pixel units of the region that displays a Viewable
Returns:
Dimension of the compoonent
Overrides:
getDisplaySize in class Viewer
See Also:
Dimension, size()
 o getGui
  public Component[] getGui()
Return the Selection Editing Panel associated with this panel. (This method is part of the Guiedable interface.) The panel controls are laid out in CardPanel.

If this Viewer was set to show buttons at the bottom of the viewer (which is the default behavior)--that is,showingButtons() returns true, it is recommended that the caller of this method also call registerGUIWindow(). This will prevent the Viewer from displaying the Editing Panel in its own window. It is not necessary to call registerGUIWindow() if this Viewer was told at construction not to show the buttons (via GraphicsSelectionViewer(boolean) or GraphicsSelectionViewer(int, int, boolean)).

Returns:
s Component[] an array of length 1 where the first (and only) element is the Selection Editing Panel.
 o registerGUIWindow
  public synchronized boolean registerGUIWindow(Window container)
This method tells the Viewer that another object will be managing the Selection editing panel, returned by the getGui() method. This will prevent the Viewer from popping up its own Frame containing the panel. If there is already a window registered and is visible, that window is disposed of, so that only one window will hold panel at any given time.
Parameters:
container - the top-level container that will hold the Selecition editing panel.
Returns:
s true if the frame currently holding the panel was visible when this method was called. In such a case, the caller may want to redisplay the panel in its own Frame.
 o getLineSelection
  public Rectangle getLineSelection()
get the current selected display Line.
Overrides:
getLineSelection in class SelectionViewer
 o getPixelSelection
  public Point getPixelSelection()
get the current selected display pixel.
Overrides:
getPixelSelection in class SelectionViewer
 o getSliceSelection
  public Slice getSliceSelection()
return the current selected Slice, or null if there is no current Viewable;
Overrides:
getSliceSelection in class SelectionViewer
 o getViewable
  public Viewable getViewable()
Return a reference to the current Viewable object, or null if none are attached to this Viewer.
Returns:
The current Viewable object; null if none present.
Overrides:
getViewable in class Viewer
 o getViewSlice
  public Slice getViewSlice()
return a Slice object describing the data currently being viewed, or null if there is no Viewable currently being viewed.
Overrides:
getViewSlice in class Viewer
 o getVoxelSelection
  public Voxel getVoxelSelection()
return the current selected Voxel, or null if there is no current Viewable.
Overrides:
getVoxelSelection in class SelectionViewer
 o imagePlacement
  protected Rectangle imagePlacement(int width,
                                     int height)
Return a rectangle that describes where an image of a particular size will be placed.
 o layoutComponents
  protected void layoutComponents()
Here is where the awt.compoents are layouted. It was called only by constructors.
 o layoutPosPanel
  protected void layoutPosPanel()
Here is how posPanel is layouted. It is called only by layoutComponents methods.
See Also:
layoutComponents
 o layoutButtonPanel
  protected void layoutButtonPanel()
layout the panel contain the buttons (actually one Button and 2 Checkboxes. This is meant to only be called by layoutComponents() and only if showingButtons() returns true.
 o setBoxSelection
  public void setBoxSelection(int x1,
                              int y1,
                              int x2,
                              int y2)
set the current selected display box. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Parameters:
x1,y1 - the location of one vertex of the selected box
x2,y2 - the location of the vertex of the selected box opposite to the one given by x1,y1
Overrides:
setBoxSelection in class SelectionViewer
 o setLineSelection
  public void setLineSelection(int x1,
                               int y1,
                               int x2,
                               int y2)
set the current selected display line. The locations are measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Parameters:
x1,y1 - the location of the start of the line
x2,y2 - the location of the end of the line
Overrides:
setLineSelection in class SelectionViewer
 o setPixelSelection
  public void setPixelSelection(int x,
                                int y)
set the current selected display pixel. The location is measured in real display (i.e. screen) pixels relative to the upper left hand corner.
Overrides:
setPixelSelection in class SelectionViewer
 o setPixelmap
  protected synchronized void setPixelmap()
set the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the current Viewable It's called at the change from state1 to (state2, state3).
 o setSlice
  protected void setSlice(Slice slice)
Set current slice.
 o setSliceData
  protected void setSliceData(Slice slice)
 o setSliceSelection
  public synchronized void setSliceSelection(Volume vol)
set the current selected Slice to the given Volume as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
Overrides:
setSliceSelection in class SelectionViewer
 o setVoxelSelection
  public synchronized void setVoxelSelection(Voxel vox)
set the current selected Voxel to the one given as projected onto the currently displayed Slice, or do nothing if there is no current Viewable.
Overrides:
setVoxelSelection in class SelectionViewer
 o update
  public void update(Observable o,
                     Object arg)
Overrides:
update in class Viewer
 o updateDataLabel
  protected void updateDataLabel(double x,
                                 double y)
update Data Lable.
 o updateDataValueLabel
  protected void updateDataValueLabel(double x,
                                      double y)
update valueLable
 o updatePixelmap
  protected synchronized void updatePixelmap()
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice. This method should be called only in state 2 or state 3.
 o updatePixelmap
  protected synchronized void updatePixelmap(Slice dataSlice,
                                             Rectangle displayRegion)
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
Parameters:
dataSlice - the slice to be displayed;
displayRegion - the region of the display being used; if null, assume that as much of the display as possible will be used.
 o updatePosDisplay
  protected void updatePosDisplay(int x,
                                  int y)
update the ImageDisplayMap object, pixelMap (used to convert display pixels into data pixels), to reflect changes in the currently viewed slice.
 o updateWorldlabel
  protected void updateWorldlabel(String x,
                                  String y)
update worldlabel. It should be called only at state4.
 o setDisplaySize
  public synchronized void setDisplaySize(int width,
                                          int height)
set the size of the display area
 o setDisplaySize
  public void setDisplaySize(Dimension sz)
set the size of the display area
 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
resize the viewer so that the display area takes up as much of the available space as possible.
Overrides:
reshape in class Component
 o showingButtons
  public boolean showingButtons()
if this method returns true, the Viewer contains three buttons:
Edit Selections
pop up a Frame that contains a GUI for editing selections (i.e. points, regions, and lines) and the graphics associated with them. See getGui() method for details.
Free Position (on/off)
When this is function is turned on, the coordinates displayed is associated with fractional pixels. This toggle calls the setFreePosition() method.
Position On Select (on/off)
When this position is turned on, the coordinates display is only updated when a point selection is made (by clicking on with the mouse over the image).
 o positionIsFree
  public boolean positionIsFree()
if false, then the display coordinate position will correspond the center of the data voxel beneath the mouse cursor; if true, the position will correspond to a the fractional voxel position beneath the mouse cursor.
 o setFreePosition
  public void setFreePosition(boolean doFree)
set whether displayed coordinate positions correspond to whole or fractional positions. If the input is false, then the display coordinate position will correspond the center of the data voxel beneath the mouse cursor; if true, the position will correspond to a the fractional voxel position beneath the mouse cursor.
 o positionOnSelect
  public boolean positionOnSelect()
if true, the coordinate display will only be updated if when a pixel selection has been made; if false, it will be updated whenever the mouse cursor moves over the image display.
 o setPositionOnSelect
  public void setPositionOnSelect(boolean doOnSelect)
set whether the coordinate display is updated whenever the mouse cursor moves. If the input is true, it will be only be updated when a pixel selection has been made (i.e. the user clicks on the image).
 o action
  public boolean action(Event evt,
                        Object what)
Overrides:
action in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index