Class JDialogCenterOfMassRGB

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

public class JDialogCenterOfMassRGB extends JDialogScriptableBase implements AlgorithmInterface

Title: JDialogCenterOfMassRGB

Description: dialog for running RGB center of mass calculations on color images

Copyright: Copyright (c) 2008

Company:

Version:
1.0
Author:
William Gandler
See Also:
  • Field Details

    • applyToAllBox

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

      private ModelImage image
      DOCUMENT ME!
    • maxs

      private float[] maxs
      DOCUMENT ME!
    • mins

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

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

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

      private JTextField[] textThreshold2
      DOCUMENT ME!
    • comAlgoRGB

      private AlgorithmCenterOfMassRGB comAlgoRGB
      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!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • VOIRegions

      private JRadioButton VOIRegions
      DOCUMENT ME!
    • wholeImage

      private JRadioButton wholeImage
      DOCUMENT ME!
  • Constructor Details

    • JDialogCenterOfMassRGB

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

      public JDialogCenterOfMassRGB(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.
    • JDialogCenterOfMassRGB

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