Class JDialogInsertMissingSlices

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

public class JDialogInsertMissingSlices extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery
Creates the dialog to insert missing slices into an image. The dialog use the origin[2] for each slice to see if there are any missing slices. If so, either an average or a blank can be inserted.
See Also:
  • Field Details

    • serialVersionUID

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

      private boolean allPresent
      true if no slices are missing.
    • average

      private JRadioButton average
      Radio button selected if inserted slices are a weighted average of surrounding slices.
    • blank

      private JRadioButton blank
      Radio button selected if inserted slices are blank.
    • checkListInsert

      private boolean[] checkListInsert
      Array of length totalSlices, false where slice is already present, true where slice must be inserted.
    • destFlag

      private boolean destFlag
      DOCUMENT ME!
    • destinationGroup

      private ButtonGroup destinationGroup
      DOCUMENT ME!
    • displayLoc

      private int displayLoc
      Flag indicating if a new image is to be generated.
    • image

      private ModelImage image
      source image.
    • insertBlank

      private boolean insertBlank
      If true insert blank slices, if false insert weighted average slices.
    • missingNumberArray

      private int[] missingNumberArray
      DOCUMENT ME!
    • missingPositions

      private int missingPositions
      DOCUMENT ME!
    • missingSliceArray

      private int[] missingSliceArray
      DOCUMENT ME!
    • missingSlices

      private int missingSlices
      DOCUMENT ME!
    • newImage

      private JRadioButton newImage
      DOCUMENT ME!
    • nSlices

      private int nSlices
      Number of slices in original 3D image.
    • replaceImage

      private JRadioButton replaceImage
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      image create if new image button is selected.
    • rSliceAlgo

      private AlgorithmReplaceRemovedSlices rSliceAlgo
      DOCUMENT ME!
    • totalSlices

      private int totalSlices
      Number of slices that will be present in the 3D image after the missing slices have been inserted.
  • Constructor Details

    • JDialogInsertMissingSlices

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

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

      public void setInsertBlank(boolean insertBlank)
      Accessor which lets you change the type of slice to be inserted.
      Parameters:
      insertBlank - 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.
    • findMissingSlices

      private void findMissingSlices()
      DOCUMENT ME!
    • 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.
    • getActionMetadata

      public ActionMetadata getActionMetadata()
      Return meta-information about this discoverable action for categorization and labeling purposes.
      Specified by:
      getActionMetadata in interface ActionDiscovery
      Returns:
      Metadata for this action.
    • createInputParameters

      public ParameterTable createInputParameters()
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in setGUIFromParams()).
      Specified by:
      createInputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the inputs of this algorithm.
    • createOutputParameters

      public ParameterTable createOutputParameters()
      Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).
      Specified by:
      createOutputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the outputs of this algorithm.
    • getOutputImageName

      public String getOutputImageName(String imageParamName)
      Returns the name of an image output by this algorithm, the image returned depends on the parameter label given (which can be used to retrieve the image object from the image registry).
      Specified by:
      getOutputImageName in interface ActionDiscovery
      Parameters:
      imageParamName - The output image parameter label for which to get the image name.
      Returns:
      The image name of the requested output image parameter label.
    • isActionComplete

      public boolean isActionComplete()
      Returns whether the action has successfully completed its execution.
      Specified by:
      isActionComplete in interface ActionDiscovery
      Returns:
      True, if the action is complete. False, if the action failed or is still running.