Class JPanelHistogram

All Implemented Interfaces:
HistoLUTParent, ActionListener, ItemListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class JPanelHistogram extends JPanel implements ActionListener, ChangeListener, ItemListener, KeyListener, HistoLUTParent
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • blueCheckBox

      private JCheckBox blueCheckBox
      checkbox for turning on / off the blue component of the color look-up table.
    • ctDialog

      private JDialogCT ctDialog
    • greenCheckBox

      private JCheckBox greenCheckBox
      checkbox for turning on / off the green component of the color look-up table.
    • histogram

      protected ModelHistogram histogram
      red, green and blue histograms:
    • histogramG

      protected ModelHistogram histogramG
      red, green and blue histograms:
    • histogramB

      protected ModelHistogram histogramB
      red, green and blue histograms:
    • histoPanel

      protected ViewJPanelHistoLUT histoPanel
      histogram panel interface.
    • indexColorTextF

      private JTextField indexColorTextF
      displays the selected LUT color
    • interpCheckBox

      private JCheckBox interpCheckBox
      turns interpolation on/off
    • logCheckBox

      private JCheckBox logCheckBox
      turns log display on/off
    • nColorsTextF

      private JTextField nColorsTextF
      displays the number of colors in the LUT
    • oneBasedLUTCheckBoxImage

      private JCheckBox oneBasedLUTCheckBoxImage
      sets the minimum LUT value to (1,1,1)
    • outputBox

      private JComboBox outputBox
      enables the user to set the image output type or LUT-based image extration
    • redCheckBox

      private JCheckBox redCheckBox
      checkbox for turning on / off the red component of the color look-up table.
    • threshFillF

      private JTextField threshFillF
      displays the threshold fill-value
    • threshLowerF

      private JTextField threshLowerF
      displays the threshold lower-value
    • threshUpperF

      private JTextField threshUpperF
      displays the threshold upper-value
    • toolBarBottom

      protected JToolBar toolBarBottom
      bottom tool bar
    • toolBarThreshold

      protected JToolBar toolBarThreshold
      threshold tool bar
    • updateCheckBox

      private JCheckBox updateCheckBox
      enables the user to set updating the display in real-time or only on mouse-release
    • voxelVolumeLabel

      private JLabel voxelVolumeLabel
      volume threshold vaue
    • image

      protected ModelImage image
      input image
    • LUT

      protected ModelStorageBase LUT
      input LUT, either ModelLUT or ModelRGB
    • panelParent

      protected JFrameHistogram panelParent
      containing parent class.
    • wholeImage

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

      private int cursorIndex
      Active mouse cursor index of the imageA, B and GM image A, B.
    • rangeX

      private float rangeX
      X range value of the imageA, B and GM imageA, B.
    • mouseSlider

      private JSlider mouseSlider
      slider for small LUT changes
    • xRangeText

      private JTextField xRangeText
    • yRangeText

      private JTextField yRangeText
    • scaleRange

      protected int scaleRange
    • mouseSliderLabels

      private JLabel[] mouseSliderLabels
    • labelsTable

      private Hashtable<Integer,JLabel> labelsTable
  • Constructor Details

    • JPanelHistogram

      public JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage)
      Creates the JPanelHistogram, with the JFrameHistogram as the containing class.
      Parameters:
      _panelParent - parent class.
      _image - input image.
      _LUT - input LUT (ModelLUT or ModelRGB).
      _wholeImage - , when true apply the LUT to the entire image, when false apply to VOI regions only.
    • JPanelHistogram

      public JPanelHistogram(ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage)
      Creates the JPanelHistogram.
      Parameters:
      _image - input image.
      _LUT - input LUT (ModelLUT or ModelRGB).
      _wholeImage - , when true apply the LUT to the entire image, when false apply to VOI regions only.
    • JPanelHistogram

      public JPanelHistogram(JFrameHistogram _panelParent, ModelImage _image, ModelStorageBase _LUT, boolean _wholeImage, boolean _simpleLUT)
      Creates the JPanelHistogram, with the JFrameHistogram as the containing class.
      Parameters:
      _panelParent - parent class.
      _image - input image.
      _LUT - input LUT (ModelLUT or ModelRGB).
      _wholeImage - , when true apply the LUT to the entire image, when false apply to VOI regions only.
  • Method Details

    • buildLUTSelectionList

      private static final JToolBar buildLUTSelectionList(ActionListener listener)
      Build the center part of the LUT toolbar.
      Parameters:
      listener - The listener to attach to the created LUT selection combo box.
      Returns:
      the top part of the LUT toolbar
    • getCustomLUTList

      private static final Vector<String> getCustomLUTList()
      Creates a Vector or LUT names representing different color look-up tables.
      Returns:
      a Vector or LUT names representing different color look-up tables.
    • isLUT1Based

      protected static final boolean isLUT1Based(ModelStorageBase LUT)
      returns true if the first entry in the color look-up table is (1,1,1), false otherwise.
      Parameters:
      LUT - the LUT to query, either a ModelLUT or ModelRGB
      Returns:
      true if the first entry in the color look-up table is (1,1,1), false otherwise.
    • actionPerformed

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

      public void calcThreshold()
      Calculates the thresholded image based on the parameters of the threshold transfer function. Image A is thresholded if the selected panel is for imageA and likewise for image B.
    • calculateThreshold

      public void calculateThreshold()
      Calculates the volume (for 3D images) or area (for 2D images) of the image between the two values from the upper and lower bounds text areas.
    • calculateThreshold

      public void calculateThreshold(float lower, float upper)
      Calculates the volume or area of the image between the two values from the upper and lower bounds (inclusive).
      Parameters:
      lower - Lower bound of the threshold (inclusive).
      upper - Upper bound of the threshold (inclusive).
    • clearVoxelLabel

      public void clearVoxelLabel()
      Resets the threshold volume and area labels.
    • disposeLocal

      public void disposeLocal()
      Removes and deletes local memory.
    • dragPoint

      public void dragPoint(MouseEvent mouseEvent)
      Description copied from interface: HistoLUTParent
      Handle the dragging of a transfer function point.
      Specified by:
      dragPoint in interface HistoLUTParent
      Parameters:
      mouseEvent - the point dragging event
    • getLowerThreshold

      public float getLowerThreshold()
      Returns:
      the lower threshold value.
    • getMode

      public int getMode()
      Returns:
      he HIstoLUTComponent mode.
    • getUpperThreshold

      public float getUpperThreshold()
      Returns:
      the upper threshold value.
    • interpolateImage

      public boolean interpolateImage()
      Returns:
      if the image interpolation checkbox is selected.
    • isImageUpdate

      public boolean isImageUpdate()
      Description copied from interface: HistoLUTParent
      Indicates if real-time update of the image should take place.
      Specified by:
      isImageUpdate in interface HistoLUTParent
      Returns:
      if the update in real-time checkbox is selected.
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Specified by:
      itemStateChanged in interface ItemListener
    • keyPressed

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

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

      public void keyTyped(KeyEvent event)
      Specified by:
      keyTyped in interface KeyListener
    • resetHistoLUT

      public void resetHistoLUT()
      Resets the histogram and histogram panel.
    • setAllOff

      public void setAllOff()
      Description copied from interface: HistoLUTParent
      Accessor to disable the all RGB color channels button if one of the lines has moved.
      Specified by:
      setAllOff in interface HistoLUTParent
    • setBlueOn

      public void setBlueOn(boolean isOn)
      Sets the blue checkbox on/off.
      Parameters:
      isOn -
    • setGreenOn

      public void setGreenOn(boolean isOn)
      Sets the green checkbox on/off.
      Parameters:
      isOn -
    • setLUT

      public void setLUT(ModelLUT newLUT)
      Description copied from interface: HistoLUTParent
      Replaces the LUT and builds a new LUT component.
      Specified by:
      setLUT in interface HistoLUTParent
      Parameters:
      newLUT - New LUT
    • setImage

      public void setImage(ModelImage newImage)
    • setLUT

      public void setLUT(ModelStorageBase newLUT)
      Sets the LUT and updates the histogram panel.
      Parameters:
      newLUT -
    • setNColors

      public void setNColors(int value)
      Change the text field showing the number of colors.
      Parameters:
      value - the number of colors
    • setRangeText

      public void setRangeText(float x, float y, int _index)
      Description copied from interface: HistoLUTParent
      Set the range value of the text field.
      Specified by:
      setRangeText in interface HistoLUTParent
      Parameters:
      x - the x threshold range value
      y - the y threshold range value
      _index - the cursor index
    • setRedOn

      public void setRedOn(boolean isOn)
      Sets the red checkbox on/off.
      Parameters:
      isOn -
    • stateChanged

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

      public void updateComponentLUT()
      Description copied from interface: HistoLUTParent
      Redraw the componentLUT.
      Specified by:
      updateComponentLUT in interface HistoLUTParent
    • updateFrames

      public void updateFrames(boolean flag)
      Description copied from interface: HistoLUTParent
      Update all of the image frames that display the image this histo lut is for.
      Specified by:
      updateFrames in interface HistoLUTParent
      Parameters:
      flag - this boolean indicates if the frame that displays the image should re-export the image and apply new LUT
      See Also:
    • updateLUTPositionString

      public void updateLUTPositionString(String str)
      Description copied from interface: HistoLUTParent
      Sets the position string in the LUT text field.
      Specified by:
      updateLUTPositionString in interface HistoLUTParent
      Parameters:
      str - the position string
    • updateRealTime

      public void updateRealTime(boolean updateRealTime)
      Parameters:
      updateRealTime -
    • updateThresholdFields

      public void updateThresholdFields(float lower, float upper)
      Description copied from interface: HistoLUTParent
      Method to update the threshold text fields when the lower or upper threshold changes.
      Specified by:
      updateThresholdFields in interface HistoLUTParent
      Parameters:
      lower - the lower threshold value
      upper - the upper threshold value
    • buildControlPanel

      protected JPanel buildControlPanel(ModelImage image, boolean addAdjustment)
      Builds the interface panel.
      Parameters:
      image -
      addAdjustment -
      Returns:
    • buildMousePanel

      protected JPanel buildMousePanel(double range)
      Builds the mouse panel.
      Parameters:
      range -
      Returns:
    • buildPanel

      protected void buildPanel()
      Method that displays the histogram and LUT and other controls to manipulate the LUT. Panel for image A.
      Parameters:
      image - Model of image
      LUT - Model of LUT
      entireFlag - Flag indicating if histogram should be made of entire image.
    • buildSimplePanel

      protected void buildSimplePanel()
    • buildToolBar

      protected JPanel buildToolBar(ModelImage image)
      Builds the toolbars.
      Parameters:
      image -
      Returns:
    • buildSimpleToolBar

      protected JPanel buildSimpleToolBar(ModelImage image)
    • calcHistogram

      protected ModelHistogram calcHistogram(ModelImage image, boolean entireFlag, int offset)
      Calculates histogram for the image(s).
      Parameters:
      entireFlag - if true calculate histogram for the entire image. if false uses areas defined by VOI regions.
      imageAorB - flag to indicate if histogram is to be calculated for imageA or imageB.
      progressFlag - passed to calculateHistogram algorithm. If false progress bar is not displayed
    • calculateThresholdArea

      private void calculateThresholdArea(float lower, float upper)
      Calculates the area of the image between the two values from the upper and lower bounds (inclusive).
      Parameters:
      lower - Lower bound of the threshold (inclusive).
      upper - Upper bound of the threshold (inclusive).
    • calculateThresholdVolume

      private void calculateThresholdVolume(float lower, float upper)
      Calculates the volume of the image between the two values from the upper and lower bounds (inclusive).
      Parameters:
      lower - Lower bound of the threshold (inclusive).
      upper - Upper bound of the threshold (inclusive).
    • makeLUT

      private void makeLUT(ModelLUT selectedLUT, int nColors)
      Updates the number of colors in the LUT and updates the displays.
      Parameters:
      selectedLUT -
      nColors -
    • makeLUT

      private void makeLUT(ModelLUT selectedLUT, int nColors, boolean makeLUT)
      Updates the number of colors in the LUT and updates the displays.
      Parameters:
      selectedLUT -
      nColors -
      makeLUT -