Class JFrameHistogram

All Implemented Interfaces:
ViewImageUpdateInterface, ActionListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class JFrameHistogram extends JPanel implements ActionListener, ChangeListener, ViewImageUpdateInterface, WindowListener
Lookup table interface for either grayscale or color (RGB) images. Either one or two images can be combined in a frame, and this LUT interface enables the user to apply a color look-up table to the images. Each image is treated separately, with an individual interface in a separate tabbed pane. The images can be grayscale, color, or a combination (one grayscale, one RGB).
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • colEMFrame

      private ViewJFrameColocalizationEM colEMFrame
      reference to the colocalization frame for updatng the image.
    • colRegFrame

      reference to the colocalization frame for updatng the image.
    • imageA

      protected ModelImage imageA
      source image A
    • imageB

      protected ModelImage imageB
      source image B
    • LUTa

      protected ModelStorageBase LUTa
      lut a
    • LUTb

      protected ModelStorageBase LUTb
      lut b
    • regComponent

      protected ViewJComponentRegistration regComponent
      false = apply algorithm only to VOI regions.
    • wholeImage

      protected boolean wholeImage
      true = apply algorithm to the whole image
    • parentFrame

      private Frame parentFrame
      Parent frame of this dialog, usually of type ViewJFrameImage.
    • voiDialog

      private JDialog voiDialog
      Dialog that enables the user to choose to apply the lut to the entire image, or voi regions.
    • containingFrame

      private JFrame containingFrame
      frame containing the lut interface (if display in a stand-alone window)
    • containingPanel

      private JPanel containingPanel
      panel containing the lut interface (used in the stand-alone frame or in an outside frame)
    • dualImage

      protected boolean dualImage
      set to true when the lut interface contains two images (imageA and imageB)
    • tabbedPane

      protected JTabbedPane tabbedPane
      tabbed pane, each separate tab contains the interface for imageA and imageB
    • panelA

      protected JPanelHistogram panelA
      histogram interface panels for imageA and imageB
    • panelB

      protected JPanelHistogram panelB
      histogram interface panels for imageA and imageB
    • useSeparateFrame

      private boolean useSeparateFrame
      Whether this panel is contained in another frame or forms its own frame
  • Constructor Details

    • JFrameHistogram

      public JFrameHistogram(Frame theParentFrame, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb)
      Creates the JFrameHistogram class. Initializes the images and LUTs, does not create the interface until the constructDialog() function is called, which asks the user if the luts should be applied to the VOI region or to the entire image, or until the histogramLUT() function is called to create the frame and interface panels.
      Parameters:
      theParentFrame -
      imA - imageA
      imB - imageB
      _LUTa - lutA (either ModelLUT or ModelRGB)
      _LUTb - lutb (either ModelLUT or ModelRGB)
    • JFrameHistogram

      public JFrameHistogram(Frame theParentFrame, ViewJComponentRegistration _regComponent, ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb)
      Creates the JFrameHistogram class. Initializes the images and LUTs, does not create the interface until the constructDialog() function is called, which asks the user if the luts should be applied to the VOI region or to the entire image, or until the histogramLUT() function is called to create the frame and interface panels.
      Parameters:
      theParentFrame -
      _regComponent - registration component image to update on lut changes.
      imA - imageA
      imB - imageB
      _LUTa - lutA (either ModelLUT or ModelRGB)
      _LUTb - lutb (either ModelLUT or ModelRGB)
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Specified by:
      actionPerformed in interface ActionListener
    • closeFrame

      public void closeFrame()
      Closes the stand-alone interface frame.
    • closeImageB

      public void closeImageB()
      Closes imageB and removes the tabbed-pane interface, replacing it with a single interface panel.
    • constructDialog

      public void constructDialog(boolean separateFrame)
      Creates a dialog to choose if histogram should be over all of image or just VOI regions.
    • disposeLocal

      public void disposeLocal()
      Removes this from the image display listeners. Removes and deletes the interface panels.
    • doCalcThresholdVolume

      public boolean doCalcThresholdVolume()
      Returns true if 'Calculate threshold volume' is selected.
      Returns:
      true if 'Calculate threshold volume' is selected, false otherwise.
    • getContainingPanel

      public JPanel getContainingPanel()
      Returns the main interface panel for display in another interface.
      Returns:
      the main interface panel for display in another interface.
    • getLowerThreshold

      public float getLowerThreshold()
      Returns the lower threshold image value for whichever image is current selected.
      Returns:
      the lower threshold image value for whichever image is current selected.
    • getSelectedPanel

      public JPanelHistogram getSelectedPanel()
      Returns the currently selected interface panel.
      Returns:
      the currently selected interface panel.
    • getUpperThreshold

      public float getUpperThreshold()
      Returns the upper threshold image value for whichever image is current selected.
      Returns:
      the upper threshold image value for whichever image is current selected.
    • setImages

      public void setImages(ModelImage imA, ModelImage imB, ModelStorageBase _LUTa, ModelStorageBase _LUTb)
    • histogramLUT

      public void histogramLUT(boolean entireFlag, boolean separateFrame)
      Creates the user interface for LUT changes. The entieFlag indicates if the entire image is to be used in the histogram calculation and LUT change, or if only the VOI regions are to be used. The separateFrame flag indicates if the interface is to be displayed in a stand-along window or inside another outside interface.
      Parameters:
      entireFlag - when true apply the LUT to the entire image, when false apply to VOI regions only.
      separateFrame - when true create and display the LUT interface in a separate, stand-alone window, when false create the interface for display in another outside frame or panel.
    • histogramLUT

      public void histogramLUT(boolean entireFlag, boolean separateFrame, boolean simple)
    • isImageASelected

      public boolean isImageASelected()
      Returns whether the imageA LUT panel is currently visible and active.
      Returns:
      whether the imageA LUT panel is currently visible and active.
    • isImageBSelected

      public boolean isImageBSelected()
      Returns whether the imageB LUT panel is currently visible and active. *
      Returns:
      whether the imageB LUT panel is currently visible and active.
    • isThresholding

      public boolean isThresholding()
      Returns true if image A or B is in dual threshold inverse mode (for JDialogConvertType input ranges).
      Returns:
      boolean is dual threshold inverse mode.
    • redrawFrames

      public void redrawFrames()
      Redraws the histogram interface for the currently selected image.
    • resizePanel

      public void resizePanel(int panelWidth, int frameHeight)
      Resizing the control panel with ViewJFrameVolumeView's frame width and height.
      Parameters:
      panelWidth - panel width.
      frameHeight - parent frame height.
    • setActiveImage

      public void setActiveImage(ModelImage image)
      Sets which image is currently active and makes the corresponding tabbed pane visible.
      Parameters:
      image - the image to set as currently active.
    • setBlueOn

      public void setBlueOn(boolean isOn, boolean isImageA)
      Sets the blue flag to be on or off.
      Parameters:
      isOn - flag, either on or off.
      isImageA - when true apply to imageA, when false apply to imageB.
    • setColocalizationEMFrame

      public void setColocalizationEMFrame(ViewJFrameColocalizationEM colocalizationEMFrame)
      Called from ViewJFrameColocalizationEM. Enables LUT changes to be applied to that frame.
      Parameters:
      colocalizationEMFrame -
    • setColocalizationRegFrame

      public void setColocalizationRegFrame(ViewJFrameColocalizationRegression colocalizationRegFrame)
      Called from ViewJFrameColocalizationRegression. Enables LUT changes to be applied to that frame.
      Parameters:
      colocalizationEMFrame -
    • setGreenOn

      public void setGreenOn(boolean isOn, boolean isImageA)
      Sets the green flag to be on or off.
      Parameters:
      isOn - flag, either on or off.
      isImageA - when true apply to imageA, when false apply to imageB.
    • setImageB

      public void setImageB(ModelImage image, ModelStorageBase LUT)
      Sets the imageB for the LUT interface. If the interface is not currently a dual-panel interface, it is re-created with the tabbed pane and two interface panels.
      Parameters:
      image -
      LUT -
    • setLUT

      public void setLUT(JPanelHistogram panel, ModelStorageBase LUT)
      Sets the LUT for the input panel.
      Parameters:
      panel - the panel to set the LUT for.
      LUT - the new LUT.
    • setLUTA

      public void setLUTA(ModelStorageBase LUT)
      Set LUTa
      Parameters:
      LUT -
    • setLUTB

      public void setLUTB(ModelStorageBase LUT)
      Set LUTb
      Parameters:
      LUT -
    • setRedOn

      public void setRedOn(boolean isOn, boolean isImageA)
      Sets the red flag to be on or off.
      Parameters:
      isOn - flag, either on or off.
      isImageA - when true apply to imageA, when false apply to imageB.
    • setSlice

      public void setSlice(int slice)
      Description copied from interface: ViewImageUpdateInterface
      setSlice.
      Specified by:
      setSlice in interface ViewImageUpdateInterface
      Parameters:
      slice - Current slice
    • setTimeSlice

      public void setTimeSlice(int tSlice)
      Description copied from interface: ViewImageUpdateInterface
      setTimeSlice.
      Specified by:
      setTimeSlice in interface ViewImageUpdateInterface
      Parameters:
      tSlice - Current time volume
    • setTransferFunctionA

      public void setTransferFunctionA(TransferFunction txFunction)
      Set the transfer function for imageA.
      Parameters:
      txFunction -
    • setTransferFunctionB

      public void setTransferFunctionB(TransferFunction txFunction)
      Set the transfer function for imageA.
      Parameters:
      txFunction -
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Specified by:
      stateChanged in interface ChangeListener
    • updateFrames

      public void updateFrames(boolean flag)
      Parameters:
      flag -
    • updateImageExtents

      public boolean updateImageExtents()
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's REPAINT method to redraw the screen. The extents on this image have changed, so the extents need to be read in again and menus, panes and slide bars adjusted accordingly.
      Specified by:
      updateImageExtents in interface ViewImageUpdateInterface
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages()
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's REPAINT method to redraw the screen. Without LUT changes or image changes
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages(boolean flag)
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's update method to redraw the screen. Without LUT changes.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      flag - forces show to re import image and calc. java image
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode)
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's update method to redraw the screen.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      LUTa - LUT used to update imageA
      LUTb - LUT used to update imageB
      flag - forces show to re import image and calc. java image
      interpMode - image interpolation method (Nearest or Smooth)
      Returns:
      boolean confirming a successful update
    • updateInterpolation

      public void updateInterpolation()
      updates the interpolation mode for the images.
    • updateRealTime

      public void updateRealTime(boolean updateRealTime)
      Updates the interface behavior when the user choses to update in real-time or on mouse release.
      Parameters:
      updateRealTime -
    • windowActivated

      public void windowActivated(WindowEvent arg0)
      Specified by:
      windowActivated in interface WindowListener
    • windowClosed

      public void windowClosed(WindowEvent arg0)
      Specified by:
      windowClosed in interface WindowListener
    • windowClosing

      public void windowClosing(WindowEvent arg0)
      Specified by:
      windowClosing in interface WindowListener
    • windowDeactivated

      public void windowDeactivated(WindowEvent arg0)
      Specified by:
      windowDeactivated in interface WindowListener
    • windowDeiconified

      public void windowDeiconified(WindowEvent arg0)
      Specified by:
      windowDeiconified in interface WindowListener
    • windowIconified

      public void windowIconified(WindowEvent arg0)
      Specified by:
      windowIconified in interface WindowListener
    • windowOpened

      public void windowOpened(WindowEvent arg0)
      Specified by:
      windowOpened in interface WindowListener
    • buildMenu

      private void buildMenu(JFrame frame)
      This method builds a menu which contains the options for opening/saving a LUT or set of transfer functions, closing the LUT, and utilities such as CT presets.
    • createPanel

      protected JPanel createPanel()
      Creates the display panel. If there are two images the panel contains a tabbed pane with the two interfaces panels. If there is only one image the panel contains just the interface.
      Returns:
      the new display panel.
    • createPanel

      protected void createPanel(boolean simple)
    • processFileMenu

      private void processFileMenu(String command)
      Called when the FileMenu is activated. Processes the commands from the file menu.
      Parameters:
      command - the file menu command.
    • processUtilitiesMenu

      private void processUtilitiesMenu(ActionEvent event, String command)
      Called when the Utilities Menu is activated. Processes the commands from the utilities menu.
      Parameters:
      command - the utilities menu command.