Class JDialogHistogram2Dim

All Implemented Interfaces:
AlgorithmInterface, ScriptableActionInterface, DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class JDialogHistogram2Dim extends JDialogScriptableBase implements AlgorithmInterface
Dialog to get user input Create 2D histogram of images with equal dimensions or 2D histograms with 2 colors inside a RGB image. Algorithms are executed in their own thread.
See Also:
  • Field Details

    • serialVersionUID

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

      private int bin1
      Number of bins for first image.
    • bin1Default

      private boolean bin1Default
      Default number of bins for first image. Default is 256.
    • bin1Label

      private JLabel bin1Label
      Label description for bin1.
    • bin1Text

      private JTextField bin1Text
      Textfield for bin1.
    • bin2

      private int bin2
      Number of bins for second image.
    • bin2Default

      private boolean bin2Default
      Default number of bins for first image. Default is 256.
    • bin2Label

      private JLabel bin2Label
      Label description for bin1.
    • bin2Text

      private JTextField bin2Text
      Textfield for bin2.
    • blueCheckBox

      private JCheckBox blueCheckBox
      Checkbox to select blue image.
    • colorsPresent

      private int colorsPresent
      Number of colors present.
    • doLinearRescale

      private boolean doLinearRescale
      If true, the range of second image is same as the range of the first image.
    • doLogResult

      private boolean doLogResult
      If true, calculates the log of the result image for better visualization.
    • firstImage

      private ModelImage firstImage
      First image (Source image).
    • greenCheckBox

      private JCheckBox greenCheckBox
      Checkbox to select green image.
    • histogram2DimAlgo

      private AlgorithmHistogram2Dim histogram2DimAlgo
      Instance of AlgorithmHistogram2Dim.
    • imageComboBox

      private JComboBox imageComboBox
      Combobox to select the second image.
    • labelImage

      private JLabel labelImage
      Image label.
    • linearCheckbox

      private JCheckBox linearCheckbox
      Checkbox to select linear rescaling of second image.
    • maxR

      private double maxR
      Max intensity values in Red, Green and Blue images respectively.
    • maxG

      private double maxG
      Max intensity values in Red, Green and Blue images respectively.
    • maxB

      private double maxB
      Max intensity values in Red, Green and Blue images respectively.
    • minR

      private double minR
      Min. intensity values in Red, Green and Blue images respectively
    • minG

      private double minG
      Min. intensity values in Red, Green and Blue images respectively
    • minB

      private double minB
      Min. intensity values in Red, Green and Blue images respectively
    • possibleInt2Values

      private double possibleInt2Values
      Possible intensity values for second image.
    • possibleIntValues

      private double possibleIntValues
      Possible intensity values for first image.
    • redCheckBox

      private JCheckBox redCheckBox
      Checkbox to select Red image.
    • resultCheckbox

      private JCheckBox resultCheckbox
      Checkbox to display the log of result image.
    • resultImage

      private ModelImage resultImage
      Image where the result is stored.
    • secondImage

      private ModelImage secondImage
      Second image (Base image).
    • titles

      private String[] titles
      String titles for the new windows.
    • useBlue

      private boolean useBlue
      If true, blue image is selected as of the two images for calculating histogram.
    • useGreen

      private boolean useGreen
      If true, green image is selected as of the two images for calculating histogram.
    • useRed

      private boolean useRed
      If true, red image is selected as of the two images for calculating histogram.
    • userInterface

      private ViewUserInterface userInterface
      Keeps record of the present structure of the application.
  • Constructor Details

    • JDialogHistogram2Dim

      public JDialogHistogram2Dim()
      Empty constructor needed for dynamic instantiation (used during scripting).
    • JDialogHistogram2Dim

      public JDialogHistogram2Dim(Frame theParentFrame, ModelImage im)
      Creates new dialog.
      Parameters:
      theParentFrame - Parent frame
      im - Source image
  • 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.
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algorithm)
      This method is required if the AlgorithmPerformed interface is implemented. It is called by the algorithm when it has completed or failed to to complete, so that the dialog can be display the result image and/or clean up.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • getResultImage

      public ModelImage getResultImage()
      Accessor that returns the image.
      Returns:
      The result image.
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      itemStateChanged.
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class JDialogBase
      Parameters:
      event - DOCUMENT ME!
    • setBin1

      public void setBin1(int bin1)
      Accessor that sets bin1.
      Parameters:
      bin1 - DOCUMENT ME!
    • setBin1Default

      public void setBin1Default(boolean bin1Default)
      DOCUMENT ME!
      Parameters:
      bin1Default - DOCUMENT ME!
    • setBin2

      public void setBin2(int bin2)
      Accessor that sets bin2.
      Parameters:
      bin2 - DOCUMENT ME!
    • setBin2Default

      public void setBin2Default(boolean bin2Default)
      DOCUMENT ME!
      Parameters:
      bin2Default - DOCUMENT ME!
    • setDoLinearRescale

      public void setDoLinearRescale(boolean doLinearRescale)
      Accessor that sets whether or not linear rescaling occurs.
      Parameters:
      doLinearRescale - DOCUMENT ME!
    • setDoLogResult

      public void setDoLogResult(boolean doLogResult)
      Accessor that sets whether or not log of result image is displayed.
      Parameters:
      doLogResult - If true, displays the log of result image for better visualization
    • setSecondImage

      public void setSecondImage(ModelImage secondImage)
      Accessor to set the secondImage.
      Parameters:
      secondImage - DOCUMENT ME!
    • setUseBlue

      public void setUseBlue(boolean useBlue)
      Accessor that setes if the blue channel is used.
      Parameters:
      useBlue - DOCUMENT ME!
    • setUseGreen

      public void setUseGreen(boolean useGreen)
      Accessor that sets if the green channel is used.
      Parameters:
      useGreen - DOCUMENT ME!
    • setUseRed

      public void setUseRed(boolean useRed)
      Accessor that sets if the red channel is used.
      Parameters:
      useRed - DOCUMENT ME!
    • callAlgorithm

      protected void callAlgorithm()
      DOCUMENT ME!
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • doPostAlgorithmActions

      protected void doPostAlgorithmActions()
      Store the result image in the script runner's image table now that the action execution is finished.
      Overrides:
      doPostAlgorithmActions in class JDialogScriptableBase
    • setGUIFromParams

      protected void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
      Specified by:
      setGUIFromParams in class JDialogScriptableBase
    • storeParamsFromGUI

      protected void storeParamsFromGUI() throws ParserException
      Record the parameters just used to run this algorithm in a script.
      Specified by:
      storeParamsFromGUI in class JDialogScriptableBase
      Throws:
      ParserException - If there is a problem creating/recording the new parameters.
    • buildComboBox

      private JComboBox buildComboBox(ModelImage image)
      Builds a list of images. Returns combobox. List must be all color or all black and white.
      Parameters:
      image - DOCUMENT ME!
      Returns:
      Newly created combo box.
    • init

      private void init()
      Initializes GUI components and displays dialog.
    • setVariables

      private boolean setVariables()
      Use the GUI results to set up the variables needed to run the algorithm.
      Returns:
      true if parameters set successfully, false otherwise.