Class JDialogAHElocal

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

public class JDialogAHElocal extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery, ScriptableActionInterface
Dialog to get user input, then call the algorithm. The user has the option to generate a new image or replace the source image.

In should be noted, that the algorithms are executed in their own thread.

Version:
1.0; 17 September 2001
Author:
parsonsd, Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

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

      private AlgorithmAHElocal aheAlgo
      DOCUMENT ME!
    • clamp

      private boolean clamp
      DOCUMENT ME!
    • clampCheckBox

      private JCheckBox clampCheckBox
      DOCUMENT ME!
    • clampLabel

      private JLabel clampLabel
      DOCUMENT ME!
    • clampValue

      private int clampValue
      DOCUMENT ME!
    • clampValueText

      private JTextField clampValueText
      DOCUMENT ME!
    • colorPanel

      private JPanelColorChannels colorPanel
      DOCUMENT ME!
    • comboBoxKernelShape

      private JComboBox comboBoxKernelShape
      DOCUMENT ME!
    • comboBoxKernelSize

      private JComboBox comboBoxKernelSize
      DOCUMENT ME!
    • comboBoxScaleMax

      private JComboBox comboBoxScaleMax
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • kernelShape

      private int kernelShape
      DOCUMENT ME!
    • kernelSize

      private int kernelSize
      DOCUMENT ME!
    • minThresholdLabel

      private JLabel minThresholdLabel
      DOCUMENT ME!
    • minThresholdText

      private JTextField minThresholdText
      DOCUMENT ME!
    • minThresholdValueL

      private float minThresholdValueL
    • minThresholdValueRGB

      private float minThresholdValueRGB
    • minThresholdValue

      private float minThresholdValue
      DOCUMENT ME!
    • outputPanel

      private JPanelAlgorithmOutputOptions outputPanel
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • scaleMaxValue

      private int scaleMaxValue
      DOCUMENT ME!
    • threshold

      private boolean threshold
      DOCUMENT ME!
    • thresholdCheckBox

      private JCheckBox thresholdCheckBox
      DOCUMENT ME!
    • titles

      private String[] titles
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • useCIELab

      private boolean useCIELab
    • colorGroup

      private ButtonGroup colorGroup
    • CIELabButton

      private JRadioButton CIELabButton
    • RGBButton

      private JRadioButton RGBButton
    • redBox

      private JCheckBox redBox
    • greenBox

      private JCheckBox greenBox
    • blueBox

      private JCheckBox blueBox
    • useRed

      private boolean useRed
    • useGreen

      private boolean useGreen
    • useBlue

      private boolean useBlue
    • Lmin

      private float[] Lmin
    • Lmax

      private float[] Lmax
  • Constructor Details

    • JDialogAHElocal

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

      public JDialogAHElocal(Frame theParentFrame, ModelImage im)
      Creates a new JDialogAHElocal object.
      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 algorithms 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.
    • setClampFlag

      public void setClampFlag(boolean flag)
      Accessor that sets the clamp flag.
      Parameters:
      flag - true indicates clamp, false otherwise.
    • setClampingValue

      public void setClampingValue(int value)
      Accessor that sets the clamping value.
      Parameters:
      value - Value to set clamping to.
    • setKernelShape

      public void setKernelShape(int value)
      Accessor that sets the kernel shape.
      Parameters:
      value - Value to set kernel shape to.
    • setKernelSize

      public void setKernelSize(int value)
      Accessor that sets the kernel size.
      Parameters:
      value - Value to set kernel size to.
    • setScaleMaxValue

      public void setScaleMaxValue(int value)
      Accessor that sets the max scale value (from the combo box).
      Parameters:
      value - Value to set max scale value to - local, slice, or image.
    • setThresholdFlag

      public void setThresholdFlag(boolean flag)
      Accessor that sets the threshold flag.
      Parameters:
      flag - true indicates threshold, false otherwise.
    • setThresholdValue

      public void setThresholdValue(float value)
      Accessor that sets the minThreshold value.
      Parameters:
      value - Value to set minThresholdValue to.
    • buildClamping

      protected void buildClamping(JPanel holder, GridBagConstraints gbc, GridBagLayout gbl)
      controls the entire creation of the clamping panel and all controls related to the display of the clamping parameter. places the clamping panel into the holder panel.
      Parameters:
      holder - DOCUMENT ME!
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
    • buildKernelShape

      protected void buildKernelShape(JPanel holder, GridBagConstraints gbc, GridBagLayout gbl)
      Creates the comboBox that allows user to define the way the neighboring pixels are chosen for the histogram. The kernel-shape may be
      • square
      • cross (shaped like a '+')

      builds the label to be used, applies it to the left side of the JPanel holder, then builds the drop-box so the user may make a selection, and applies it to the far-right of the JPanel holder.

      Parameters:
      holder - DOCUMENT ME!
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
    • buildKernelSize

      protected void buildKernelSize(JPanel holder, GridBagConstraints gbc, GridBagLayout gbl)
      Creates the editable text comboBox that allows user to define the number of neighboring pixels used for the histogram. the number given may only be odd, as this is the total number of pixels chosen on both sides. For any pixel, there are floor(kernelSize/2) pixels in either the horizontal or vertical direction. Alternatively, it describes a box of the number here on a side, for which the pixel in question is at the center. The drop-box has pre-selected:
      • 21
      • 45
      • 65
      • 129

      but any odd figure could be entered.

      builds the label to be used, applies it to the left side of the JPanel holder, then builds the drop-box so the user may make a selection, and applies it to the far-right of the JPanel holder.

      Parameters:
      holder - DOCUMENT ME!
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
    • buildScaleMax

      protected void buildScaleMax(JPanel holder, GridBagConstraints gbc, GridBagLayout gbl)
      define the possibilities of where the scale max comes from.
      Parameters:
      holder - DOCUMENT ME!
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
    • buildThreshold

      protected void buildThreshold(JPanel holder, GridBagConstraints gbc, GridBagLayout gbl)
      Creates the txt-box that allows user to insert the bottom-end pixels to skip. Number entered into the textfield is minimum value of the pixels considered. Defaults to the image minimum.
      Parameters:
      holder - DOCUMENT ME!
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
    • convertRGBtoCIELab

      private void convertRGBtoCIELab(float[] buffer, float[] L, float[] a, float[] b, float[] Lmin, float[] Lmax)
    • callAlgorithm

      protected void callAlgorithm()
      Once all the necessary variables are set, call the local AHE algorithm based on what type of image this is and whether or not there is a separate destination image.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
      See Also:
    • doPostAlgorithmActions

      protected void doPostAlgorithmActions()
      Used to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table). Defaults to no action, override to actually have it do something.
      Overrides:
      doPostAlgorithmActions in class JDialogScriptableBase
    • makeFloatingPointOnly

      protected void makeFloatingPointOnly(JTextField txt)
      Takes a text field, and forces the textfield to accept numbers, backspace and delete-key entries.
      Parameters:
      txt - Text field to modify.
    • makeNumericsOnly

      protected void makeNumericsOnly(JTextField txt)
      Takes a text field, and forces the textfield to accept numbers, backspace and delete-key entries.
      Parameters:
      txt - Text field to modify.
    • 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.
    • buildKernelPanel

      private JPanel buildKernelPanel(GridBagConstraints gbc, GridBagLayout gbl)
      Creates the panel that allow user to select the kernel size and shape of the image when building the histogram. Contains clamping attributes.
      Parameters:
      gbc - DOCUMENT ME!
      gbl - DOCUMENT ME!
      Returns:
      the panel that allows setting kernel attributes
    • init

      private void init()
      Sets up the GUI (panels, buttons, etc) and displays it on the screen.
    • 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.
    • getActionMetadata

      public ActionMetadata getActionMetadata()
      Return meta-information about this discoverable action for categorization and labeling purposes.
      Specified by:
      getActionMetadata in interface ActionDiscovery
      Returns:
      Metadata for this action.
    • createInputParameters

      public ParameterTable createInputParameters()
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in setGUIFromParams()).
      Specified by:
      createInputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the inputs of this algorithm.
    • createOutputParameters

      public ParameterTable createOutputParameters()
      Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).
      Specified by:
      createOutputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the outputs of this algorithm.
    • getOutputImageName

      public String getOutputImageName(String imageParamName)
      Returns the name of an image output by this algorithm, the image returned depends on the parameter label given (which can be used to retrieve the image object from the image registry).
      Specified by:
      getOutputImageName in interface ActionDiscovery
      Parameters:
      imageParamName - The output image parameter label for which to get the image name.
      Returns:
      The image name of the requested output image parameter label.
    • isActionComplete

      public boolean isActionComplete()
      Returns whether the action has successfully completed its execution.
      Specified by:
      isActionComplete in interface ActionDiscovery
      Returns:
      True, if the action is complete. False, if the action failed or is still running.