Class JDialogRGBtoGray

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

public class JDialogRGBtoGray extends JDialogScriptableBase implements AlgorithmInterface
DOCUMENT ME!
Version:
0.1 Nov 17, 1998
Author:
Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

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

      private float blueValue
      DOCUMENT ME!
    • destinationGroup

      private ButtonGroup destinationGroup
      DOCUMENT ME!
    • destinationPanel

      private JPanel destinationPanel
      DOCUMENT ME!
    • displayLoc

      private int displayLoc
      DOCUMENT ME!
    • equalButton

      private JRadioButton equalButton
      DOCUMENT ME!
    • fInfoBase

      private FileInfoBase fInfoBase
      DOCUMENT ME!
    • graphicsButton

      private JRadioButton graphicsButton
      DOCUMENT ME!
    • greenValue

      private float greenValue
      DOCUMENT ME!
    • imageA

      private ModelImage imageA
      DOCUMENT ME!
    • intensityAverage

      private boolean intensityAverage
      DOCUMENT ME!
    • labelR

      private JLabel labelR
      DOCUMENT ME!
    • labelG

      private JLabel labelG
      DOCUMENT ME!
    • labelB

      private JLabel labelB
      DOCUMENT ME!
    • newImage

      private JRadioButton newImage
      DOCUMENT ME!
    • redValue

      private float redValue
      set the values to the defaults -- based on a default of equal values.
    • replaceImage

      private JRadioButton replaceImage
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • RGBAlgo

      private AlgorithmRGBtoGray RGBAlgo
      DOCUMENT ME!
    • textR

      private JTextField textR
      DOCUMENT ME!
    • textG

      private JTextField textG
      DOCUMENT ME!
    • textB

      private JTextField textB
      DOCUMENT ME!
    • textThreshold

      private JTextField textThreshold
      DOCUMENT ME!
    • threshold

      private float threshold
      DOCUMENT ME!
    • thresholdAverage

      private boolean thresholdAverage
      DOCUMENT ME!
    • thresholdCheckBox

      private JCheckBox thresholdCheckBox
      DOCUMENT ME!
    • userButton

      private JRadioButton userButton
      DOCUMENT ME!
    • equalRangeButton

      private JRadioButton equalRangeButton
    • unequalRangeButton

      private JRadioButton unequalRangeButton
    • labelMinR

      private JLabel labelMinR
    • labelMinG

      private JLabel labelMinG
    • labelMinB

      private JLabel labelMinB
    • labelMaxR

      private JLabel labelMaxR
    • labelMaxG

      private JLabel labelMaxG
    • labelMaxB

      private JLabel labelMaxB
    • textMinR

      private JTextField textMinR
    • textMinG

      private JTextField textMinG
    • textMinB

      private JTextField textMinB
    • textMaxR

      private JTextField textMaxR
    • textMaxG

      private JTextField textMaxG
    • textMaxB

      private JTextField textMaxB
    • equalRange

      private boolean equalRange
    • minR

      private float minR
    • maxR

      private float maxR
    • minG

      private float minG
    • maxG

      private float maxG
    • minB

      private float minB
    • maxB

      private float maxB
  • Constructor Details

    • JDialogRGBtoGray

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

      public JDialogRGBtoGray(Frame theParentFrame, ModelImage imA)
      Sets variables needed to call algorithm.
      Parameters:
      theParentFrame - Parent frame
      imA - 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 result image.
      Returns:
      The result image.
    • setDisplayLocNew

      public void setDisplayLocNew()
      Accessor that sets the display loc variable to new, so that a new image is created once the algorithm completes.
    • setDisplayLocReplace

      public void setDisplayLocReplace()
      Accessor that sets the display loc variable to replace, so the current image is replaced once the algorithm completes.
    • setIntensityAverage

      public void setIntensityAverage(boolean intensityAverage)
      Sets whether intensity averaging is performed to determine which which channels should be used in calculating the gray.
      Parameters:
      intensityAverage - DOCUMENT ME!
    • setRGBEqual

      public void setRGBEqual()
      Sets the red, green, and blue values to equal values. The values represent the proportion of one color to another (i.e. they must add up to 1.0).
    • setRGBGraphics

      public void setRGBGraphics()
      Sets the red, green, and blue values to computer graphic values. The values represent the proportion of one color to another (i.e. they must add up to 1.0).
    • setRGBValues

      public void setRGBValues(float rVal, float gVal, float bVal)
      Sets the red, green, and blue values to the given parameters. The values represent the proportion of one color to another (i.e. they must add up to 1.0).
      Parameters:
      rVal - the red proportion
      gVal - the green proportion
      bVal - the blue proportion
    • setThreshold

      public void setThreshold(float threshold)
      Sets the threshold for threshold average.
      Parameters:
      threshold - DOCUMENT ME!
    • setThresholdAverage

      public void setThresholdAverage(boolean thresholdAverage)
      Sets whether threshold averaging is performed - Only include those components greater than threshold.
      Parameters:
      thresholdAverage - DOCUMENT ME!
    • setEqualRange

      public void setEqualRange(boolean equalRange)
    • setMinR

      public void setMinR(float minR)
    • setMaxR

      public void setMaxR(float maxR)
    • setMinG

      public void setMinG(float minG)
    • setMaxG

      public void setMaxG(float maxG)
    • setMinB

      public void setMinB(float minB)
    • setMaxB

      public void setMaxB(float maxB)
    • callAlgorithm

      protected void callAlgorithm()
      Calls the algorithm.
      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.
    • 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.