gov.nih.mipav.view
Class ViewJPanelHistoLUT

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by gov.nih.mipav.view.ViewJPanelHistoLUT
All Implemented Interfaces:
HistoLUTParent, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ViewJPanelHistoLUT
extends JPanel
implements HistoLUTParent, MouseListener, MouseMotionListener

Panel containing the histogram component (the graph) and the lut component (the gradient vertical bar).

Version:
1.0
Author:
Evan McCreedy
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int GRAY_LUT
          Indicates a grayscale LUT.
static int RGB_LUT
          Indicates a RGB LUT.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelLUT lut, ModelHistogram histogram)
          Create this panel.
ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelRGB RGBT, ModelHistogram histogram)
          Creates a new ViewJPanelHistoLUT object.
 
Method Summary
 void dragPoint(MouseEvent mouseEvent)
          Handle the dragging of a transfer function point.
 void finalize()
          Clean up the panel memory.
 ViewJComponentHLUTBase getHistoLUTComponent()
          Get the histogram LUT component.
 ViewJComponentLUT getLUTComponent()
          Get the LUT component.
 JDialogRecordLUT getLUTRecorder()
          Get the LUT recorder reference.
 void initGUI()
          Construct the panel.
 boolean isImageUpdate()
          Indicates if real-time update of the image should take place.
 void mouseClicked(MouseEvent mouseEvent)
          Calls color chooser.
 void mouseDragged(MouseEvent mouseEvent)
          Continually updates the image depending on where the mouse is.
 void mouseEntered(MouseEvent mouseEvent)
          Unchanged.
 void mouseExited(MouseEvent mouseEvent)
          Unchanged.
 void mouseMoved(MouseEvent mouseEvent)
          Changes the LUT text field display based on the Y value of the mouse when inside ViewJComponentLUT.
 void mousePressed(MouseEvent mouseEvent)
          Checks whether the user is making new points in the lut function or not.
 void mouseReleased(MouseEvent mouseEvent)
          Updates the image and shows it in case a new point has been added to the function (or removed).
 void setAllOff()
          Accessor to disable the all RGB color channels button if one of the lines has moved.
 void setLUT(ModelLUT newLUT)
          Replaces the LUT and builds a new LUT component.
 void setRangeText(float x, float y, int _index)
          Set the range value of the text field.
 void showLUTRecorder()
          Show the LUT recorder dialog.
 void updateComponentLUT()
          Redraw the componentLUT.
 void updateFrames(boolean flag)
          Update all of the image frames that display the image this histo lut is for.
 void updateLUTPositionString(String str)
          Sets the position string in the LUT text field.
 void updateLUTRecorder()
          Update the LUT recorder table transfer function.
 void updateLUTRecorder(ModelLUT _lut)
          Update the LUT table of LUTRecorder.
 void updateThresholdFields(float lower, float upper)
          Method to update the threshold text fields when the lower or upper threshold changes.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GRAY_LUT

public static final int GRAY_LUT
Indicates a grayscale LUT.

See Also:
Constant Field Values

RGB_LUT

public static final int RGB_LUT
Indicates a RGB LUT.

See Also:
Constant Field Values
Constructor Detail

ViewJPanelHistoLUT

public ViewJPanelHistoLUT(HistoLUTParent parent,
                          ModelImage image,
                          ModelLUT lut,
                          ModelHistogram histogram)
Create this panel.

Parameters:
parent - component which will hold this panel
image - the image
lut - the image lut
histogram - the image histogram

ViewJPanelHistoLUT

public ViewJPanelHistoLUT(HistoLUTParent parent,
                          ModelImage image,
                          ModelRGB RGBT,
                          ModelHistogram histogram)
Creates a new ViewJPanelHistoLUT object.

Parameters:
parent - HistoLUTParent
image - ModelImage
RGBT - ModelRGB
histogram - ModelHistogram
Method Detail

dragPoint

public void dragPoint(MouseEvent mouseEvent)
Handle the dragging of a transfer function point.

Specified by:
dragPoint in interface HistoLUTParent
Parameters:
mouseEvent - the point dragging event

finalize

