Package gov.nih.mipav.view.dialogs
Class JDialogWinLevel
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
gov.nih.mipav.view.dialogs.JDialogBase
gov.nih.mipav.view.dialogs.JDialogWinLevel
- All Implemented Interfaces:
DialogDefaultsInterface,ActionListener,FocusListener,ItemListener,KeyListener,MouseListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,RootPaneContainer,WindowConstants
public class JDialogWinLevel
extends JDialogBase
implements ChangeListener, KeyListener, MouseListener
Dialog creates 2 sliders which adjust the level and window of an image. The level is found at the x coordinate of the
mid point of the sloping transfer segment. The window is the x width of the sloping transfer segment. Note y
inversion in transfer segment because graphical origin is in upper left corner.
________ / 255 ^ / | / | / | / invalid input: '<'------- Transfer function | / L | / U | / T | / | / | / |______/ 0 |________________________________> | | | minImage | level | maxImage | | st win end win
Image intensity
- Author:
- senseneyj
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gov.nih.mipav.view.dialogs.JDialogBase
JDialogBase.CancelAction, JDialogBase.HelpAction, JDialogBase.OKActionNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested 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 intallow changes to the min and max boundaries *private intallow changes to the window and level boundaries *private JButtonDOCUMENT ME!private final float[]Reference to the image data of the slice presently displayed.private final ModelImageReference to the image that will be affected by the adjust of the window and level.static final intDOCUMENT ME!static final intDOCUMENT ME!booleanprivate floatAverage of the min and max extents of the transfer window that describes the window size.floatthe maxes and mins for window and level *floatthe maxes and mins for window and level *DOCUMENT ME!private intStores the maximum slider value.private JTextFieldtextfield inputs for window and level *private JButtonDOCUMENT ME!private final ModelLUTReference to the LUT used to display the image.private floatprivate floatImage's maximum intensity.DOCUMENT ME!private JTextFieldtextfield inputs for window and level *private floatprivate floatImage's minimum intensity.floatb intercept for mapping of min/max sliders *private final JPanelDOCUMENT ME!floatslope for mapping of min/max sliders *DOCUMENT ME!private JTextFieldtextfield inputs for window and level *private JButtonDOCUMENT ME!private static final longUse serialVersionUID for interoperability.private JLabelprivate JLabelprivate JLabellabels at top and bottom of sliders indicating slider bounds *private JLabellabels at top and bottom of sliders indicating slider bounds *private JLabellabels at top and bottom of sliders indicating slider bounds *private JLabellabels at top and bottom of sliders indicating slider bounds *private JLabelprivate JLabeltabbed pane for w/L and min/max *private floatThe size of the window.private final JPanelDOCUMENT ME!DOCUMENT ME!private intStores the minimum slider value.floatthe maxes and mins for window and level *floatthe maxes and mins for window and level *private JTextFieldtextfield inputs for window and level *private final float[]Three arrays to save the coordinates of the LUT's transfer fucntion. z[] not used.private final float[]DOCUMENT ME!private final float[]DOCUMENT ME!Fields inherited from class gov.nih.mipav.view.dialogs.JDialogBase
applyButton, bar, cancelButton, cancelFlag, HELP, helpButton, mainDialogPanel, NEW, OKButton, parentFrame, progressBar, REPLACE, runInSeparateThread, runningScriptFlag, runQuiet, serif12, serif12B, voiManagerFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionJDialogWinLevel(ModelImage image, ModelLUT LUT, boolean plugIn) Constructor.JDialogWinLevel(Frame theParentFrame, ModelImage image, ModelLUT LUT) Constructor.JDialogWinLevel(Frame theParentFrame, ModelImage image, ModelLUT LUT, float[] dataS) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Closes dialog box when the OK button is pressed and calls the algorithm.private voidBuilds the close button.private voidbuildLevelSlider(JPanel spanel, GridBagConstraints gbc) Builds the level slider and places it in the slider panel.private voidbuildMaxSlider(JPanel spanel, GridBagConstraints gbc) private JPanelprivate voidbuildMinSlider(JPanel spanel, GridBagConstraints gbc) Builds the min slider and places it in the slider panel.private JPanelBuilds the slider Panel.private voidbuildWindowSlider(JPanel spanel, GridBagConstraints gbc) Builds the window slider and places it in the slider panel.private static final intprivate voidCalculate the maximum and minimum valuse to setup the window and level sliders.static final float[]calcMinMax(ModelImage img) Calculate the image range bounds for transfer function determination.private static final floatprivate static final intstatic final voidcalcWinLevTransferFunction(ModelImage img, float win, float lev, float[] tfx, float[] tfy) Calculate the x and y components of the transfer function, given the active image and the desired window and level.private voidchangeBounds(float left, float right, boolean levWin) overrides and expands the min/max and or the window/level boundaries of an image based on the transfer function being appliedgetLUT()floatgetMax()floatgetMin()floatvoidkeyPressed(KeyEvent arg0) voidkeyReleased(KeyEvent arg0) voidkey typedvoidSetting location of window-level adjustment panel based on the amount of space available near the image window.voidvoidvoidvoidvoidvoidvoidsetVisible(boolean vis) Overides the super.setVisible(boolean b) (which also locates a panel in the center of the screen), to use the super.setVisibleStandard(boolean b) which merely displays the Swing object onscreen.voidsetWinLevel(int windowValue, int levelValue) voidSets values based on knob along slider.private voidDisplays histoLUT frame for a gray scale image.voidupdateSliders(int min, int max) Update the window, level sliders from CTPreset dialog.static final floatvalidateCurrentNum(String numString, float min, float max) validate current numberstatic final booleanvalidateMinMaxNums(ModelImage img, String minString, String maxString) Methods inherited from class gov.nih.mipav.view.dialogs.JDialogBase
buildApplyButton, buildButtons, buildCancelButton, buildCancelButton, buildCloseButton, buildHelpButton, buildImageComboBox, buildOKButton, buildOKButton, buildOKCancelButtons, buildTitledBorder, buildTitledBorder, createLabel, createProgressBar, createProgressBar, createTextField, focusGained, focusLost, getDialogName, isCancelled, isQuietRunning, isRunInSeparateThread, isScriptRunning, itemStateChanged, loadDefaults, loadDefaults, makeImageName, makeString, openNewFrame, saveDefaults, saveDefaults, setLeftHandSystem, setQuietRunning, setScriptRunning, setSeparateThread, setVisible, setVisibleMenuBar, setVisibleStandard, setVOIManager, setWCSystem, testParameter, testParameterMin, updateFFTFileInfo, updateFileInfo, updateFileInfoOtherModality, updateFileInfoStatic, updateFileInfoStatic, updateFileTypeInfo, updateFileTypeInfo, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
IMAGE_A
public static final int IMAGE_ADOCUMENT ME!- See Also:
-
IMAGE_B
public static final int IMAGE_BDOCUMENT ME!- See Also:
-
closeButton
DOCUMENT ME! -
saveButton
DOCUMENT ME! -
loadButton
DOCUMENT ME! -
dataSlice
private final float[] dataSliceReference to the image data of the slice presently displayed. Needed to calculate the max/min of the slice used to adjust the transfer function. -
image
Reference to the image that will be affected by the adjust of the window and level. -
level
private float levelAverage of the min and max extents of the transfer window that describes the window size. -
min
private float min -
max
private float max -
levelSlider
DOCUMENT ME! -
minSlider
DOCUMENT ME! -
levelSliderMax
private int levelSliderMaxStores the maximum slider value. -
LUT
Reference to the LUT used to display the image. -
maxImage
private float maxImageImage's maximum intensity. -
minImage
private float minImageImage's minimum intensity. -
windowLevelPanel
DOCUMENT ME! -
minMaxPanel
DOCUMENT ME! -
window
private float windowThe size of the window. -
windowSlider
DOCUMENT ME! -
maxSlider
DOCUMENT ME! -
windowSliderMax
private int windowSliderMaxStores the minimum slider value. -
winValTextField
textfield inputs for window and level * -
levelValTextField
textfield inputs for window and level * -
minValTextField
textfield inputs for window and level * -
maxValTextField
textfield inputs for window and level * -
winMaxFloat
public float winMaxFloatthe maxes and mins for window and level * -
winMinFloat
public float winMinFloatthe maxes and mins for window and level * -
levelMaxFloat
public float levelMaxFloatthe maxes and mins for window and level * -
levelMinFloat
public float levelMinFloatthe maxes and mins for window and level * -
x
private final float[] xThree arrays to save the coordinates of the LUT's transfer fucntion. z[] not used. -
y
private final float[] yDOCUMENT ME! -
z
private final float[] zDOCUMENT ME! -
tabbedPane
tabbed pane for w/L and min/max * -
minMaxSlope
public float minMaxSlopeslope for mapping of min/max sliders * -
minMaxBInt
public float minMaxBIntb intercept for mapping of min/max sliders * -
keyTyped
public boolean keyTyped -
allowChangesWin
private int allowChangesWinallow changes to the window and level boundaries * -
allowChangesMinMax
private int allowChangesMinMaxallow changes to the min and max boundaries * -
sliderMinMax
labels at top and bottom of sliders indicating slider bounds * -
sliderMinMin
labels at top and bottom of sliders indicating slider bounds * -
sliderMaxMax
labels at top and bottom of sliders indicating slider bounds * -
sliderMaxMin
labels at top and bottom of sliders indicating slider bounds * -
sliderWinMin
-
sliderWinMax
-
sliderLevMin
-
sliderLevMax
-
-
Constructor Details
-
JDialogWinLevel
Constructor.- Parameters:
theParentFrame- parent frameimage- source imageLUT- DOCUMENT ME!
-
JDialogWinLevel
Constructor.- Parameters:
image- source imageLUT- DOCUMENT ME!theParentFrame- parent frame
-
JDialogWinLevel
Constructor.- Parameters:
theParentFrame- parent frameimage- source imageLUT- DOCUMENT ME!
-
-
Method Details
-
actionPerformed
Closes dialog box when the OK button is pressed and calls the algorithm.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classJDialogBase- Parameters:
event- event that triggers function
-
changeBounds
private void changeBounds(float left, float right, boolean levWin) overrides and expands the min/max and or the window/level boundaries of an image based on the transfer function being applied -
locateDialog
public void locateDialog()Setting location of window-level adjustment panel based on the amount of space available near the image window. -
setVisible
public void setVisible(boolean vis) Overides the super.setVisible(boolean b) (which also locates a panel in the center of the screen), to use the super.setVisibleStandard(boolean b) which merely displays the Swing object onscreen. (as if it super.super.setVisible(boolean b) could be called) when the property in MipavProps "BoundWindowLevel" isfalseor when there is no property. The window/level dialog is "free." When there is "BoundWindowLevel" and when it istrue, the window/level dialog will get relocated to next to the image window and then redrawn.- Overrides:
setVisiblein classJDialogBase- Parameters:
vis- Flag indicating if the dialog should be visible.- See Also:
-
stateChanged
Sets values based on knob along slider.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
e- event that triggered this function
-
keyTyped
key typed- Specified by:
keyTypedin interfaceKeyListener
-
updateSliders
public void updateSliders(int min, int max) Update the window, level sliders from CTPreset dialog.- Parameters:
min- min valuemax- max value
-
buildButtons
Builds the close button.- Parameters:
gbc- DOCUMENT ME!
-
buildLevelSlider
Builds the level slider and places it in the slider panel.- Parameters:
spanel- DOCUMENT ME!gbc- DOCUMENT ME!
-
buildMinSlider
Builds the min slider and places it in the slider panel.- Parameters:
spanel- DOCUMENT ME!gbc- DOCUMENT ME!
-
buildMaxSlider
-
buildWindowLevelPanel
Builds the slider Panel.- Parameters:
borderTitle- the title of the border.- Returns:
- DOCUMENT ME!
-
buildMinMaxPanel
-
buildWindowSlider
Builds the window slider and places it in the slider panel.- Parameters:
spanel- DOCUMENT ME!gbc- DOCUMENT ME!
-
validateCurrentNum
validate current number- Parameters:
numString-min-max-- Returns:
-
validateMinMaxNums
-
updateHistoLUTFrame
private void updateHistoLUTFrame()Displays histoLUT frame for a gray scale image. -
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
notifyImageDisplayListeners
public void notifyImageDisplayListeners() -
calcWinLevTransferFunction
public static final void calcWinLevTransferFunction(ModelImage img, float win, float lev, float[] tfx, float[] tfy) Calculate the x and y components of the transfer function, given the active image and the desired window and level.- Parameters:
img- The active image.win- The desired window.lev- The desired level.tfx- The array in which the x components of the transfer function will be placed. Should already be allocated and of size 4.tfy- The array in which the y components of the transfer function will be placed. Should already be allocated and of size 4.
-
calcMinMax
Calculate the image range bounds for transfer function determination.- Parameters:
img- The active image.- Returns:
- An array containing the minimum value of the range in the 0th index and the maximum in the 1st index.
-
calcLevelSliderMax
-
calcWindowSliderMax
-
calcMinMaxSlope
-
calcMinMax
private void calcMinMax()Calculate the maximum and minimum valuse to setup the window and level sliders. -
getMin
public float getMin() -
getMax
public float getMax() -
getWinMax
public float getWinMax() -
getTabbedPane
-
getLUT
-
setWinLevel
public void setWinLevel(int windowValue, int levelValue)
-