Class 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • IMAGE_A

      public static final int IMAGE_A
      DOCUMENT ME!
      See Also:
    • IMAGE_B

      public static final int IMAGE_B
      DOCUMENT ME!
      See Also:
    • closeButton

      private JButton closeButton
      DOCUMENT ME!
    • saveButton

      private JButton saveButton
      DOCUMENT ME!
    • loadButton

      private JButton loadButton
      DOCUMENT ME!
    • dataSlice

      private final float[] dataSlice
      Reference 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

      private final ModelImage image
      Reference to the image that will be affected by the adjust of the window and level.
    • level

      private float level
      Average of the min and max extents of the transfer window that describes the window size.
    • min

      private float min
    • max

      private float max
    • levelSlider

      public JSlider levelSlider
      DOCUMENT ME!
    • minSlider

      public JSlider minSlider
      DOCUMENT ME!
    • levelSliderMax

      private int levelSliderMax
      Stores the maximum slider value.
    • LUT

      private final ModelLUT LUT
      Reference to the LUT used to display the image.
    • maxImage

      private float maxImage
      Image's maximum intensity.
    • minImage

      private float minImage
      Image's minimum intensity.
    • windowLevelPanel

      private final JPanel windowLevelPanel
      DOCUMENT ME!
    • minMaxPanel

      private final JPanel minMaxPanel
      DOCUMENT ME!
    • window

      private float window
      The size of the window.
    • windowSlider

      public JSlider windowSlider
      DOCUMENT ME!
    • maxSlider

      public JSlider maxSlider
      DOCUMENT ME!
    • windowSliderMax

      private int windowSliderMax
      Stores the minimum slider value.
    • winValTextField

      private JTextField winValTextField
      textfield inputs for window and level *
    • levelValTextField

      private JTextField levelValTextField
      textfield inputs for window and level *
    • minValTextField

      private JTextField minValTextField
      textfield inputs for window and level *
    • maxValTextField

      private JTextField maxValTextField
      textfield inputs for window and level *
    • winMaxFloat

      public float winMaxFloat
      the maxes and mins for window and level *
    • winMinFloat

      public float winMinFloat
      the maxes and mins for window and level *
    • levelMaxFloat

      public float levelMaxFloat
      the maxes and mins for window and level *
    • levelMinFloat

      public float levelMinFloat
      the maxes and mins for window and level *
    • x

      private final float[] x
      Three arrays to save the coordinates of the LUT's transfer fucntion. z[] not used.
    • y

      private final float[] y
      DOCUMENT ME!
    • z

      private final float[] z
      DOCUMENT ME!
    • tabbedPane

      public JTabbedPane tabbedPane
      tabbed pane for w/L and min/max *
    • minMaxSlope

      public float minMaxSlope
      slope for mapping of min/max sliders *
    • minMaxBInt

      public float minMaxBInt
      b intercept for mapping of min/max sliders *
    • keyTyped

      public boolean keyTyped
    • allowChangesWin

      private int allowChangesWin
      allow changes to the window and level boundaries *
    • allowChangesMinMax

      private int allowChangesMinMax
      allow changes to the min and max boundaries *
    • sliderMinMax

      private JLabel sliderMinMax
      labels at top and bottom of sliders indicating slider bounds *
    • sliderMinMin

      private JLabel sliderMinMin
      labels at top and bottom of sliders indicating slider bounds *
    • sliderMaxMax

      private JLabel sliderMaxMax
      labels at top and bottom of sliders indicating slider bounds *
    • sliderMaxMin

      private JLabel sliderMaxMin
      labels at top and bottom of sliders indicating slider bounds *
    • sliderWinMin

      private JLabel sliderWinMin
    • sliderWinMax

      private JLabel sliderWinMax
    • sliderLevMin

      private JLabel sliderLevMin
    • sliderLevMax

      private JLabel sliderLevMax
  • Constructor Details

    • JDialogWinLevel

      public JDialogWinLevel(Frame theParentFrame, ModelImage image, ModelLUT LUT)
      Constructor.
      Parameters:
      theParentFrame - parent frame
      image - source image
      LUT - DOCUMENT ME!
    • JDialogWinLevel

      public JDialogWinLevel(ModelImage image, ModelLUT LUT, boolean plugIn)
      Constructor.
      Parameters:
      image - source image
      LUT - DOCUMENT ME!
      theParentFrame - parent frame
    • JDialogWinLevel

      public JDialogWinLevel(Frame theParentFrame, ModelImage image, ModelLUT LUT, float[] dataS)
      Constructor.
      Parameters:
      theParentFrame - parent frame
      image - source image
      LUT - DOCUMENT ME!
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Closes dialog box when the OK button is pressed and calls the algorithm.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      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" is false or when there is no property. The window/level dialog is "free." When there is "BoundWindowLevel" and when it is true, the window/level dialog will get relocated to next to the image window and then redrawn.
      Overrides:
      setVisible in class JDialogBase
      Parameters:
      vis - Flag indicating if the dialog should be visible.
      See Also:
      • invalid reference
        gov.nih.mipav.view.JDialogBase#setVisible(boolean)
      • invalid reference
        gov.nih.mipav.view.JDialogBase#setVisibleStandard(boolean)
      • locateDialog()
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Sets values based on knob along slider.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - event that triggered this function
    • keyTyped

      public void keyTyped(KeyEvent event)
      key typed
      Specified by:
      keyTyped in interface KeyListener
    • updateSliders

      public void updateSliders(int min, int max)
      Update the window, level sliders from CTPreset dialog.
      Parameters:
      min - min value
      max - max value
    • buildButtons

      private void buildButtons(GridBagConstraints gbc)
      Builds the close button.
      Parameters:
      gbc - DOCUMENT ME!
    • buildLevelSlider

      private void buildLevelSlider(JPanel spanel, GridBagConstraints gbc)
      Builds the level slider and places it in the slider panel.
      Parameters:
      spanel - DOCUMENT ME!
      gbc - DOCUMENT ME!
    • buildMinSlider

      private void buildMinSlider(JPanel spanel, GridBagConstraints gbc)
      Builds the min slider and places it in the slider panel.
      Parameters:
      spanel - DOCUMENT ME!
      gbc - DOCUMENT ME!
    • buildMaxSlider

      private void buildMaxSlider(JPanel spanel, GridBagConstraints gbc)
    • buildWindowLevelPanel

      private JPanel buildWindowLevelPanel()
      Builds the slider Panel.
      Parameters:
      borderTitle - the title of the border.
      Returns:
      DOCUMENT ME!
    • buildMinMaxPanel

      private JPanel buildMinMaxPanel()
    • buildWindowSlider

      private void buildWindowSlider(JPanel spanel, GridBagConstraints gbc)
      Builds the window slider and places it in the slider panel.
      Parameters:
      spanel - DOCUMENT ME!
      gbc - DOCUMENT ME!
    • validateCurrentNum

      public static final float validateCurrentNum(String numString, float min, float max)
      validate current number
      Parameters:
      numString -
      min -
      max -
      Returns:
    • validateMinMaxNums

      public static final boolean validateMinMaxNums(ModelImage img, String minString, String maxString)
    • updateHistoLUTFrame

      private void updateHistoLUTFrame()
      Displays histoLUT frame for a gray scale image.
    • keyPressed

      public void keyPressed(KeyEvent arg0)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent arg0)
      Specified by:
      keyReleased in interface KeyListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • 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

      public static final float[] calcMinMax(ModelImage img)
      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

      private static final int calcLevelSliderMax(ModelImage img)
    • calcWindowSliderMax

      private static final int calcWindowSliderMax(ModelImage img)
    • calcMinMaxSlope

      private static final float calcMinMaxSlope(ModelImage img)
    • 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

      public JTabbedPane getTabbedPane()
    • getLUT

      public ModelLUT getLUT()
    • setWinLevel

      public void setWinLevel(int windowValue, int levelValue)