Package gov.nih.mipav.view
Class ViewJPanelHistoLUT
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- gov.nih.mipav.view.ViewJPanelHistoLUT
-
- All Implemented Interfaces:
HistoLUTParent
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
public class ViewJPanelHistoLUT extends javax.swing.JPanel implements HistoLUTParent, java.awt.event.MouseListener, java.awt.event.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 Modifier and Type Class Description private class
ViewJPanelHistoLUT.CancelColorListener
Notice when the user cancels the color chooser dialog.private class
ViewJPanelHistoLUT.OkColorListener
Pick up the selected color and change the image border color.-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private ViewJColorChooser
colorChooser
The LUT color chooser.private ViewJComponentHLUTBase
componentHistogram
The histogram LUT of the image.private ViewJComponentLUT
componentLUT
Lookup table of image.static int
GRAY_LUT
Indicates a grayscale LUT.private ModelHistogram
histogram
Model histogram.private int
histoLUTType
The type of histogram component to show.private ModelImage
image
The image.private ModelLUT
lut
The grayscale lookup table for the image.private int
LUTIndex
The LUT index used when chaning the LUT color by clicking on the ViewJComponentLUT.private JDialogRecordLUT
lutRecorder
LUT recorder.private HistoLUTParent
parent
The component containing this panel.static int
RGB_LUT
Indicates a RGB LUT.private ModelRGB
RGBT
The RGB lookup table.private static long
serialVersionUID
Use serialVersionUID for interoperability.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelLUT lut, ModelHistogram histogram)
Deprecated.ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelRGB RGBT, ModelHistogram histogram)
Deprecated.ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelStorageBase lut, ModelHistogram histogram)
Create this panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disposeLocal()
Deletes local memory.void
dragPoint(java.awt.event.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(java.awt.event.MouseEvent mouseEvent)
Calls color chooser.void
mouseDragged(java.awt.event.MouseEvent mouseEvent)
Continually updates the image depending on where the mouse is.void
mouseEntered(java.awt.event.MouseEvent mouseEvent)
Unchanged.void
mouseExited(java.awt.event.MouseEvent mouseEvent)
Unchanged.void
mouseMoved(java.awt.event.MouseEvent mouseEvent)
Changes the LUT text field display based on the Y value of the mouse when inside ViewJComponentLUT.void
mousePressed(java.awt.event.MouseEvent mouseEvent)
Checks whether the user is making new points in the lut function or not.void
mouseReleased(java.awt.event.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(java.lang.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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
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
-
colorChooser
private ViewJColorChooser colorChooser
The LUT color chooser.
-
componentHistogram
private ViewJComponentHLUTBase componentHistogram
The histogram LUT of the image. The square one.
-
componentLUT
private ViewJComponentLUT componentLUT
Lookup table of image. The narrow rectangular one.
-
histogram
private ModelHistogram histogram
Model histogram.
-
histoLUTType
private int histoLUTType
The type of histogram component to show.
-
image
private ModelImage image
The image.
-
lut
private ModelLUT lut
The grayscale lookup table for the image.
-
LUTIndex
private int LUTIndex
The LUT index used when chaning the LUT color by clicking on the ViewJComponentLUT.
-
lutRecorder
private JDialogRecordLUT lutRecorder
LUT recorder.
-
parent
private HistoLUTParent parent
The component containing this panel.
-
RGBT
private ModelRGB RGBT
The RGB lookup table.
-
-
Constructor Detail
-
ViewJPanelHistoLUT
public ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelStorageBase lut, ModelHistogram histogram)
Create this panel.- Parameters:
parent
- component which will hold this panelimage
- the imagelut
- the image luthistogram
- the image histogram
-
ViewJPanelHistoLUT
public ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelLUT lut, ModelHistogram histogram)
Deprecated.Create this panel.- Parameters:
parent
- component which will hold this panelimage
- the imagelut
- the image luthistogram
- the image histogram
-
ViewJPanelHistoLUT
public ViewJPanelHistoLUT(HistoLUTParent parent, ModelImage image, ModelRGB RGBT, ModelHistogram histogram)
Deprecated.Creates a new ViewJPanelHistoLUT object.- Parameters:
parent
- HistoLUTParentimage
- ModelImageRGBT
- ModelRGBhistogram
- ModelHistogram
-
-
Method Detail
-
disposeLocal
public void disposeLocal()
Deletes local memory.
-
dragPoint
public void dragPoint(java.awt.event.MouseEvent mouseEvent)
Handle the dragging of a transfer function point.- Specified by:
dragPoint
in interfaceHistoLUTParent
- Parameters:
mouseEvent
- the point dragging event
-
finalize
public void finalize()
Clean up the panel memory.- Overrides:
finalize
in classjava.lang.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 interfaceHistoLUTParent
- Returns:
true
if real time update should take place
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
Calls color chooser.- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
- Parameters:
mouseEvent
- Event that triggered function
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent mouseEvent)
Continually updates the image depending on where the mouse is.- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Parameters:
mouseEvent
- event that triggered this function
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
Unchanged.- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
- Parameters:
mouseEvent
- event
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent mouseEvent)
Unchanged.- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
- Parameters:
mouseEvent
- event
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent mouseEvent)
Changes the LUT text field display based on the Y value of the mouse when inside ViewJComponentLUT.- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Parameters:
mouseEvent
- Event that triggered this function
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent mouseEvent)
Checks whether the user is making new points in the lut function or not.- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
mouseEvent
- event that triggered function
-
mouseReleased
public void mouseReleased(java.awt.event.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 interfacejava.awt.event.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 interfaceHistoLUTParent
-
setLUT
public void setLUT(ModelLUT newLUT)
Replaces the LUT and builds a new LUT component.- Specified by:
setLUT
in interfaceHistoLUTParent
- 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 interfaceHistoLUTParent
- Parameters:
x
- the x threshold range valuey
- 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 interfaceHistoLUTParent
-
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 interfaceHistoLUTParent
- 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(java.lang.String str)
Sets the position string in the LUT text field.- Specified by:
updateLUTPositionString
in interfaceHistoLUTParent
- 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 interfaceHistoLUTParent
- Parameters:
lower
- the lower threshold valueupper
- the upper threshold value
-
-