Class JDialogThresholdRGB

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

public class JDialogThresholdRGB extends JDialogScriptableBase implements AlgorithmInterface

Title: JDialogThresholdRGB

Description: dialog for running RGB threshold algorithm on color images

Copyright: Copyright (c) 2003

Company:

Version:
1.0
Author:
linkb
See Also:
  • Field Details

    • serialVersionUID

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

      private JCheckBox applyToAllBox
      false = apply algorithm only to VOI regions apply same threshold to all.
    • applyToBlueBox

      private JCheckBox applyToBlueBox
      enable blue threshold.
    • applyToGreenBox

      private JCheckBox applyToGreenBox
      enable green threshold.
    • applyToRedBox

      private JCheckBox applyToRedBox
      enable red threshold.
    • displayLoc

      private int displayLoc
      DOCUMENT ME!
    • fillValues

      private float[] fillValues
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • inverseOptionBox

      private JCheckBox inverseOptionBox
      choose inverse or no inverse threshold.
    • isInverse

      private boolean isInverse
      inverse?
    • maxs

      private float[] maxs
      DOCUMENT ME!
    • mins

      private float[] mins
      Minimum and maximum values for red/gree/blue.
    • newImage

      private JRadioButton newImage
      DOCUMENT ME!
    • regionFlag

      private boolean regionFlag
      or if the source image is to be replaced.
    • replaceImage

      private JRadioButton replaceImage
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • textFills

      private JTextField[] textFills
      DOCUMENT ME!
    • textThreshold1

      private JTextField[] textThreshold1
      Text fields for lower invalid input: '&' upper thresholds and fill values.
    • textThreshold2

      private JTextField[] textThreshold2
      DOCUMENT ME!
    • thresholdAlgoRGB

      private AlgorithmThresholdDualRGB thresholdAlgoRGB
      DOCUMENT ME!
    • thresholdB

      private float[] thresholdB
      DOCUMENT ME!
    • thresholdG

      private float[] thresholdG
      DOCUMENT ME!
    • thresholdLabels1

      private JLabel[] thresholdLabels1
      DOCUMENT ME!
    • thresholdLabels2

      private JLabel[] thresholdLabels2
      DOCUMENT ME!
    • thresholdR

      private float[] thresholdR
      lower [0] and upper [1] thresholds for RGB.
    • titles

      private String[] titles
      DOCUMENT ME!
    • useChannel

      private boolean[] useChannel
      tells whether or not to use the channels (red=0, green=1, blue=2).
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • VOIRegions

      private JRadioButton VOIRegions
      DOCUMENT ME!
    • wholeImage

      private JRadioButton wholeImage
      DOCUMENT ME!
  • Constructor Details

    • JDialogThresholdRGB

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

      public JDialogThresholdRGB(ModelImage im)
      Used primarily for the script to store variables and run the algorithm. No actual dialog will appear but the set up info and result image will be stored here.
      Parameters:
      im - Source image.
    • JDialogThresholdRGB

      public JDialogThresholdRGB(Frame theParentFrame, ModelImage im)
      Creates a new JDialogThresholdRGB 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.
    • focusLost

      public void focusLost(FocusEvent event)
      When the user clicks the mouse out of a text field, resets the necessary variables. In this case, it also handles a bug involving when the focusGained and focusLost functions are called by turning off the ability of the text fields to call those functions.
      Specified by:
      focusLost in interface FocusListener
      Overrides:
      focusLost in class JDialogBase
      Parameters:
      event - Event that triggers this function.
    • getResultImage

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

      public void itemStateChanged(ItemEvent event)
      Monitors the checkboxes and handles events according (enable/disable).
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class JDialogBase
      Parameters:
      event - ItemEvent
    • runFromLUTFrame

      public void runFromLUTFrame(ModelImage im, float[] red, float[] green, float[] blue, float[] fillV, boolean isInverse)
      Function to run the threshold algorithm from the ViewJFrameHistoRGB.
      Parameters:
      im - ModelImage the image
      red - float[] red threshold
      green - float[] green threshold
      blue - float[] blue threshold
      fillV - float[] fill values
      isInverse - boolean (inverse threshold or not)
    • 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.
    • setFillValues

      public void setFillValues(float[] scale)
      Accessor that sets the fill value. Will not be used if writing out a binary image.
      Parameters:
      scale - Value to set fill value to.
    • setRegionFlag

      public void setRegionFlag(boolean flag)
      Accessor that sets the region flag.
      Parameters:
      flag - true indicates the whole image is blurred, false indicates a region.
    • setThresholdB

      public void setThresholdB(float[] thresB)
      Sets the blue threshold.
      Parameters:
      thresB - float[]
    • setThresholdG

      public void setThresholdG(float[] thresG)
      Sets the green threshold.
      Parameters:
      thresG - float[]
    • setThresholdR

      public void setThresholdR(float[] thresR)
      Sets the red threshold (float[2]... 1st is lower, 2nd is upper)
      Parameters:
      thresR - float[]
    • callAlgorithm

      protected void callAlgorithm()
      Once all the necessary variables are set, call the threshold rgb 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
    • 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
    • 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.
    • buildThresholdPanel

      private JPanel buildThresholdPanel(int panelNum)
      Builds each threshold panel (red, green, and blue).
      Parameters:
      panelNum - int 0-2
      Returns:
      JPanel
    • 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.