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.
-
applyBut
- the apply button for applying the TransferFunction
-
autoApply
- if true, changes to individual parameters will cause the attached
viewer to be notified to redisplay
-
curoptPanel
- a panel containing extra controls for updating options associated
with the current mode
-
maxScroll
- the scrollbar for setting the maximum value
-
maxScrollPanel
- the panel containing the scrollbar and textfield for setting the
maximum value
-
maxText
- the textfield for setting the maximum value
-
minScroll
- the scrollbar for setting the minimum value
-
minScrollPanel
- the panel containing the scrollbar and textfield for setting the
minimum value
-
minText
- the textfield for setting the minimum value
-
modeChoice
- a choice menu for choosing a mode for the TransferFunction
-
modePanel
- a panel containing the Choice menu for choosing a mode
-
optPanels
- a hastable of option panels indexed by mode label
-
resetBut
- the reset button for setting scollbar panels to their initial
state
-
setBut
- the button for setting scollbar ranges using the currently
min/max values.
-
textfieldEditable
- if true, the text field is editable.
-
tf
- the TransferFunction driven by this GUI
-
viewer
- an attached viewer displaying a viewable that uses this transfer
function
-
TransferFunctionPanel()
- instantiate and layout the panel with no attached function
-
TransferFunctionPanel(TransferFunction)
- instantiate and layout the panel using a given function, using
a default mode label and no options panel.
-
TransferFunctionPanel(TransferFunction, String)
- instantiate and layout the panel using a given function, using a
a given mode label but no options panel.
-
TransferFunctionPanel(TransferFunction, String, Component)
- instantiate and layout the panel using a given function, using a
a given mode label and options panel.
-
action(Event, Object)
- handle action events
-
addMode(String, Component)
- add a mode entry and related option panel
-
adjustToCurrent()
- set the full range to the values of transfer function's min
and max
-
apply()
- tell the attached viewer to redisplay, so as to use the most
current parameters of the transfer function
-
getAllModes()
- return an array of the names of the available modes
-
getFullRangeMax()
- return the highest value one may set the maximum to
-
getFullRangeMin()
- return the lowest value one may set the minimum to
-
getMaximum()
- get the maximum value for the transfer function
-
getMinimum()
- get the minimum value for the transfer function
-
getMode()
- return the name of the currently selected mode
-
getValueFromLevel(int, TransferFunction)
- return a data value corresponding to a binned transfer function level.
-
handleEvent(Event)
- pass scroll events to the scroll handler
-
isAutoApplying()
-
return true if changes to individual parameters will cause the attached
viewer to be notified to redisplay.
-
layoutComponents()
-
-
layoutComponents(Container)
-
-
main(String[])
-
-
registerViewer(Viewer)
- attach a viewer that should be told to update its image when
the transfer function has been updated.
-
reset()
- reset the scrollbars to their original positions
-
reshape(int, int, int, int)
-
-
scrollEvent(Event)
- handle scroll events
-
setAutoApplying(boolean)
- set whether changes to individual parameters will cause the attached
viewer to be notified to redisplay.
-
setFullRangeMax(Object)
- set the highest value one may set the maximum to
-
setFullRangeMin(Object)
- set the lowest value one may set the minimum to
-
setMaximum(Object)
- set the TransferFunction maximum value and adjust the GUI to
reflect this change.
-
setMinimum(Object)
- set the TransferFunction minimum value and adjust the GUI to
reflect this change.
-
setMode(String)
- switch the mode identified by the given name and update the GUI to
reflect the change.
-
setTransferFunction(TransferFunction, String)
- set the TransferFunction to be driven by this GUI.
tf
protected TransferFunction tf
- the TransferFunction driven by this GUI
modeChoice
protected Choice modeChoice
- a choice menu for choosing a mode for the TransferFunction
modePanel
protected Panel modePanel
- a panel containing the Choice menu for choosing a mode
curoptPanel
protected Panel curoptPanel
- a panel containing extra controls for updating options associated
with the current mode
optPanels
protected Hashtable optPanels
- a hastable of option panels indexed by mode label
minScrollPanel
protected Panel minScrollPanel
- the panel containing the scrollbar and textfield for setting the
minimum value
maxScrollPanel
protected Panel maxScrollPanel
- the panel containing the scrollbar and textfield for setting the
maximum value
minScroll
protected Scrollbar minScroll
- the scrollbar for setting the minimum value
maxScroll
protected Scrollbar maxScroll
- the scrollbar for setting the maximum value
minText
protected TextField minText
- the textfield for setting the minimum value
maxText
protected TextField maxText
- the textfield for setting the maximum value
resetBut
protected Button resetBut
- the reset button for setting scollbar panels to their initial
state
setBut
protected Button setBut
- the button for setting scollbar ranges using the currently
min/max values.
applyBut
protected Button applyBut
- the apply button for applying the TransferFunction
viewer
protected Viewer viewer
- an attached viewer displaying a viewable that uses this transfer
function
autoApply
protected boolean autoApply
- if true, changes to individual parameters will cause the attached
viewer to be notified to redisplay
textfieldEditable
protected boolean textfieldEditable
- if true, the text field is editable. This is because the values handled
by the transfer function are Numbers.
TransferFunctionPanel
public TransferFunctionPanel()
- instantiate and layout the panel with no attached function
TransferFunctionPanel
public TransferFunctionPanel(TransferFunction func)
- instantiate and layout the panel using a given function, using
a default mode label and no options panel.
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.
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.
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
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.
setFullRangeMin
public synchronized void setFullRangeMin(Object val) throws IllegalArgumentException
- set the lowest value one may set the minimum to
setFullRangeMax
public void setFullRangeMax(Object val) throws IllegalArgumentException
- set the highest value one may set the maximum to
getFullRangeMin
public Object getFullRangeMin()
- return the lowest value one may set the minimum to
getFullRangeMax
public Object getFullRangeMax()
- return the highest value one may set the maximum to
setMinimum
public void setMinimum(Object min) throws IllegalArgumentException
- set the TransferFunction minimum value and adjust the GUI to
reflect this change.
getMinimum
public Object getMinimum()
- get the minimum value for the transfer function
setMaximum
public void setMaximum(Object max) throws IllegalArgumentException
- set the TransferFunction maximum value and adjust the GUI to
reflect this change.
getMaximum
public Object getMaximum()
- get the maximum value for the transfer function
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.
getMode
public String getMode()
- return the name of the currently selected mode
getAllModes
public synchronized String[] getAllModes()
- return an array of the names of the available modes
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
reset
public synchronized void reset()
- reset the scrollbars to their original positions
adjustToCurrent
public synchronized void adjustToCurrent()
- set the full range to the values of transfer function's min
and max
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.
apply
public void apply()
- tell the attached viewer to redisplay, so as to use the most
current parameters of the transfer function
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.
isAutoApplying
public boolean isAutoApplying()
- return true if changes to individual parameters will cause the attached
viewer to be notified to redisplay.
action
public boolean action(Event ev,
Object what)
- handle action events
- Overrides:
- action in class Component
handleEvent
public boolean handleEvent(Event e)
- pass scroll events to the scroll handler
- Overrides:
- handleEvent in class Component
scrollEvent
public synchronized boolean scrollEvent(Event e)
- handle scroll events
layoutComponents
protected void layoutComponents()
layoutComponents
protected void layoutComponents(Container con)
reshape
public void reshape(int x,
int y,
int width,
int height)
- Overrides:
- reshape in class Component
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index