Package gov.nih.mipav.view
Class JPanelHistogram
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nih.mipav.view.JPanelHistogram
- All Implemented Interfaces:
HistoLUTParent,ActionListener,ItemListener,KeyListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener
public class JPanelHistogram
extends JPanel
implements ActionListener, ChangeListener, ItemListener, KeyListener, HistoLUTParent
- 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 JCheckBoxcheckbox for turning on / off the blue component of the color look-up table.private JDialogCTprivate intActive mouse cursor index of the imageA, B and GM image A, B.private JCheckBoxcheckbox for turning on / off the green component of the color look-up table.protected ModelHistogramred, green and blue histograms:protected ModelHistogramred, green and blue histograms:protected ModelHistogramred, green and blue histograms:protected ViewJPanelHistoLUThistogram panel interface.protected ModelImageinput imageprivate JTextFielddisplays the selected LUT colorprivate JCheckBoxturns interpolation on/offprivate JCheckBoxturns log display on/offprotected ModelStorageBaseinput LUT, either ModelLUT or ModelRGBprivate JSliderslider for small LUT changesprivate JLabel[]private JTextFielddisplays the number of colors in the LUTprivate JCheckBoxsets the minimum LUT value to (1,1,1)private JComboBoxenables the user to set the image output type or LUT-based image extrationprotected JFrameHistogramcontaining parent class.private floatX range value of the imageA, B and GM imageA, B.private JCheckBoxcheckbox for turning on / off the red component of the color look-up table.protected intprivate static final longprivate JTextFielddisplays the threshold fill-valueprivate JTextFielddisplays the threshold lower-valueprivate JTextFielddisplays the threshold upper-valueprotected JToolBarbottom tool barprotected JToolBarthreshold tool barprivate JCheckBoxenables the user to set updating the display in real-time or only on mouse-releaseprivate JLabelvolume threshold vaueprotected booleantrue = apply algorithm to the whole imageprivate JTextFieldprivate JTextFieldFields 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
ConstructorsConstructorDescriptionJPanelHistogram(ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage) Creates the JPanelHistogram.JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage) Creates the JPanelHistogram, with the JFrameHistogram as the containing class.JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage, boolean _simpleLUT) Creates the JPanelHistogram, with the JFrameHistogram as the containing class. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) protected JPanelbuildControlPanel(ModelImage image, boolean addAdjustment) Builds the interface panel.private static final JToolBarbuildLUTSelectionList(ActionListener listener) Build the center part of the LUT toolbar.protected JPanelbuildMousePanel(double range) Builds the mouse panel.protected voidMethod that displays the histogram and LUT and other controls to manipulate the LUT.protected voidprotected JPanelbuildSimpleToolBar(ModelImage image) protected JPanelbuildToolBar(ModelImage image) Builds the toolbars.protected ModelHistogramcalcHistogram(ModelImage image, boolean entireFlag, int offset) Calculates histogram for the image(s).voidCalculates the thresholded image based on the parameters of the threshold transfer function.voidCalculates the volume (for 3D images) or area (for 2D images) of the image between the two values from the upper and lower bounds text areas.voidcalculateThreshold(float lower, float upper) Calculates the volume or area of the image between the two values from the upper and lower bounds (inclusive).private voidcalculateThresholdArea(float lower, float upper) Calculates the area of the image between the two values from the upper and lower bounds (inclusive).private voidcalculateThresholdVolume(float lower, float upper) Calculates the volume of the image between the two values from the upper and lower bounds (inclusive).voidResets the threshold volume and area labels.voidRemoves and deletes local memory.voiddragPoint(MouseEvent mouseEvent) Handle the dragging of a transfer function point.Creates a Vectoror LUT names representing different color look-up tables. floatintgetMode()floatbooleanbooleanIndicates if real-time update of the image should take place.protected static final booleanreturns true if the first entry in the color look-up table is (1,1,1), false otherwise.voiditemStateChanged(ItemEvent event) voidkeyPressed(KeyEvent arg0) voidkeyReleased(KeyEvent arg0) voidprivate voidUpdates the number of colors in the LUT and updates the displays.private voidUpdates the number of colors in the LUT and updates the displays.voidResets the histogram and histogram panel.voidAccessor to disable the all RGB color channels button if one of the lines has moved.voidsetBlueOn(boolean isOn) Sets the blue checkbox on/off.voidsetGreenOn(boolean isOn) Sets the green checkbox on/off.voidsetImage(ModelImage newImage) voidReplaces the LUT and builds a new LUT component.voidsetLUT(ModelStorageBase newLUT) Sets the LUT and updates the histogram panel.voidsetNColors(int value) Change the text field showing the number of colors.voidsetRangeText(float x, float y, int _index) Set the range value of the text field.voidsetRedOn(boolean isOn) Sets the red checkbox on/off.voidstateChanged(ChangeEvent event) voidRedraw the componentLUT.voidupdateFrames(boolean flag) Update all of the image frames that display the image this histo lut is for.voidSets the position string in the LUT text field.voidupdateRealTime(boolean updateRealTime) 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, 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:
-
blueCheckBox
checkbox for turning on / off the blue component of the color look-up table. -
ctDialog
-
greenCheckBox
checkbox for turning on / off the green component of the color look-up table. -
histogram
red, green and blue histograms: -
histogramG
red, green and blue histograms: -
histogramB
red, green and blue histograms: -
histoPanel
histogram panel interface. -
indexColorTextF
displays the selected LUT color -
interpCheckBox
turns interpolation on/off -
logCheckBox
turns log display on/off -
nColorsTextF
displays the number of colors in the LUT -
oneBasedLUTCheckBoxImage
sets the minimum LUT value to (1,1,1) -
outputBox
enables the user to set the image output type or LUT-based image extration -
redCheckBox
checkbox for turning on / off the red component of the color look-up table. -
threshFillF
displays the threshold fill-value -
threshLowerF
displays the threshold lower-value -
threshUpperF
displays the threshold upper-value -
toolBarBottom
bottom tool bar -
toolBarThreshold
threshold tool bar -
updateCheckBox
enables the user to set updating the display in real-time or only on mouse-release -
voxelVolumeLabel
volume threshold vaue -
image
input image -
LUT
input LUT, either ModelLUT or ModelRGB -
panelParent
containing parent class. -
wholeImage
protected boolean wholeImagetrue = apply algorithm to the whole image -
cursorIndex
private int cursorIndexActive mouse cursor index of the imageA, B and GM image A, B. -
rangeX
private float rangeXX range value of the imageA, B and GM imageA, B. -
mouseSlider
slider for small LUT changes -
xRangeText
-
yRangeText
-
scaleRange
protected int scaleRange -
mouseSliderLabels
-
labelsTable
-
-
Constructor Details
-
JPanelHistogram
public JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage) Creates the JPanelHistogram, with the JFrameHistogram as the containing class.- Parameters:
_panelParent- parent class._image- input image._LUT- input LUT (ModelLUT or ModelRGB)._wholeImage- , when true apply the LUT to the entire image, when false apply to VOI regions only.
-
JPanelHistogram
Creates the JPanelHistogram.- Parameters:
_image- input image._LUT- input LUT (ModelLUT or ModelRGB)._wholeImage- , when true apply the LUT to the entire image, when false apply to VOI regions only.
-
JPanelHistogram
public JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage, boolean _simpleLUT) Creates the JPanelHistogram, with the JFrameHistogram as the containing class.- Parameters:
_panelParent- parent class._image- input image._LUT- input LUT (ModelLUT or ModelRGB)._wholeImage- , when true apply the LUT to the entire image, when false apply to VOI regions only.
-
-
Method Details
-
buildLUTSelectionList
Build the center part of the LUT toolbar.- Parameters:
listener- The listener to attach to the created LUT selection combo box.- Returns:
- the top part of the LUT toolbar
-
getCustomLUTList
Creates a Vectoror LUT names representing different color look-up tables. - Returns:
- a Vector
or LUT names representing different color look-up tables.
-
isLUT1Based
returns true if the first entry in the color look-up table is (1,1,1), false otherwise.- Parameters:
LUT- the LUT to query, either a ModelLUT or ModelRGB- Returns:
- true if the first entry in the color look-up table is (1,1,1), false otherwise.
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
calcThreshold
public void calcThreshold()Calculates the thresholded image based on the parameters of the threshold transfer function. Image A is thresholded if the selected panel is for imageA and likewise for image B. -
calculateThreshold
public void calculateThreshold()Calculates the volume (for 3D images) or area (for 2D images) of the image between the two values from the upper and lower bounds text areas. -
calculateThreshold
public void calculateThreshold(float lower, float upper) Calculates the volume or area of the image between the two values from the upper and lower bounds (inclusive).- Parameters:
lower- Lower bound of the threshold (inclusive).upper- Upper bound of the threshold (inclusive).
-
clearVoxelLabel
public void clearVoxelLabel()Resets the threshold volume and area labels. -
disposeLocal
public void disposeLocal()Removes and deletes local memory. -
dragPoint
Description copied from interface:HistoLUTParentHandle the dragging of a transfer function point.- Specified by:
dragPointin interfaceHistoLUTParent- Parameters:
mouseEvent- the point dragging event
-
getLowerThreshold
public float getLowerThreshold()- Returns:
- the lower threshold value.
-
getMode
public int getMode()- Returns:
- he HIstoLUTComponent mode.
-
getUpperThreshold
public float getUpperThreshold()- Returns:
- the upper threshold value.
-
interpolateImage
public boolean interpolateImage()- Returns:
- if the image interpolation checkbox is selected.
-
isImageUpdate
public boolean isImageUpdate()Description copied from interface:HistoLUTParentIndicates if real-time update of the image should take place.- Specified by:
isImageUpdatein interfaceHistoLUTParent- Returns:
- if the update in real-time checkbox is selected.
-
itemStateChanged
- Specified by:
itemStateChangedin interfaceItemListener
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
resetHistoLUT
public void resetHistoLUT()Resets the histogram and histogram panel. -
setAllOff
public void setAllOff()Description copied from interface:HistoLUTParentAccessor to disable the all RGB color channels button if one of the lines has moved.- Specified by:
setAllOffin interfaceHistoLUTParent
-
setBlueOn
public void setBlueOn(boolean isOn) Sets the blue checkbox on/off.- Parameters:
isOn-
-
setGreenOn
public void setGreenOn(boolean isOn) Sets the green checkbox on/off.- Parameters:
isOn-
-
setLUT
Description copied from interface:HistoLUTParentReplaces the LUT and builds a new LUT component.- Specified by:
setLUTin interfaceHistoLUTParent- Parameters:
newLUT- New LUT
-
setImage
-
setLUT
Sets the LUT and updates the histogram panel.- Parameters:
newLUT-
-
setNColors
public void setNColors(int value) Change the text field showing the number of colors.- Parameters:
value- the number of colors
-
setRangeText
public void setRangeText(float x, float y, int _index) Description copied from interface:HistoLUTParentSet 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
-
setRedOn
public void setRedOn(boolean isOn) Sets the red checkbox on/off.- Parameters:
isOn-
-
stateChanged
- Specified by:
stateChangedin interfaceChangeListener
-
updateComponentLUT
public void updateComponentLUT()Description copied from interface:HistoLUTParentRedraw the componentLUT.- Specified by:
updateComponentLUTin interfaceHistoLUTParent
-
updateFrames
public void updateFrames(boolean flag) Description copied from interface:HistoLUTParentUpdate 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:
-
updateLUTPositionString
Description copied from interface:HistoLUTParentSets the position string in the LUT text field.- Specified by:
updateLUTPositionStringin interfaceHistoLUTParent- Parameters:
str- the position string
-
updateRealTime
public void updateRealTime(boolean updateRealTime) - Parameters:
updateRealTime-
-
updateThresholdFields
public void updateThresholdFields(float lower, float upper) Description copied from interface:HistoLUTParentMethod 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
-
buildControlPanel
Builds the interface panel.- Parameters:
image-addAdjustment-- Returns:
-
buildMousePanel
Builds the mouse panel.- Parameters:
range-- Returns:
-
buildPanel
protected void buildPanel()Method that displays the histogram and LUT and other controls to manipulate the LUT. Panel for image A.- Parameters:
image- Model of imageLUT- Model of LUTentireFlag- Flag indicating if histogram should be made of entire image.
-
buildSimplePanel
protected void buildSimplePanel() -
buildToolBar
Builds the toolbars.- Parameters:
image-- Returns:
-
buildSimpleToolBar
-
calcHistogram
Calculates histogram for the image(s).- Parameters:
entireFlag- if true calculate histogram for the entire image. if false uses areas defined by VOI regions.imageAorB- flag to indicate if histogram is to be calculated for imageA or imageB.progressFlag- passed to calculateHistogram algorithm. If false progress bar is not displayed
-
calculateThresholdArea
private void calculateThresholdArea(float lower, float upper) Calculates the area of the image between the two values from the upper and lower bounds (inclusive).- Parameters:
lower- Lower bound of the threshold (inclusive).upper- Upper bound of the threshold (inclusive).
-
calculateThresholdVolume
private void calculateThresholdVolume(float lower, float upper) Calculates the volume of the image between the two values from the upper and lower bounds (inclusive).- Parameters:
lower- Lower bound of the threshold (inclusive).upper- Upper bound of the threshold (inclusive).
-
makeLUT
Updates the number of colors in the LUT and updates the displays.- Parameters:
selectedLUT-nColors-
-
makeLUT
Updates the number of colors in the LUT and updates the displays.- Parameters:
selectedLUT-nColors-makeLUT-
-