Class JDialogCrop

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

public class JDialogCrop extends JDialogScriptableBase implements AlgorithmInterface
Dialog to get user input, then call the crop algorithm.
Version:
1.0 June 10, 1999
Author:
Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

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

      private int borderSize
      DOCUMENT ME!
    • cropAlgo

      private AlgorithmAddMargins cropAlgo
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • imgRes

      private float[] imgRes
      DOCUMENT ME!
    • startPos

      private float[] startPos
      DOCUMENT ME!
    • lowXmm

      private float lowXmm
      DOCUMENT ME!
    • lowYmm

      private float lowYmm
      DOCUMENT ME!
    • lowZmm

      private float lowZmm
      DOCUMENT ME!
    • nDims

      private int nDims
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • resXUnit

      private int resXUnit
      DOCUMENT ME!
    • resYUnit

      private int resYUnit
      DOCUMENT ME!
    • textBorderSize

      private JTextField textBorderSize
      DOCUMENT ME!
    • textWidth

      private JTextField textWidth
      DOCUMENT ME!
    • textHeight

      private JTextField textHeight
      DOCUMENT ME!
    • textDepth

      private JTextField textDepth
      DOCUMENT ME!
    • textXmin

      private JTextField textXmin
      DOCUMENT ME!
    • textYmin

      private JTextField textYmin
      DOCUMENT ME!
    • textZmin

      private JTextField textZmin
      DOCUMENT ME!
    • textLowerXmm

      private JTextField textLowerXmm
      DOCUMENT ME!
    • textLowerYmm

      private JTextField textLowerYmm
      DOCUMENT ME!
    • textLowerZmm

      private JTextField textLowerZmm
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • xBounds

      private int[] xBounds
      DOCUMENT ME!
    • yBounds

      private int[] yBounds
      DOCUMENT ME!
    • zBounds

      private int[] zBounds
      DOCUMENT ME!
  • Constructor Details

    • JDialogCrop

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

      public JDialogCrop(ModelImage im)
      Used primarily for the script to store variables and run the algorithm.
      Parameters:
      im - Source image.
    • JDialogCrop

      public JDialogCrop(Frame theParentFrame, ModelImage im)
      Creates new dialog for cropping image.
      Parameters:
      theParentFrame - Parent frame
      im - Source image
    • JDialogCrop

      public JDialogCrop(Frame theParentFrame, ModelImage im, boolean noninteractive)
      Constructor for doing non-interactive cropping (border will be zero) primarily used by VOI's pop-up menu
      Parameters:
      theParentFrame - the parent frame
      im - the image
      noninteractive - if this is true, no dialog will pop up and the algorithm will run
  • 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.
    • callAlgorithm

      public void callAlgorithm()
      DOCUMENT ME!
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • getResultImage

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

      public void setBorderSize(int borderSize)
      Accessor that sets the borderSize.
      Parameters:
      borderSize - DOCUMENT ME!
    • setXBounds

      public void setXBounds(int[] xBounds)
      Accessor that set xBounds.
      Parameters:
      xBounds - DOCUMENT ME!
    • setYBounds

      public void setYBounds(int[] yBounds)
      Accessor that set yBounds.
      Parameters:
      yBounds - DOCUMENT ME!
    • setZBounds

      public void setZBounds(int[] zBounds)
      Accessor that set zBounds.
      Parameters:
      zBounds - DOCUMENT ME!
    • 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.
    • calcLowerResol

      private boolean calcLowerResol()
      This method calculates the lower X, lower Y, and lower Z coordinates(millimeters) for the CROP VOI region.
    • findBounds

      private boolean findBounds()
      This method finds the bounding box when CROP apply to 2D, 3D VOI images.
      Returns:
      True if the bounds were calculated successfully, false otherwise.
    • init

      private void init()
      Sets up GUI variables and displays dialog.