Package gov.nih.mipav.view
Class JFrameHistogram
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nih.mipav.view.JFrameHistogram
- All Implemented Interfaces:
ViewImageUpdateInterface,ActionListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener
public class JFrameHistogram
extends JPanel
implements ActionListener, ChangeListener, ViewImageUpdateInterface, WindowListener
Lookup table interface for either grayscale or color (RGB) images.
Either one or two images can be combined in a frame, and this LUT interface
enables the user to apply a color look-up table to the images.
Each image is treated separately, with an individual interface in a separate tabbed pane.
The images can be grayscale, color, or a combination (one grayscale, one RGB).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ViewJFrameColocalizationEMreference to the colocalization frame for updatng the image.reference to the colocalization frame for updatng the image.private JFrameframe containing the lut interface (if display in a stand-alone window)private JPanelpanel containing the lut interface (used in the stand-alone frame or in an outside frame)protected booleanset to true when the lut interface contains two images (imageA and imageB)protected ModelImagesource image Aprotected ModelImagesource image Bprotected ModelStorageBaselut aprotected ModelStorageBaselut bprotected ViewMenuBuildermenu builderprotected JPanelHistogramhistogram interface panels for imageA and imageBprotected JPanelHistogramhistogram interface panels for imageA and imageBprivate FrameParent frame of this dialog, usually of type ViewJFrameImage.protected ViewJComponentRegistrationfalse = apply algorithm only to VOI regions.private static final longprotected JTabbedPanetabbed pane, each separate tab contains the interface for imageA and imageBprivate booleanWhether this panel is contained in another frame or forms its own frameprivate JDialogDialog that enables the user to choose to apply the lut to the entire image, or voi regions.protected booleantrue = apply algorithm to the whole imageFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionJFrameHistogram(Frame theParentFrame, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) Creates the JFrameHistogram class.JFrameHistogram(Frame theParentFrame, ViewJComponentRegistration _regComponent, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) Creates the JFrameHistogram class. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) private voidThis method builds a menu which contains the options for opening/saving a LUT or set of transfer functions, closing the LUT, and utilities such as CT presets.voidCloses the stand-alone interface frame.voidCloses imageB and removes the tabbed-pane interface, replacing it with a single interface panel.voidconstructDialog(boolean separateFrame) Creates a dialog to choose if histogram should be over all of image or just VOI regions.protected JPanelCreates the display panel.protected voidcreatePanel(boolean simple) voidRemoves this from the image display listeners.booleanReturns true if 'Calculate threshold volume' is selected.Returns the main interface panel for display in another interface.floatReturns the lower threshold image value for whichever image is current selected.Returns the currently selected interface panel.floatReturns the upper threshold image value for whichever image is current selected.voidhistogramLUT(boolean entireFlag, boolean separateFrame) Creates the user interface for LUT changes.voidhistogramLUT(boolean entireFlag, boolean separateFrame, boolean simple) booleanReturns whether the imageA LUT panel is currently visible and active.booleanReturns whether the imageB LUT panel is currently visible and activebooleanReturns true if image A or B is in dual threshold inverse mode (for JDialogConvertType input ranges).private voidprocessFileMenu(String command) Called when the FileMenu is activated.private voidprocessUtilitiesMenu(ActionEvent event, String command) Called when the Utilities Menu is activated.voidRedraws the histogram interface for the currently selected image.voidresizePanel(int panelWidth, int frameHeight) Resizing the control panel with ViewJFrameVolumeView's frame width and height.voidsetActiveImage(ModelImage image) Sets which image is currently active and makes the corresponding tabbed pane visible.voidsetBlueOn(boolean isOn, boolean isImageA) Sets the blue flag to be on or off.voidsetColocalizationEMFrame(ViewJFrameColocalizationEM colocalizationEMFrame) Called from ViewJFrameColocalizationEM.voidsetColocalizationRegFrame(ViewJFrameColocalizationRegression colocalizationRegFrame) Called from ViewJFrameColocalizationRegression.voidsetGreenOn(boolean isOn, boolean isImageA) Sets the green flag to be on or off.voidsetImageB(ModelImage image, ModelStorageBase LUT) Sets the imageB for the LUT interface.voidsetImages(ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) voidsetLUT(JPanelHistogram panel, ModelStorageBase LUT) Sets the LUT for the input panel.voidsetLUTA(ModelStorageBase LUT) Set LUTavoidsetLUTB(ModelStorageBase LUT) Set LUTbvoidsetRedOn(boolean isOn, boolean isImageA) Sets the red flag to be on or off.voidsetSlice(int slice) setSlice.voidsetTimeSlice(int tSlice) setTimeSlice.voidsetTransferFunctionA(TransferFunction txFunction) Set the transfer function for imageA.voidsetTransferFunctionB(TransferFunction txFunction) Set the transfer function for imageA.voidstateChanged(ChangeEvent event) voidupdateFrames(boolean flag) booleanThis methods calls the componentImage's REPAINT method to redraw the screen.booleanThis methods calls the componentImage's REPAINT method to redraw the screen.booleanupdateImages(boolean flag) This methods calls the componentImage's update method to redraw the screen.booleanupdateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode) This methods calls the componentImage's update method to redraw the screen.voidupdates the interpolation mode for the images.voidupdateRealTime(boolean updateRealTime) Updates the interface behavior when the user choses to update in real-time or on mouse release.voidwindowActivated(WindowEvent arg0) voidwindowClosed(WindowEvent arg0) voidwindowClosing(WindowEvent arg0) voidwindowDeactivated(WindowEvent arg0) voidwindowDeiconified(WindowEvent arg0) voidwindowIconified(WindowEvent arg0) voidwindowOpened(WindowEvent arg0) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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 Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
colEMFrame
reference to the colocalization frame for updatng the image. -
colRegFrame
reference to the colocalization frame for updatng the image. -
imageA
source image A -
imageB
source image B -
LUTa
lut a -
LUTb
lut b -
regComponent
false = apply algorithm only to VOI regions. -
wholeImage
protected boolean wholeImagetrue = apply algorithm to the whole image -
parentFrame
Parent frame of this dialog, usually of type ViewJFrameImage. -
voiDialog
Dialog that enables the user to choose to apply the lut to the entire image, or voi regions. -
containingFrame
frame containing the lut interface (if display in a stand-alone window) -
containingPanel
panel containing the lut interface (used in the stand-alone frame or in an outside frame) -
dualImage
protected boolean dualImageset to true when the lut interface contains two images (imageA and imageB) -
tabbedPane
tabbed pane, each separate tab contains the interface for imageA and imageB -
panelA
histogram interface panels for imageA and imageB -
panelB
histogram interface panels for imageA and imageB -
useSeparateFrame
private boolean useSeparateFrameWhether this panel is contained in another frame or forms its own frame
-
-
Constructor Details
-
JFrameHistogram
public JFrameHistogram(Frame theParentFrame, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) Creates the JFrameHistogram class. Initializes the images and LUTs, does not create the interface until the constructDialog() function is called, which asks the user if the luts should be applied to the VOI region or to the entire image, or until the histogramLUT() function is called to create the frame and interface panels.- Parameters:
theParentFrame-imA- imageAimB- imageB_LUTa- lutA (either ModelLUT or ModelRGB)_LUTb- lutb (either ModelLUT or ModelRGB)
-
JFrameHistogram
public JFrameHistogram(Frame theParentFrame, ViewJComponentRegistration _regComponent, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) Creates the JFrameHistogram class. Initializes the images and LUTs, does not create the interface until the constructDialog() function is called, which asks the user if the luts should be applied to the VOI region or to the entire image, or until the histogramLUT() function is called to create the frame and interface panels.- Parameters:
theParentFrame-_regComponent- registration component image to update on lut changes.imA- imageAimB- imageB_LUTa- lutA (either ModelLUT or ModelRGB)_LUTb- lutb (either ModelLUT or ModelRGB)
-
-
Method Details
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
closeFrame
public void closeFrame()Closes the stand-alone interface frame. -
closeImageB
public void closeImageB()Closes imageB and removes the tabbed-pane interface, replacing it with a single interface panel. -
constructDialog
public void constructDialog(boolean separateFrame) Creates a dialog to choose if histogram should be over all of image or just VOI regions. -
disposeLocal
public void disposeLocal()Removes this from the image display listeners. Removes and deletes the interface panels. -
doCalcThresholdVolume
public boolean doCalcThresholdVolume()Returns true if 'Calculate threshold volume' is selected.- Returns:
- true if 'Calculate threshold volume' is selected, false otherwise.
-
getContainingPanel
Returns the main interface panel for display in another interface.- Returns:
- the main interface panel for display in another interface.
-
getLowerThreshold
public float getLowerThreshold()Returns the lower threshold image value for whichever image is current selected.- Returns:
- the lower threshold image value for whichever image is current selected.
-
getSelectedPanel
Returns the currently selected interface panel.- Returns:
- the currently selected interface panel.
-
getUpperThreshold
public float getUpperThreshold()Returns the upper threshold image value for whichever image is current selected.- Returns:
- the upper threshold image value for whichever image is current selected.
-
setImages
public void setImages(ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb) -
histogramLUT
public void histogramLUT(boolean entireFlag, boolean separateFrame) Creates the user interface for LUT changes. The entieFlag indicates if the entire image is to be used in the histogram calculation and LUT change, or if only the VOI regions are to be used. The separateFrame flag indicates if the interface is to be displayed in a stand-along window or inside another outside interface.- Parameters:
entireFlag- when true apply the LUT to the entire image, when false apply to VOI regions only.separateFrame- when true create and display the LUT interface in a separate, stand-alone window, when false create the interface for display in another outside frame or panel.
-
histogramLUT
public void histogramLUT(boolean entireFlag, boolean separateFrame, boolean simple) -
isImageASelected
public boolean isImageASelected()Returns whether the imageA LUT panel is currently visible and active.- Returns:
- whether the imageA LUT panel is currently visible and active.
-
isImageBSelected
public boolean isImageBSelected()Returns whether the imageB LUT panel is currently visible and active. *- Returns:
- whether the imageB LUT panel is currently visible and active.
-
isThresholding
public boolean isThresholding()Returns true if image A or B is in dual threshold inverse mode (for JDialogConvertType input ranges).- Returns:
- boolean is dual threshold inverse mode.
-
redrawFrames
public void redrawFrames()Redraws the histogram interface for the currently selected image. -
resizePanel
public void resizePanel(int panelWidth, int frameHeight) Resizing the control panel with ViewJFrameVolumeView's frame width and height.- Parameters:
panelWidth- panel width.frameHeight- parent frame height.
-
setActiveImage
Sets which image is currently active and makes the corresponding tabbed pane visible.- Parameters:
image- the image to set as currently active.
-
setBlueOn
public void setBlueOn(boolean isOn, boolean isImageA) Sets the blue flag to be on or off.- Parameters:
isOn- flag, either on or off.isImageA- when true apply to imageA, when false apply to imageB.
-
setColocalizationEMFrame
Called from ViewJFrameColocalizationEM. Enables LUT changes to be applied to that frame.- Parameters:
colocalizationEMFrame-
-
setColocalizationRegFrame
Called from ViewJFrameColocalizationRegression. Enables LUT changes to be applied to that frame.- Parameters:
colocalizationEMFrame-
-
setGreenOn
public void setGreenOn(boolean isOn, boolean isImageA) Sets the green flag to be on or off.- Parameters:
isOn- flag, either on or off.isImageA- when true apply to imageA, when false apply to imageB.
-
setImageB
Sets the imageB for the LUT interface. If the interface is not currently a dual-panel interface, it is re-created with the tabbed pane and two interface panels.- Parameters:
image-LUT-
-
setLUT
Sets the LUT for the input panel.- Parameters:
panel- the panel to set the LUT for.LUT- the new LUT.
-
setLUTA
Set LUTa- Parameters:
LUT-
-
setLUTB
Set LUTb- Parameters:
LUT-
-
setRedOn
public void setRedOn(boolean isOn, boolean isImageA) Sets the red flag to be on or off.- Parameters:
isOn- flag, either on or off.isImageA- when true apply to imageA, when false apply to imageB.
-
setSlice
public void setSlice(int slice) Description copied from interface:ViewImageUpdateInterfacesetSlice.- Specified by:
setSlicein interfaceViewImageUpdateInterface- Parameters:
slice- Current slice
-
setTimeSlice
public void setTimeSlice(int tSlice) Description copied from interface:ViewImageUpdateInterfacesetTimeSlice.- Specified by:
setTimeSlicein interfaceViewImageUpdateInterface- Parameters:
tSlice- Current time volume
-
setTransferFunctionA
Set the transfer function for imageA.- Parameters:
txFunction-
-
setTransferFunctionB
Set the transfer function for imageA.- Parameters:
txFunction-
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-
updateFrames
public void updateFrames(boolean flag) - Parameters:
flag-
-
updateImageExtents
public boolean updateImageExtents()Description copied from interface:ViewImageUpdateInterfaceThis methods calls the componentImage's REPAINT method to redraw the screen. The extents on this image have changed, so the extents need to be read in again and menus, panes and slide bars adjusted accordingly.- Specified by:
updateImageExtentsin interfaceViewImageUpdateInterface- Returns:
- boolean confirming successful update
-
updateImages
public boolean updateImages()Description copied from interface:ViewImageUpdateInterfaceThis methods calls the componentImage's REPAINT method to redraw the screen. Without LUT changes or image changes- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Returns:
- boolean confirming successful update
-
updateImages
public boolean updateImages(boolean flag) Description copied from interface:ViewImageUpdateInterfaceThis methods calls the componentImage's update method to redraw the screen. Without LUT changes.- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Parameters:
flag- forces show to re import image and calc. java image- Returns:
- boolean confirming successful update
-
updateImages
Description copied from interface:ViewImageUpdateInterfaceThis methods calls the componentImage's update method to redraw the screen.- Specified by:
updateImagesin interfaceViewImageUpdateInterface- Parameters:
LUTa- LUT used to update imageALUTb- LUT used to update imageBflag- forces show to re import image and calc. java imageinterpMode- image interpolation method (Nearest or Smooth)- Returns:
- boolean confirming a successful update
-
updateInterpolation
public void updateInterpolation()updates the interpolation mode for the images. -
updateRealTime
public void updateRealTime(boolean updateRealTime) Updates the interface behavior when the user choses to update in real-time or on mouse release.- Parameters:
updateRealTime-
-
windowActivated
- Specified by:
windowActivatedin interfaceWindowListener
-
windowClosed
- Specified by:
windowClosedin interfaceWindowListener
-
windowClosing
- Specified by:
windowClosingin interfaceWindowListener
-
windowDeactivated
- Specified by:
windowDeactivatedin interfaceWindowListener
-
windowDeiconified
- Specified by:
windowDeiconifiedin interfaceWindowListener
-
windowIconified
- Specified by:
windowIconifiedin interfaceWindowListener
-
windowOpened
- Specified by:
windowOpenedin interfaceWindowListener
-
buildMenu
This method builds a menu which contains the options for opening/saving a LUT or set of transfer functions, closing the LUT, and utilities such as CT presets. -
createPanel
Creates the display panel. If there are two images the panel contains a tabbed pane with the two interfaces panels. If there is only one image the panel contains just the interface.- Returns:
- the new display panel.
-
createPanel
protected void createPanel(boolean simple) -
processFileMenu
Called when the FileMenu is activated. Processes the commands from the file menu.- Parameters:
command- the file menu command.
-
processUtilitiesMenu
Called when the Utilities Menu is activated. Processes the commands from the utilities menu.- Parameters:
command- the utilities menu command.
-