Class JPanelVolumeOpacity

All Implemented Interfaces:
ViewJComponentVolOpacityListener, ActionListener, ItemListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class JPanelVolumeOpacity extends JPanel implements ActionListener, ChangeListener, ItemListener, MouseListener, ViewJComponentVolOpacityListener
Simple panel containing the volume renderer opacity controls.
See Also:
  • Field Details

    • serialVersionUID

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

      private ModelHistogram histogramA
      Histogram reference for image A.
    • histogramB

      private ModelHistogram histogramB
      Histogram reference for image B.
    • histogramGM_A

      private ModelHistogram histogramGM_A
      Histogram reference for imageA GM.
    • histogramGM_B

      private ModelHistogram histogramGM_B
      Histogram reference for imageB GM.
    • isActiveImage

      private boolean isActiveImage
    • mainPanel

      protected JPanel mainPanel
      The main control.
    • COMP_A

      public static final int COMP_A
      Component tag indicator.
      See Also:
    • COMP_B

      public static final int COMP_B
      Component tag indicator.
      See Also:
    • COMP_GM_A

      public static final int COMP_GM_A
      Component tag indicator.
      See Also:
    • COMP_GM_B

      public static final int COMP_GM_B
      Component tag indicator.
      See Also:
    • OPACITY_COMPONENT_TAB_A

      protected static final String OPACITY_COMPONENT_TAB_A
      DOCUMENT ME!
      See Also:
    • OPACITY_COMPONENT_TAB_B

      protected static final String OPACITY_COMPONENT_TAB_B
      DOCUMENT ME!
      See Also:
    • OPACITY_COMPONENT_TAB_A_GM

      protected static final String OPACITY_COMPONENT_TAB_A_GM
      DOCUMENT ME!
      See Also:
    • OPACITY_COMPONENT_TAB_B_GM

      protected static final String OPACITY_COMPONENT_TAB_B_GM
      DOCUMENT ME!
      See Also:
    • RED

      public static final int RED
      Component tag indicator.
      See Also:
    • GREEN

      public static final int GREEN
      Component tag indicator.
      See Also:
    • BLUE

      public static final int BLUE
      Component tag indicator.
      See Also:
    • blendSlider

      protected JSlider blendSlider
      Opacity slider of texture 3D volume opacity changes.
    • componentOpacityA

      protected ViewJComponentVolOpacityBase componentOpacityA
      Reference to component opacity control A.
    • componentOpacityB

      protected ViewJComponentVolOpacityBase componentOpacityB
      Reference to component opacity control B.
    • componentOpacityGM_A

      protected ViewJComponentVolOpacityBase componentOpacityGM_A
      Reference to component opacity control A GM Rescale.
    • componentOpacityGM_B

      protected ViewJComponentVolOpacityBase componentOpacityGM_B
      Reference to component opacity control B GM Rescale.
    • GMCheckBox

      protected JCheckBox GMCheckBox
      Gradient Magnitude Check box of the grey scale image.
    • gradMagRescale_A

      protected ModelImage gradMagRescale_A
      Model image of the gradient magnitude of image A rescaled to have value in the range [0:255].
    • gradMagRescale_B

      protected ModelImage gradMagRescale_B
      Model image of the gradient magnitude of image B rescaled to have value in the range [0:255].
    • imageA

      protected ModelImage imageA
      Model image A.
    • imageB

      protected ModelImage imageB
      Model image B.
    • labelsTable

      protected Hashtable<Integer,JLabel> labelsTable
      Historgram dialog slider labels of the imageA, B and GM imageA, B.
    • labelsTableB

      protected Hashtable<Integer,JLabel> labelsTableB
      Historgram dialog slider labels of the imageA, B and GM imageA, B.
    • labelsTableGM_A

      protected Hashtable<Integer,JLabel> labelsTableGM_A
      Historgram dialog slider labels of the imageA, B and GM imageA, B.
    • labelsTableGM_B

      protected Hashtable<Integer,JLabel> labelsTableGM_B
      Historgram dialog slider labels of the imageA, B and GM imageA, B.
    • middleLabelValueA

      protected float middleLabelValueA
      DOCUMENT ME!
    • middleLabelValueB

      protected float middleLabelValueB
      DOCUMENT ME!
    • middleLabelValueGM_A

      protected float middleLabelValueGM_A
      DOCUMENT ME!
    • middleLabelValueGM_B

      protected float middleLabelValueGM_B
      DOCUMENT ME!
    • mouseSlider

      protected JSlider mouseSlider
      DOCUMENT ME!
    • mouseSliderB

      protected JSlider mouseSliderB
      DOCUMENT ME!
    • mouseSliderGM_A

      protected JSlider mouseSliderGM_A
      DOCUMENT ME!
    • mouseSliderGM_B

      protected JSlider mouseSliderGM_B
      DOCUMENT ME!
    • opacitySliderLabelsA

      protected JLabel[] opacitySliderLabelsA
      The labels below the opacity slider.
    • opacitySliderLabelsB

      protected JLabel[] opacitySliderLabelsB
      The labels below the opacity slider.
    • opacitySliderLabelsGM_A

      protected JLabel[] opacitySliderLabelsGM_A
      DOCUMENT ME!
    • opacitySliderLabelsGM_B

      protected JLabel[] opacitySliderLabelsGM_B
      DOCUMENT ME!
    • panelOpacityA

      protected JPanel panelOpacityA
      Panels that hold the the control components (opacity maps).
    • panelOpacityB

      protected JPanel panelOpacityB
      DOCUMENT ME!
    • panelOpacityGM_A

      protected JPanel panelOpacityGM_A
      DOCUMENT ME!
    • panelOpacityGM_B

      protected JPanel panelOpacityGM_B
      DOCUMENT ME!
    • rangeText

      protected JTextField rangeText
      X range text field in the imageA, B histogram dialog.
    • rangeTextB

      protected JTextField rangeTextB
      X range text field in the imageA, B histogram dialog.
    • rangeTextGM_A

      protected JTextField rangeTextGM_A
      X range text field in the Gradient Magnitude imageA, B histogram dialog.
    • rangeTextGM_B

      protected JTextField rangeTextGM_B
      X range text field in the Gradient Magnitude imageA, B histogram dialog.
    • scaleRangeA

      protected float scaleRangeA
      Scale range value according to the image min and max.
    • scaleRangeB

      protected float scaleRangeB
      Scale range value according to the image min and max.
    • scaleRangeGM_A

      protected float scaleRangeGM_A
      Scale range value according to the image min and max.
    • scaleRangeGM_B

      protected float scaleRangeGM_B
      Scale range value according to the image min and max.
    • tabbedPane

      protected JTabbedPane tabbedPane
      Tabbed pane that contains the list of opacity functions.
    • xRangeTextA

      protected JTextField xRangeTextA
      X range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • xRangeTextB

      protected JTextField xRangeTextB
      X range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • xRangeTextGM_A

      protected JTextField xRangeTextGM_A
      X range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • xRangeTextGM_B

      protected JTextField xRangeTextGM_B
      X range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • yRangeTextA

      protected JTextField yRangeTextA
      Y range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • yRangeTextB

      protected JTextField yRangeTextB
      Y range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • yRangeTextGM_A

      protected JTextField yRangeTextGM_A
      Y range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • yRangeTextGM_B

      protected JTextField yRangeTextGM_B
      Y range text field in the imageA, B and GM image A, B histogram dialog. Following text fields are used by the tri-planar volume view.
    • isChanging

      private boolean isChanging
  • Constructor Details

    • JPanelVolumeOpacity

      public JPanelVolumeOpacity(ModelImage _imgA, ModelImage _imgB)
      Creates new dialog for converting type of image.
      Parameters:
      _imgA - Source imageA.
      _imgB - Source imageB.
    • JPanelVolumeOpacity

      public JPanelVolumeOpacity(ModelImage _imgA, ModelImage _imgB, ModelImage _imageAGM, ModelImage _imageBGM)
      Creates new dialog for converting type of image.
      Parameters:
      _imgA - Source imageA.
      _imgB - Source imageB.
    • JPanelVolumeOpacity

      public JPanelVolumeOpacity(ModelImage _imgA, ModelImage _imgB, ModelImage _imageAGM, ModelImage _imageBGM, boolean _simpleDisplay)
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Closes dialog box when the OK button is pressed and sets the variables.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - Event that triggers this function
    • addGM

      public void addGM()
      Add the gradient magnitude histogram to the opacity control panel.
    • disposeLocal

      public void disposeLocal()
      Clear memory and garbage collection.
    • getAlphaBlendSliderValue

      public int getAlphaBlendSliderValue()
      This function returns the value of the blending slider.
      Returns:
      int the value of the slider, or a default of 50 (the median value) if the slider has not been initialized
    • getCompA

      public ViewJComponentVolOpacityBase getCompA()
      Return the opacity histrogram component of the imageA.
      Returns:
      componentOpacityA opacity component A.
    • getCompA_GM

      public ViewJComponentVolOpacityBase getCompA_GM()
      Return the opacity histrogram component of the Gradient Magnitude imageA.
      Returns:
      componentOpacityGM_A gradient magnitude component A.
    • getCompB

      public ViewJComponentVolOpacityBase getCompB()
      Return the opacity histrogram component of the imageB.
      Returns:
      componentOpacityB opacity component B.
    • getCompB_GM

      public ViewJComponentVolOpacityBase getCompB_GM()
      Return the opacity histrogram component of the Gradient Magnitude imageB.
      Returns:
      componentOpacityGM_B gradient magnitude component B.
    • getGradMagA

      public ModelImage getGradMagA()
      Get the gradient magnitude imageA.
      Returns:
      ModelImage GM imageA
    • getGradMagB

      public ModelImage getGradMagB()
      Get the gradient magnitude imageB.
      Returns:
      ModelImage GM imageB
    • getImageA

      public ModelImage getImageA()
      Accessor that returns the imageA.
      Returns:
      image
    • getImageB

      public ModelImage getImageB()
      Accessor that returns the image.
      Returns:
      image
    • getMainPanel

      public JPanel getMainPanel()
      Sets up the GUI (panels, buttons, etc) and displays it on the screen. Change the layout of the volume opacity change diagram.
      Returns:
      DOCUMENT ME!
    • getSelectedComponent

      public ViewJComponentVolOpacityBase getSelectedComponent()
      Return the selected tabbbed pane component. Should be overridden in JPanelVolOpacity and JPanelVolOpacityRGB
      Returns:
      ViewJComponentHLUTBase the opacity component.
    • getSelectedComponent

      public ViewJComponentVolOpacityBase getSelectedComponent(int _whichComp)
      Return the active image component.
      Parameters:
      _whichComp - true = imageA, false = imageB
      Returns:
      componentOpacity A or B.
    • getSelectedTabIndex

      public int getSelectedTabIndex()
      Returns the index of the selected panel in the tabbed pane.
      Returns:
    • getTabbedPane

      public JTabbedPane getTabbedPane()
      Accessor to the tabbed pane.
      Returns:
      JTabbedPane
    • isChanging

      public boolean isChanging()
    • isGradientMagnitudeOpacityEnabled

      public boolean isGradientMagnitudeOpacityEnabled()
      Return whether or not the opacity mapping based on gradient magnitude is enabled.
      Returns:
      boolean True if using gradient magnitude-based opacity mapping.
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Sets the flags for the checkboxes.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      event - event that triggered this function
    • mouseClicked

      public void mouseClicked(MouseEvent event)
      Not used method.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent event)
      Not used method.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      event - MouseEvent
    • mouseExited

      public void mouseExited(MouseEvent event)
      Not used method.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      event - MouseEvent
    • mousePressed

      public void mousePressed(MouseEvent event)
      Not used method.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      event - MouseEvent
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Mouse release event.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      event - MouseEvent
    • removeGM

      public void removeGM()
      Add the gradient magnitude hitogram to the opacity control panel.
    • resizePanel

      public void resizePanel(int panelWidth, int frameHeight)
      Resize the control panel when mouse drag expanding or minimizing the frame.
      Parameters:
      panelWidth - width
      frameHeight - height
    • setAdjustersEnabled

      public void setAdjustersEnabled(boolean enabled)
      This method will enable or disable the opacity panel's slider component and input text fields, based on the value of the boolean parameter passed into it.
      Specified by:
      setAdjustersEnabled in interface ViewJComponentVolOpacityListener
      Parameters:
      enabled - boolean whether the adjusters should be enabled or disabled
    • setAlphaBlendSliderValue

      public void setAlphaBlendSliderValue(int iValue)
      Sets the blendSlider value.
      Parameters:
      iValue - new slider value.
    • setGradientMagnitudeOpacityEnabled

      public void setGradientMagnitudeOpacityEnabled(boolean value)
      Return whether or not the opacity mapping based on gradient magnitude is enabled.
    • setSelectedTabIndex

      public void setSelectedTabIndex(int i)
      Sets the tabbed pane selected panel based on the input index.
      Parameters:
      i -
    • stateChanged

      public void stateChanged(ChangeEvent event)
      ChangeListener for opacity slider changes.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - The change event.
    • update

      public void update(boolean isChanging)
      Specified by:
      update in interface ViewJComponentVolOpacityListener
    • updateSlider

      public void updateSlider(ViewJComponentVolOpacityBase childComponent)
      Adjust the opacity slider for the minor opacity changes.
      Specified by:
      updateSlider in interface ViewJComponentVolOpacityListener
      Parameters:
      childComponent - ViewJComponentVolOpacityBase reference
    • buildBlendPanel

      protected JPanel buildBlendPanel()
      Build the blend slider control panel.
      Returns:
      blendPanel built blend panel.
    • finalize

      protected void finalize() throws Throwable
      Calls dispose.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - DOCUMENT ME!
    • getLabelTableA

      protected Hashtable<Integer,JLabel> getLabelTableA()
      Build the hash table for the imageA opacity slider.
      Returns:
      labels built label hash table.
    • getLabelTableB

      protected Hashtable<Integer,JLabel> getLabelTableB()
      Build the hash table for the imageB opacity slider.
      Returns:
      labels built label hash table.
    • getLabelTableGM_A

      protected Hashtable<Integer,JLabel> getLabelTableGM_A()
      Build the hash table for the imageA GM opacity slider.
      Returns:
      labels built label hash table.
    • getLabelTableGM_B

      protected Hashtable<Integer,JLabel> getLabelTableGM_B()
      Build the hash table for the imageA GM opacity slider.
      Returns:
      labels built label hash table.
    • initBlendSliderLabels

      protected void initBlendSliderLabels()
      Initialize the blend slider labels.
    • loadGMImage

      protected boolean loadGMImage(String dName, String fName, boolean isImageA)
      Loads the gradient magnitude image instead of recalculating the image.
      Parameters:
      dName - String User specified directory name.
      fName - String GM image file name.
      isImageA - boolean Indicates GM imageA or GM imageB
      Returns:
      boolean Indicates loading GM image successful or not.
    • buildPanelA

      private void buildPanelA()
      Method that displays the histogram and controls to manipulate the opacity. Panel for image A.
    • buildPanelB

      private void buildPanelB()
      Method that displays the histogram and controls to manipulate the opacity. Panel for image B. Reset the layout.
    • buildPanelGM_A

      private void buildPanelGM_A()
      Method that displays the histogram and controls to manipulate the opacity. Panel for image GM_A.
    • buildPanelGM_B

      private void buildPanelGM_B()
      Method that displays the histogram and controls to manipulate the opacity. Panel for image GM_B.
    • calcHistogram

      private ModelHistogram calcHistogram(ModelImage image, int dim, int channel)
      Calculates histogram for the imageA, B.
    • setImages

      public void setImages(ModelImage _imgA, ModelImage _imgB, ModelImage _imageAGM, ModelImage _imageBGM, boolean _simpleDisplay)
    • initialize

      private void initialize(boolean simpleDisplay)
      Sets up the GUI (panels, buttons, etc) and displays it on the screen. Change the layout of the volume opacity change diagram.
    • loadGM

      private boolean loadGM()
      Calculates histogram for the gradient magnitude imageA, B.