Class WindowLevel


  • public class WindowLevel
    extends java.lang.Object
    The WindowLevel class provides mouse-driven window-level controls for the ModelLUT or ModelRGB lookup tables. The WindowLevel class can be used to attach mouse-control or any user-interface control to both the ModelLUT and ModelRGB classes.
    See Also:
    ViewJComponentEditImage.java, PlaneRender.java
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean doRelative
      If true, window/level adjusted relative to the current transfer function values If false, window/level adjusted to the absolute image position values
      private float[] m_afXWin
      Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.
      private float[] m_afYWin
      Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.
      private float m_fAlpha
      Default alpha blending value:
      private float m_fMax
      image max value
      private float m_fMin
      image min value
      private float m_fOldX
      previous mouse x-position
      private float m_fOldY
      previous mouse y-position
      private float old_fLevel  
      private float old_fWindow  
    • Constructor Summary

      Constructors 
      Constructor Description
      WindowLevel()
      Default constructor.
    • Field Detail

      • m_afXWin

        private float[] m_afXWin
        Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.
      • m_afYWin

        private float[] m_afYWin
        Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.
      • m_fMax

        private float m_fMax
        image max value
      • m_fMin

        private float m_fMin
        image min value
      • m_fOldX

        private float m_fOldX
        previous mouse x-position
      • m_fOldY

        private float m_fOldY
        previous mouse y-position
      • m_fAlpha

        private float m_fAlpha
        Default alpha blending value:
      • doRelative

        private boolean doRelative
        If true, window/level adjusted relative to the current transfer function values If false, window/level adjusted to the absolute image position values
      • old_fWindow

        private float old_fWindow
      • old_fLevel

        private float old_fLevel
    • Constructor Detail

      • WindowLevel

        public WindowLevel()
        Default constructor.
    • Method Detail

      • disposeLocal

        public void disposeLocal()
        Clean memory.
      • updateWinLevel

        public boolean updateWinLevel​(float fX,
                                      float fY,
                                      boolean bFirstUpdate,
                                      ModelStorageBase kLookupTable,
                                      ModelImage kImage)
        updateWinLevel updates the window-level for the input lookup table based on two normalized parameters (fX, fY). These parameters may be derived from a normalized x,y mouse position, from slider values, or from any variable. In ViewJComponentEditImage and PlaneRender classesL If the right mouse button is pressed and dragged. updateWinLevel updates the HistoLUT window and level (contrast and brightness) for the ViewJComponentEditImage and PlaneRender classes. The input parameters fX and fY must be in normalized screen space (0-1).
        Parameters:
        fX - the normalized window parameter (0-1)
        fY - the normalized level parameter (0-1)
        bFirstUpdate - when true initialize the WindowLevel function
        kLookupTable - either the ModelLUT or the ModelRGB being modified
        kImage - the ModelImage the lookup table describes.
        Returns:
        true when the lookup table changes, false when no change
      • setAlpha

        public void setAlpha​(float fAlpha)
        Sets alpha for the notifyWindowDisplayListeners call
        Parameters:
        fAlpha - the alpha value for blending between images. Needed to pass to the notifyWindowDisplayListeners function.
      • initWinLevelRGB

        private void initWinLevelRGB​(ModelRGB kRGBT,
                                     ModelImage kImage)
        initWinLevelRGB, initializes the ModelRGB for window-level changes. The transfer function is set to have four control points, and is reset to the default linear.
        Parameters:
        kRGBT - the ModelRGB to be initialized
        kImage - the ModelImage that the min/max values are derived from for initializing the ModelRGB.
      • winLevelRGB

        private void winLevelRGB​(ModelRGB kRGBT,
                                 ModelImage kImage)
        winLevelRGB finds old_fWindow and old_fLevel.
        Parameters:
        kRGBT - the ModelRGB
        kImage - the ModelImage
      • initWinLevelGray

        private void initWinLevelGray​(ModelLUT kLUT,
                                      ModelImage kImage)
        initWinLevelGray, initializes the ModelLUT for gray-scale images before window-level operations. The transfer function is set to have four control points, and is reset to the default linear.
        Parameters:
        kLUT - the ModelLUT to be initialized.
        kImage - the ModelImage attached to kLUT
      • winLevelGray

        private void winLevelGray​(ModelLUT kLUT,
                                  ModelImage kImage)
        winLevelGray finds old_fWindow and old_fLevel
        Parameters:
        kLUT - the ModelLUT
        kImage - the ModelImage attached to kLUT
      • updateWinLevelRGB

        private void updateWinLevelRGB​(ModelRGB kRGBT,
                                       ModelImage kImage,
                                       float[] afXWin,
                                       float[] afYWin)
        updateWinLevelRGB, updates the ModelRGB with the new transfer functions. Updates depend on the activation of the different rgb functions, so if the getROn returns false the red function is not updated.
        Parameters:
        kRGBT - the ModelRGB being updated
        kImage - the ModelImage that the ModelRGB describes
        afXWin - the x-transfer function
        afYWin - the y-transfer function
      • updateWinLevelGray

        private void updateWinLevelGray​(ModelLUT kLUT,
                                        ModelImage kImage,
                                        float[] afXWin,
                                        float[] afYWin)
        updateWinLevelGray, updates the ModelLUT with the new transfer function.
        Parameters:
        kLUT - the ModelLUT being updated
        kImage - the ModelImage that the ModelLUT describes
        afXWin - the x-transfer function
        afYWin - the y-transfer function
      • getWindowValue

        public float getWindowValue()
      • getLevelValue

        public float getLevelValue()