Class JDialogImageCalculator

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

public class JDialogImageCalculator extends JDialogScriptableBase implements AlgorithmInterface
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 addition the user can indicate if you wishes to have the algorithm applied to whole image or to the VOI regions. In should be noted, that the algorithms are executed in their own thread.
Version:
0.1 Dec 21, 1999
Author:
Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

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

      private String adOpString
      Advanced function string.
    • advancedButton

      private JButton advancedButton
      DOCUMENT ME!
    • clipMode

      private int clipMode
      DOCUMENT ME!
    • comboBoxImage

      private JComboBox comboBoxImage
      DOCUMENT ME!
    • comboBoxOperator

      private JComboBox comboBoxOperator
      DOCUMENT ME!
    • displayLoc

      private int displayLoc
      DOCUMENT ME!
    • imageA

      private ModelImage imageA
      source image.
    • imageB

      private ModelImage imageB
      DOCUMENT ME!
    • isColor

      private boolean isColor
      DOCUMENT ME!
    • mathAlgo

      private AlgorithmImageCalculator mathAlgo
      DOCUMENT ME!
    • opType

      private int opType
      DOCUMENT ME!
    • radioClip

      private JRadioButton radioClip
      DOCUMENT ME!
    • radioNew

      private JRadioButton radioNew
      DOCUMENT ME!
    • radioPromote

      private JRadioButton radioPromote
      DOCUMENT ME!
    • radioReplace

      private JRadioButton radioReplace
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      result image.
    • titles

      private String[] titles
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
  • Constructor Details

    • JDialogImageCalculator

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

      public JDialogImageCalculator(Frame theParentFrame, ModelImage im)
      Creates new image calculator dialog and displays.
      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.
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Changes chosen operator based on combo box's selected index.
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class JDialogBase
      Parameters:
      event - DOCUMENT ME!
    • setAdOpString

      public void setAdOpString(String fStr)
      Accessor that sets the advanced function string.
      Parameters:
      fStr - of an advanced function
    • setClipMode

      public void setClipMode(int n)
      Accessor that sets the clip mode.
      Parameters:
      n - the clip mode to be used when performing the math algorithm
    • 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.
    • setImageB

      public void setImageB(ModelImage im)
      Accessor that sets image B.
      Parameters:
      im - Image B.
    • setOperator

      public void setOperator(int n)
      Accessor that sets the operator type.
      Parameters:
      n - operator type
    • callAlgorithm

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

      private void buildComboBoxImage()
      Builds a list of images to operate on from the template image.
    • 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.