public void finalize()
Clean up the panel memory.

Overrides:
finalize in class Object

getHistoLUTComponent

public ViewJComponentHLUTBase getHistoLUTComponent()
Get the histogram LUT component.

Returns:
the histogram component

getLUTComponent

public ViewJComponentLUT getLUTComponent()
Get the LUT component.

Returns:
the lut component

getLUTRecorder

public JDialogRecordLUT getLUTRecorder()
Get the LUT recorder reference.

Returns:
JDialogRecordLUT recorder dialog reference

initGUI

public void initGUI()
Construct the panel.


isImageUpdate

public boolean isImageUpdate()
Indicates if real-time update of the image should take place.

Specified by:
isImageUpdate in interface HistoLUTParent
Returns:
true if real time update should take place

mouseClicked

public void mouseClicked(MouseEvent mouseEvent)
Calls color chooser.

Specified by:
mouseClicked in interface MouseListener
Parameters:
mouseEvent - Event that triggered function

mouseDragged

public void mouseDragged(MouseEvent mouseEvent)
Continually updates the image depending on where the mouse is.

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
mouseEvent - event that triggered this function

mouseEntered

public void mouseEntered(MouseEvent mouseEvent)
Unchanged.

Specified by:
mouseEntered in interface MouseListener
Parameters:
mouseEvent - event

mouseExited

public void mouseExited(MouseEvent mouseEvent)
Unchanged.

Specified by:
mouseExited in interface MouseListener
Parameters:
mouseEvent - event

mouseMoved

public void mouseMoved(MouseEvent mouseEvent)
Changes the LUT text field display based on the Y value of the mouse when inside ViewJComponentLUT.

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
mouseEvent - Event that triggered this function

mousePressed

public void mousePressed(MouseEvent mouseEvent)
Checks whether the user is making new points in the lut function or not.

Specified by:
mousePressed in interface MouseListener
Parameters:
mouseEvent - event that triggered function

mouseReleased

public void mouseReleased(MouseEvent mouseEvent)
Updates the image and shows it in case a new point has been added to the function (or removed).

Specified by:
mouseReleased in interface MouseListener
Parameters:
mouseEvent - the event that triggered this function

setAllOff

public void setAllOff()
Accessor to disable the all RGB color channels button if one of the lines has moved.

Specified by:
setAllOff in interface HistoLUTParent

setLUT

public void setLUT(ModelLUT newLUT)
Replaces the LUT and builds a new LUT component.

Specified by:
setLUT in interface HistoLUTParent
Parameters:
newLUT - New LUT

setRangeText

public void setRangeText(float x,
                         float y,
                         int _index)
Set the range value of the text field.

Specified by:
setRangeText in interface HistoLUTParent
Parameters:
x - the x threshold range value
y - the y threshold range value
_index - the cursor index

showLUTRecorder

public void showLUTRecorder()
Show the LUT recorder dialog.


updateComponentLUT

public void updateComponentLUT()
Redraw the componentLUT.

Specified by:
updateComponentLUT in interface HistoLUTParent

updateFrames

public void updateFrames(boolean flag)
Update all of the image frames that display the image this histo lut is for.

Specified by:
updateFrames in interface HistoLUTParent
Parameters:
flag - this boolean indicates if the frame that displays the image should re-export the image and apply new LUT
See Also:
ModelImage.notifyImageDisplayListeners()

updateLUTPositionString

public void updateLUTPositionString(String str)
Sets the position string in the LUT text field.

Specified by:
updateLUTPositionString in interface HistoLUTParent
Parameters:
str - the position string

updateLUTRecorder

public void updateLUTRecorder()
Update the LUT recorder table transfer function.


updateLUTRecorder

public void updateLUTRecorder(ModelLUT _lut)
Update the LUT table of LUTRecorder.

Parameters:
_lut - ModelLUT lut table

updateThresholdFields

public void updateThresholdFields(float lower,
                                  float upper)
Method to update the threshold text fields when the lower or upper threshold changes.

Specified by:
updateThresholdFields in interface HistoLUTParent
Parameters:
lower - the lower threshold value
upper - the upper threshold value