Class ncsa.horizon.modules.TransferFunctionPanel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.modules.TransferFunctionPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ncsa.horizon.modules.TransferFunctionPanel

public class TransferFunctionPanel
extends Panel
implements ModedGUI
a graphical user interface (GUI) for manipulating a TransferFunction object.

A TransferFunction is used to map a range of data values into a given number of integer bins so that they may be converted to colors for display. In general, the TransferFunction allows the user to specify the minimum and maximum of the range of data to map as well as the number of bins. Furthermore, different TransferFunctions can provide different functions to do the mapping or support different datatypes. TransferFunctions thus allow the user to create a visualization that focuses on specific signal strengths in an image that may have a large dynamic range.

The TransferFunctionPanel provides a GUI for adjusting the parameters of the TransferFunction. Controls include two scrollbars-textfield pairs for setting the minimum and maximum, a reset button, and an apply button. There is also menu for switching between different (TransferFunction-specific) modes, and it can also optionally provide additional controls associated with each mode (see below).

The TransferFunctionPanel can only drive one TransferFunction; however, the TransferFunction may have several modes associated with it. For example, it may provide a choice of several mathematical functions to apply to the data. The Panel also allows a panel of mode-specific controls to be displayed when a particular mode is selected.

To deploy this GUI, the programmer should provide the TransferFunction to be controlled either to the TransferFunctionPanel's constructor or to its setTransferFunction() method. One makes additional modes available with the addMode() method; along with a name of the mode that will appear in the mode menu, one can also provide a AWT Component that contains GUI controls for additional options associated with the mode. One should consult the API documentation for the specific TransferFunction for details of available modes and their names. The configuring of modes may be done automatically when the TransferFunction is attached to the Panel via the TransferFunction's init() method; consult the TransferFunction's API for details.

Also as part of deploying this GUI, one would usually attach a Viewer to it via the registerViewer() method. This will allow the user to apply the parameters to the data being displayed by the viewer by clicking the "Apply" button (which calls the apply() method). One can have the visualization updated automatically whenever certain parameters are adjusted (like the min or max is changed) by calling setAutoApplying(true). Since there may be a large overhead with updating the visualization, this feature is turned off by default.


Variable Index

 o applyBut
the apply button for applying the TransferFunction
 o autoApply
if true, changes to individual parameters will cause the attached viewer to be notified to redisplay
 o curoptPanel
a panel containing extra controls for updating options associated with the current mode
 o maxScroll
the scrollbar for setting the maximum value
 o maxScrollPanel
the panel containing the scrollbar and textfield for setting the maximum value
 o maxText
the textfield for setting the maximum value
 o minScroll
the scrollbar for setting the minimum value
 o minScrollPanel
the panel containing the scrollbar and textfield for setting the minimum value
 o minText
the textfield for setting the minimum value
 o modeChoice
a choice menu for choosing a mode for the TransferFunction
 o modePanel
a panel containing the Choice menu for choosing a mode
 o optPanels
a hastable of option panels indexed by mode label
 o resetBut
the reset button for setting scollbar panels to their initial state
 o setBut
the button for setting scollbar ranges using the currently min/max values.
 o textfieldEditable
if true, the text field is editable.
 o tf
the TransferFunction driven by this GUI
 o viewer
an attached viewer displaying a viewable that uses this transfer function

Constructor Index

 o TransferFunctionPanel()
instantiate and layout the panel with no attached function
 o TransferFunctionPanel(TransferFunction)
instantiate and layout the panel using a given function, using a default mode label and no options panel.
 o TransferFunctionPanel(TransferFunction, String)
instantiate and layout the panel using a given function, using a a given mode label but no options panel.
 o TransferFunctionPanel(TransferFunction, String, Component)
instantiate and layout the panel using a given function, using a a given mode label and options panel.

Method Index

 o action(Event, Object)
handle action events
 o addMode(String, Component)
add a mode entry and related option panel
 o adjustToCurrent()
set the full range to the values of transfer function's min and max
 o apply()
tell the attached viewer to redisplay, so as to use the most current parameters of the transfer function
 o getAllModes()
return an array of the names of the available modes
 o getFullRangeMax()
return the highest value one may set the maximum to
 o getFullRangeMin()
return the lowest value one may set the minimum to
 o getMaximum()
get the maximum value for the transfer function
 o getMinimum()
get the minimum value for the transfer function
 o getMode()
return the name of the currently selected mode
 o getValueFromLevel(int, TransferFunction)
return a data value corresponding to a binned transfer function level.
 o handleEvent(Event)
pass scroll events to the scroll handler
 o isAutoApplying()
return true if changes to individual parameters will cause the attached viewer to be notified to redisplay.
 o layoutComponents()
 o layoutComponents(Container)
 o main(String[])
 o registerViewer(Viewer)
attach a viewer that should be told to update its image when the transfer function has been updated.
 o reset()
reset the scrollbars to their original positions
 o reshape(int, int, int, int)
 o scrollEvent(Event)
handle scroll events
 o setAutoApplying(boolean)
set whether changes to individual parameters will cause the attached viewer to be notified to redisplay.
 o setFullRangeMax(Object)
set the highest value one may set the maximum to
 o setFullRangeMin(Object)
set the lowest value one may set the minimum to
 o setMaximum(Object)
set the TransferFunction maximum value and adjust the GUI to reflect this change.
 o setMinimum(Object)
set the TransferFunction minimum value and adjust the GUI to reflect this change.
 o setMode(String)
switch the mode identified by the given name and update the GUI to reflect the change.
 o setTransferFunction(TransferFunction, String)
set the TransferFunction to be driven by this GUI.

Variables

 o tf
  protected TransferFunction tf
