Class JDialogRegistrationTPSpline

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

public class JDialogRegistrationTPSpline extends JDialogScriptableBase implements AlgorithmInterface
Dialog to get user input Selected image is match image, the image that gets transformed until it is registered to the base image. Thin plate spline algorithm is used for matching.

The mouse is used to put a set of point VOIs on the base image. Then, the mouse is used to put the same number of point VOIs at the corresponding positions on the match image. For 2D images 3 or more points are required and the algorithm may fail if the points all nearly fall on the same line. For 3D images 4 or more points are required and the algorithm may fail if the points nearly all fall on the same plane. The base image is selected from a combo box containing the names of images other than the selected match image.

The dimensions or image type of the match image need not be the same as the dimensions or image type of the base image. The registered resultImage will have the same image type as the match image and the same extents as the base image.

The spline matching points sets are used to obtain spline interpolation coefficients. These spline interpolation coefficents are used to transform all the xorg,yorg grid positions in base image space to xnew, ynew grid positions in match space. Then, at every xorg,yorg grid position in the base space, the program checks to see if the corresponding xnew,ynew grid position in the match space is within the image bounds of the match image. If xnew, ynew is within the match space bounds, then the data value at the xnew,ynew grid position in the match space is assigned to be the registered value at the xorg,yorg position in the base space. Since xnew, ynew is a floating point number and the data in the match image is only contained at integer grid points, interpolation must be used. For a 2D image the data value at xnew,ynew in the match space is obtained by bilinear interpolation from its 4 nearest neighbors. For a 3D image the data value at xnew,ynew in the match space is obtained by trilinear interpolation from its 8 nearest neighbors. If the xnew, ynew is outside the match space bounds, then a zero is assigned to the xorg, yorg position in the base space.

This software does not yet provide a general coplanar solution for 3D images. However, special handling does exist for the case where the z values of the corresponding point landmarks are identical.

See Also:
  • Field Details

    • serialVersionUID

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

      private ModelImage baseImage
      DOCUMENT ME!
    • comboBoxImage

      private JComboBox comboBoxImage
      DOCUMENT ME!
    • coplanar

      private boolean coplanar
      DOCUMENT ME!
    • DIM

      private int DIM
      DOCUMENT ME!
    • matchImage

      private ModelImage matchImage
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • spline

      private AlgorithmTPSpline spline
      DOCUMENT ME!
    • titles

      private String[] titles
      DOCUMENT ME!
    • UI

      private ViewUserInterface UI
      DOCUMENT ME!
    • xSource

      private double[] xSource
      DOCUMENT ME!
    • xTar

      private double[] xTar
      DOCUMENT ME!
    • ySource

      private double[] ySource
      DOCUMENT ME!
    • yTar

      private double[] yTar
      DOCUMENT ME!
    • zSource

      private double[] zSource
      DOCUMENT ME!
    • zTar

      private double[] zTar
      DOCUMENT ME!
    • matrixLabel

      private JLabel matrixLabel
    • matrixComboBox

      private JComboBox matrixComboBox
    • matrixDirectory

      private String matrixDirectory
    • userDirectoryLabel

      private JLabel userDirectoryLabel
    • userDirectoryText

      private JTextField userDirectoryText
    • twoDButton

      private JRadioButton twoDButton
    • threeDButton

      private JRadioButton threeDButton
    • use3D

      private boolean use3D
  • Constructor Details

    • JDialogRegistrationTPSpline

      public JDialogRegistrationTPSpline()
      Empty constructor for scripts.
    • JDialogRegistrationTPSpline

      public JDialogRegistrationTPSpline(Frame theParentFrame, ModelImage im)
      Creates new dialog.
      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()
      Gets the result image.
      Returns:
      ModelImage result image
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Changes the interpolation box to enabled or disabled depending on if the transform box is checked or not.
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class JDialogBase
      Parameters:
      event - Event that triggered this function.
    • callAlgorithm

      protected void callAlgorithm()
      Runs the algorithm.
      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
    • setMatrixDirectory

      public void setMatrixDirectory(String matrixDirectory)
      Accessor to set directory in which the matrix file is stored
      Parameters:
      matrixDirectory -
    • setUse3D

      public void setUse3D(boolean use3D)
      Parameters:
      use3D -
    • 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.
    • init

      private void init()
      Initializes GUI components and displays dialog.
    • buildImagePanel

      protected JPanel buildImagePanel()
    • buildOutputPanel

      protected JPanel buildOutputPanel()
    • buildImgComboBox

      private JComboBox buildImgComboBox(ModelImage image)
      Builds a list of images. Returns combobox.
      Parameters:
      image - DOCUMENT ME!
      Returns:
      Newly created combo box.
    • setVariables

      private boolean setVariables()
      DOCUMENT ME!
      Returns:
      DOCUMENT ME!