Class JDialogInsertSlice

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

public class JDialogInsertSlice extends JDialogScriptableBase implements AlgorithmInterface
Creates the dialog to insert slice into an image. Dialog asks the user to enter the slice number before which the new slice is to be inserted or for the last slice number plus one if the slice is to be added to the end. The user may select either average or blank or original for the new slice. The slices are assumed to be parallel and uniformly spaced, so average so calculates the mean of the 2 surrounding slices or duplicates an end slice if the new slice is to be placed at the beginnig or end. Blank creates a new slice with all the pixels set to zero. Original inserts a 2D image of the same dimensions selected from a pop up menu. Must insert black and white with black and white and color with color.
See Also:
  • Field Details

    • serialVersionUID

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

      public static final int AVERAGE_SLICE
      DOCUMENT ME!
      See Also:
    • BLANK_SLICE

      public static final int BLANK_SLICE
      DOCUMENT ME!
      See Also:
    • ORIGINAL_SLICE

      public static final int ORIGINAL_SLICE
      DOCUMENT ME!
      See Also:
    • ADJACENT_DOWN_SLICE

      public static final int ADJACENT_DOWN_SLICE
      DOCUMENT ME!
      See Also:
    • ADJACENT_UP_SLICE

      public static final int ADJACENT_UP_SLICE
      DOCUMENT ME!
      See Also:
    • adjacentDown

      private JRadioButton adjacentDown
      DOCUMENT ME!
    • adjacentUp

      private JRadioButton adjacentUp
      DOCUMENT ME!
    • average

      private JRadioButton average
      DOCUMENT ME!
    • blank

      private JRadioButton blank
      DOCUMENT ME!
    • comboBoxImage

      private JComboBox comboBoxImage
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • insertedImage

      private ModelImage insertedImage
      DOCUMENT ME!
    • insertSlice

      private int insertSlice
      DOCUMENT ME!
    • insertSliceAlgo

      private AlgorithmInsertSlice insertSliceAlgo
      DOCUMENT ME!
    • nSlices

      private int nSlices
      DOCUMENT ME!
    • original

      private JRadioButton original
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • sliceType

      private int sliceType
      DOCUMENT ME!
    • textSlice

      private JTextField textSlice
      DOCUMENT ME!
    • titles

      private String[] titles
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
  • Constructor Details

    • JDialogInsertSlice

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

      public JDialogInsertSlice(Frame theParentFrame, ModelImage im)
      Creates new dialog for inserting a slice.
      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
    • setInsertedImage

      public void setInsertedImage(ModelImage insertedImage)
      Accessor to specify the 2D image used as an inserted slice for ORGINAL_SLICE.
      Parameters:
      insertedImage - DOCUMENT ME!
    • setInsertSliceNumber

      public void setInsertSliceNumber(int num)
      Accessor which lets you change where to insert the slice.
      Parameters:
      num - slice number before which the new slice is to be inserted
    • setSliceType

      public void setSliceType(int type)
      Accessor which lets you change the type of slice to be inserted.
      Parameters:
      type - the type of slice to be inserted (either AVERAGE_SLICE or BLANK_Slice)
    • callAlgorithm

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

      private void buildComboBox()
      Builds a list of images to register to 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.