the TransferFunction driven by this GUI
 o modeChoice
  protected Choice modeChoice
a choice menu for choosing a mode for the TransferFunction
 o modePanel
  protected Panel modePanel
a panel containing the Choice menu for choosing a mode
 o curoptPanel
  protected Panel curoptPanel
a panel containing extra controls for updating options associated with the current mode
 o optPanels
  protected Hashtable optPanels
a hastable of option panels indexed by mode label
 o minScrollPanel
  protected Panel minScrollPanel
the panel containing the scrollbar and textfield for setting the minimum value
 o maxScrollPanel
  protected Panel maxScrollPanel
the panel containing the scrollbar and textfield for setting the maximum value
 o minScroll
  protected Scrollbar minScroll
the scrollbar for setting the minimum value
 o maxScroll
  protected Scrollbar maxScroll
the scrollbar for setting the maximum value
 o minText
  protected TextField minText
the textfield for setting the minimum value
 o maxText
  protected TextField maxText
the textfield for setting the maximum value
 o resetBut
  protected Button resetBut
the reset button for setting scollbar panels to their initial state
 o setBut
  protected Button setBut
the button for setting scollbar ranges using the currently min/max values.
 o applyBut
  protected Button applyBut
the apply button for applying the TransferFunction
 o viewer
  protected Viewer viewer
an attached viewer displaying a viewable that uses this transfer function
 o autoApply
  protected boolean autoApply
if true, changes to individual parameters will cause the attached viewer to be notified to redisplay
 o textfieldEditable
  protected boolean textfieldEditable
if true, the text field is editable. This is because the values handled by the transfer function are Numbers.

Constructors

 o TransferFunctionPanel
  public TransferFunctionPanel()
instantiate and layout the panel with no attached function
 o TransferFunctionPanel
  public TransferFunctionPanel(TransferFunction func)
instantiate and layout the panel using a given function, using a default mode label and no options panel.
 o TransferFunctionPanel
  public TransferFunctionPanel(TransferFunction func,
                               String label)
instantiate and layout the panel using a given function, using a a given mode label but no options panel.
 o TransferFunctionPanel
  public TransferFunctionPanel(TransferFunction func,
                               String label,
                               Component optionsPanel)
instantiate and layout the panel using a given function, using a a given mode label and options panel.

Methods

 o setTransferFunction
  public synchronized void setTransferFunction(TransferFunction func,
                                               String label)
set the TransferFunction to be driven by this GUI. Calling this method will clear any previously set option Panels and labels
 o addMode
  public synchronized void addMode(String label,
                                   Component opts)
add a mode entry and related option panel
Parameters:
label - the label to add to the menu (should not be null)
opts - a component/container hold GUI controls especially for this mode.
 o setFullRangeMin
  public synchronized void setFullRangeMin(Object val) throws IllegalArgumentException
set the lowest value one may set the minimum to
 o setFullRangeMax
  public void setFullRangeMax(Object val) throws IllegalArgumentException
set the highest value one may set the maximum to
 o getFullRangeMin
  public Object getFullRangeMin()
return the lowest value one may set the minimum to
 o getFullRangeMax
  public Object getFullRangeMax()
return the highest value one may set the maximum to
 o setMinimum
  public void setMinimum(Object min) throws IllegalArgumentException
set the TransferFunction minimum value and adjust the GUI to reflect this change.
 o getMinimum
  public Object getMinimum()
get the minimum value for the transfer function
 o setMaximum
  public void setMaximum(Object max) throws IllegalArgumentException
set the TransferFunction maximum value and adjust the GUI to reflect this change.
 o getMaximum
  public Object getMaximum()
get the maximum value for the transfer function
 o getValueFromLevel
  protected Object getValueFromLevel(int lev,
                                     TransferFunction func)
return a data value corresponding to a binned transfer function level. By default, this will use the given TransferFunction to do the conversion by calling its getValue() method. Subclasses have the option of affecting this conversion by overriding this method. The input value should follow the same convention as supported by the TransferFunction getValue() method.
 o getMode
  public String getMode()
return the name of the currently selected mode
 o getAllModes
  public synchronized String[] getAllModes()
return an array of the names of the available modes
 o setMode
  public synchronized boolean setMode(String name)
switch the mode identified by the given name and update the GUI to reflect the change.
Returns:
s true if the name was recognized and the mode was switched
 o reset
  public synchronized void reset()
reset the scrollbars to their original positions
 o adjustToCurrent
  public synchronized void adjustToCurrent()
set the full range to the values of transfer function's min and max
 o registerViewer
  public void registerViewer(Viewer vu)
attach a viewer that should be told to update its image when the transfer function has been updated. Normally (when isAutoAplied() returns false), this only happens when the Apply button is pressed.
 o apply
  public void apply()
tell the attached viewer to redisplay, so as to use the most current parameters of the transfer function
 o setAutoApplying
  public void setAutoApplying(boolean in)
set whether changes to individual parameters will cause the attached viewer to be notified to redisplay.
Parameters:
in - if true, the viewer will redisplay automatically.
 o isAutoApplying
  public boolean isAutoApplying()
return true if changes to individual parameters will cause the attached viewer to be notified to redisplay.
 o action
  public boolean action(Event ev,
                        Object what)
handle action events
Overrides:
action in class Component
 o handleEvent
  public boolean handleEvent(Event e)
pass scroll events to the scroll handler
Overrides:
handleEvent in class Component
 o scrollEvent
  public synchronized boolean scrollEvent(Event e)
handle scroll events
 o layoutComponents
  protected void layoutComponents()
 o layoutComponents
  protected void layoutComponents(Container con)
 o reshape
  public void reshape(int x,
                      int y,
                      int width,
                      int height)
Overrides:
reshape in class Component
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index