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 classViewJPanelHistoLUT.CancelColorListenerNotice when the user cancels the color chooser dialog.private classViewJPanelHistoLUT.OkColorListenerPick 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 ViewJColorChoosercolorChooserThe LUT color chooser.private ViewJComponentHLUTBasecomponentHistogramThe histogram LUT of the image.private ViewJComponentLUTcomponentLUTLookup table of image.static intGRAY_LUTIndicates a grayscale LUT.private ModelHistogramhistogramModel histogram.private inthistoLUTTypeThe type of histogram component to show.private ModelImageimageThe image.private ModelLUTlutThe grayscale lookup table for the image.private intLUTIndexThe LUT index used when chaning the LUT color by clicking on the ViewJComponentLUT.private JDialogRecordLUTlutRecorderLUT recorder.private HistoLUTParentparentThe component containing this panel.static intRGB_LUTIndicates a RGB LUT.private ModelRGBRGBTThe RGB lookup table.private static longserialVersionUIDUse 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 voiddisposeLocal()Deletes local memory.voiddragPoint(java.awt.event.MouseEvent mouseEvent)Handle the dragging of a transfer function point.voidfinalize()Clean up the panel memory.ViewJComponentHLUTBasegetHistoLUTComponent()Get the histogram LUT component.ViewJComponentLUTgetLUTComponent()Get the LUT component.JDialogRecordLUTgetLUTRecorder()Get the LUT recorder reference.voidinitGUI()Construct the panel.booleanisImageUpdate()Indicates if real-time update of the image should take place.voidmouseClicked(java.awt.event.MouseEvent mouseEvent)Calls color chooser.voidmouseDragged(java.awt.event.MouseEvent mouseEvent)Continually updates the image depending on where the mouse is.voidmouseEntered(java.awt.event.MouseEvent mouseEvent)Unchanged.voidmouseExited(java.awt.event.MouseEvent mouseEvent)Unchanged.voidmouseMoved(java.awt.event.MouseEvent mouseEvent)Changes the LUT text field display based on the Y value of the mouse when inside ViewJComponentLUT.voidmousePressed(java.awt.event.MouseEvent mouseEvent)Checks whether the user is making new points in the lut function or not.voidmouseReleased(java.awt.event.MouseEvent mouseEvent)Updates the image and shows it in case a new point has been added to the function (or removed).voidsetAllOff()Accessor to disable the all RGB color channels button if one of the lines has moved.voidsetLUT(ModelLUT newLUT)Replaces the LUT and builds a new LUT component.voidsetRangeText(float x, float y, int _index)Set the range value of the text field.voidshowLUTRecorder()Show the LUT recorder dialog.voidupdateComponentLUT()Redraw the componentLUT.voidupdateFrames(boolean flag)Update all of the image frames that display the image this histo lut is for.voidupdateLUTPositionString(java.lang.String str)Sets the position string in the LUT text field.voidupdateLUTRecorder()Update the LUT recorder table transfer function.voidupdateLUTRecorder(ModelLUT _lut)Update the LUT table of LUTRecorder.voidupdateThresholdFields(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:
dragPointin interfaceHistoLUTParent- Parameters:
mouseEvent- the point dragging event
-
finalize
public void finalize()
Clean up the panel memory.- Overrides:
finalizein 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:
isImageUpdatein interfaceHistoLUTParent- Returns:
trueif real time update should take place
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
Calls color chooser.- Specified by:
mouseClickedin 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:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Parameters:
mouseEvent- event that triggered this function
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
Unchanged.- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener- Parameters:
mouseEvent- event
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent mouseEvent)
Unchanged.- Specified by:
mouseExitedin 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:
mouseMovedin 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:
mousePressedin 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:
mouseReleasedin 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:
setAllOffin interfaceHistoLUTParent
-
setLUT
public void setLUT(ModelLUT newLUT)
Replaces the LUT and builds a new LUT component.- Specified by:
setLUTin 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:
setRangeTextin 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:
updateComponentLUTin interfaceHistoLUTParent
-
updateFrames
public void updateFrames(boolean flag)
Update all of the image frames that display the image this histo lut is for.- Specified by:
updateFramesin 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:
updateLUTPositionStringin 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:
updateThresholdFieldsin interfaceHistoLUTParent- Parameters:
lower- the lower threshold valueupper- the upper threshold value
-
-