Class JDialogRegistrationOAR3D

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

public class JDialogRegistrationOAR3D extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery
Dialog to get user input, then call algorithm RegistrationOAR3D. The user must designate a reference image, a type of cost function, the degrees of freedom used in the registration, and the range and rate of the coarse and fine samples. These are set to defaults most likely to give a fast and accurate registration. The user may also select weighted images to discount parts of the reference and input images in the registration. These must be the same size as their respective originals - i.e., the reference weight image must be the same size as the reference image. The user can select to display the registered image. Regardless of whether this is selected, the matrix will be stored in a file in the user's working directory and also in the original image's transformation matrix.
Author:
Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

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

      private final int POWELL
      See Also:
    • ELSUNC

      private final int ELSUNC
      See Also:
    • LEVENBERG_MARQUARDT

      private final int LEVENBERG_MARQUARDT
      See Also:
    • NL2SOL

      private final int NL2SOL
      See Also:
    • searchAlgorithm

      private int searchAlgorithm
    • advancedDialog

      private JDialog advancedDialog
      Variables for Advanced Settings dialog.
    • maxIterationsText

      private JTextField maxIterationsText
      DOCUMENT ME!
    • numMinText

      private JTextField numMinText
      DOCUMENT ME!
    • buttonWeightInput

      private JButton buttonWeightInput
      DOCUMENT ME!
    • buttonWeightRef

      private JButton buttonWeightRef
      DOCUMENT ME!
    • calcCOG

      private boolean calcCOG
      DOCUMENT ME!
    • calcCOGCheckbox

      private JCheckBox calcCOGCheckbox
      DOCUMENT ME!
    • calcLSBox

      private JCheckBox calcLSBox
      DOCUMENT ME!
    • multiThreadCheckBox

      private JCheckBox multiThreadCheckBox
    • coarsePanelX

      private JPanel coarsePanelX
      DOCUMENT ME!
    • coarsePanelY

      private JPanel coarsePanelY
      DOCUMENT ME!
    • coarsePanelZ

      private JPanel coarsePanelZ
      DOCUMENT ME!
    • coarseRateTextX

      private JTextField coarseRateTextX
      DOCUMENT ME!
    • coarseRateTextY

      private JTextField coarseRateTextY
      DOCUMENT ME!
    • coarseRateTextZ

      private JTextField coarseRateTextZ
      DOCUMENT ME!
    • comboBoxCostFunct

      private JComboBox comboBoxCostFunct
      DOCUMENT ME!
    • comboBoxSearchAlgo

      private JComboBox comboBoxSearchAlgo
    • comboBoxDOF

      private JComboBox comboBoxDOF
      DOCUMENT ME!
    • comboBoxImage

      private JComboBox comboBoxImage
      DOCUMENT ME!
    • comboBoxInterp

      private JComboBox comboBoxInterp
      DOCUMENT ME!
    • comboBoxInterp2

      private JComboBox comboBoxInterp2
      DOCUMENT ME!
    • cost

      private int cost
      DOCUMENT ME!
    • interp

      private int interp
      DOCUMENT ME!
    • interp2

      private int interp2
      DOCUMENT ME!
    • DOF

      private int DOF
      DOCUMENT ME!
    • costName

      private String costName
      DOCUMENT ME!
    • displayTransform

      private boolean displayTransform
      DOCUMENT ME!
    • doColor

      private boolean doColor
      DOCUMENT ME!
    • doLS

      private boolean doLS
      DOCUMENT ME!
    • doMultiThread

      private boolean doMultiThread
    • doSubsample

      private boolean doSubsample
      DOCUMENT ME!
    • doJTEM

      private boolean doJTEM
      When true, the full version of JTEM Powell search is used in the registration algorithm.
    • fastMode

      private boolean fastMode
      DOCUMENT ME!
    • fastModeCheckbox

      private JCheckBox fastModeCheckbox
      DOCUMENT ME!
    • fileNameWRef

      private String fileNameWRef
      DOCUMENT ME!
    • directoryWRef

      private String directoryWRef
      DOCUMENT ME!
    • fileNameWInput

      private String fileNameWInput
      DOCUMENT ME!
    • directoryWInput

      private String directoryWInput
      DOCUMENT ME!
    • finePanelX

      private JPanel finePanelX
      DOCUMENT ME!
    • finePanelY

      private JPanel finePanelY
      DOCUMENT ME!
    • finePanelZ

      private JPanel finePanelZ
      DOCUMENT ME!
    • fineRateTextX

      private JTextField fineRateTextX
      DOCUMENT ME!
    • fineRateTextY

      private JTextField fineRateTextY
      DOCUMENT ME!
    • fineRateTextZ

      private JTextField fineRateTextZ
      DOCUMENT ME!
    • gbc

      private GridBagConstraints gbc
      DOCUMENT ME!
    • inputWeightImage

      private ModelImage inputWeightImage
      DOCUMENT ME!
    • refWeightImage

      private ModelImage refWeightImage
      DOCUMENT ME!
    • labelInterp2

      private JLabel labelInterp2
      DOCUMENT ME!
    • lsCompleted

      private boolean lsCompleted
      DOCUMENT ME!
    • lsImage

      private ModelImage lsImage
      DOCUMENT ME!
    • lsMatrix

      private TransMatrix lsMatrix
      DOCUMENT ME!
    • matchImage

      private ModelImage matchImage
      DOCUMENT ME!
    • maxIterations_def

      private int maxIterations_def
      DOCUMENT ME!
    • numMinima_def

      private int numMinima_def
      DOCUMENT ME!
    • maxIterations

      private int maxIterations
      DOCUMENT ME!
    • maxOfMinResol

      private boolean maxOfMinResol
      DOCUMENT ME!
    • minMaxCheckbox

      private JCheckBox minMaxCheckbox
      DOCUMENT ME!
    • noneRadio

      private JRadioButton noneRadio
      DOCUMENT ME!
    • numMinima

      private int numMinima
      DOCUMENT ME!
    • refImage

      private ModelImage refImage
      DOCUMENT ME!
    • reg3

      private AlgorithmRegOAR3D reg3
      DOCUMENT ME!
    • reg3E

      private AlgorithmRegELSUNCOAR3D reg3E
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • rotateBeginTextX

      private JTextField rotateBeginTextX
      DOCUMENT ME!
    • rotateBeginTextY

      private JTextField rotateBeginTextY
      DOCUMENT ME!
    • rotateBeginTextZ

      private JTextField rotateBeginTextZ
      DOCUMENT ME!
    • rotateBeginX

      private float rotateBeginX
      DOCUMENT ME!
    • rotateEndX

      private float rotateEndX
      DOCUMENT ME!
    • coarseRateX

      private float coarseRateX
      DOCUMENT ME!
    • fineRateX

      private float fineRateX
      DOCUMENT ME!
    • rotateBeginY

      private float rotateBeginY
      DOCUMENT ME!
    • rotateEndY

      private float rotateEndY
      DOCUMENT ME!
    • coarseRateY

      private float coarseRateY
      DOCUMENT ME!
    • fineRateY

      private float fineRateY
      DOCUMENT ME!
    • rotateBeginZ

      private float rotateBeginZ
      DOCUMENT ME!
    • rotateEndZ

      private float rotateEndZ
      DOCUMENT ME!
    • coarseRateZ

      private float coarseRateZ
      DOCUMENT ME!
    • fineRateZ

      private float fineRateZ
      DOCUMENT ME!
    • rotateEndTextX

      private JTextField rotateEndTextX
      DOCUMENT ME!
    • rotateEndTextY

      private JTextField rotateEndTextY
      DOCUMENT ME!
    • rotateEndTextZ

      private JTextField rotateEndTextZ
      DOCUMENT ME!
    • rotatePanel

      private JPanel rotatePanel
      DOCUMENT ME!
    • rotateRangePanelX

      private JPanel rotateRangePanelX
      DOCUMENT ME!
    • rotateRangePanelY

      private JPanel rotateRangePanelY
      DOCUMENT ME!
    • rotateRangePanelZ

      private JPanel rotateRangePanelZ
      DOCUMENT ME!
    • sampleCheckbox

      private JCheckBox sampleCheckbox
      DOCUMENT ME!
    • jtemCheckbox

      private JCheckBox jtemCheckbox
      Turns on the JTEM full version of Powell's algorithm on or off
    • textInput

      private JTextField textInput
      DOCUMENT ME!
    • textRef

      private JTextField textRef
      DOCUMENT ME!
    • transformCheckbox

      private JCheckBox transformCheckbox
      DOCUMENT ME!
    • UI

      private ViewUserInterface UI
      DOCUMENT ME!
    • universalCheckbox

      private JCheckBox universalCheckbox
      DOCUMENT ME!
    • voiRadio

      private JRadioButton voiRadio
      DOCUMENT ME!
    • voisOnly

      private boolean voisOnly
      DOCUMENT ME!
    • weighted

      private boolean weighted
      DOCUMENT ME!
    • weightRadio

      private JRadioButton weightRadio
      DOCUMENT ME!
    • xRadio

      private JRadioButton xRadio
      DOCUMENT ME!
    • xSelected

      private boolean xSelected
      DOCUMENT ME!
    • yRadio

      private JRadioButton yRadio
      DOCUMENT ME!
    • ySelected

      private boolean ySelected
      DOCUMENT ME!
    • zRadio

      private JRadioButton zRadio
      DOCUMENT ME!
    • outOfBoundsLabel

      private JLabel outOfBoundsLabel
    • outOfBoundsComboBox

      private JComboBox outOfBoundsComboBox
    • valueLabel

      private JLabel valueLabel
    • valueText

      private JTextField valueText
    • imageMin

      private double imageMin
    • imageMax

      private double imageMax
    • dataType

      private int dataType
    • outOfBoundsIndex

      private int outOfBoundsIndex
      Tells how to select fill value for out of bounds data 0 for image minimum 1 for NaN for float, zero otherwise. 2 for user defined 3 for image maximum
    • fillValue

      private float fillValue
    • matrixLabel

      private JLabel matrixLabel
    • matrixComboBox

      private JComboBox matrixComboBox
    • matrixDirectory

      private String matrixDirectory
    • userDirectoryLabel

      private JLabel userDirectoryLabel
    • userDirectoryText

      private JTextField userDirectoryText
  • Constructor Details

    • JDialogRegistrationOAR3D

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

      public JDialogRegistrationOAR3D(Frame theParentFrame, ModelImage im)
      Creates new dialog for user to choose type of linear image registration algorithm to run.
      Parameters:
      theParentFrame - Parent frame.
      im - Source image.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Closes dialog box when the OK button is pressed, sets the variables, 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 complete.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • getResultImage

      public ModelImage getResultImage()
      Accessor to get the result image.
      Returns:
      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.
    • setAdvancedSettings

      public void setAdvancedSettings(int maxIterations, int numMinima)
      Accessor to set the advanced settings.
      Parameters:
      maxIterations - DOCUMENT ME!
      numMinima - DOCUMENT ME!
    • setCalcCOG

      public void setCalcCOG(boolean flag)
      Accessor to set the whether or not to calculate the center of gravity (mass).
      Parameters:
      flag - true then calculate center of gravity (mass).
    • setCoarseBeginX

      public void setCoarseBeginX(float x)
      Accessor to set the coarse sample beginX.
      Parameters:
      x - Coarse beginX
    • setCoarseBeginY

      public void setCoarseBeginY(float y)
      Accessor to set the coarse sample beginY.
      Parameters:
      y - Coarse beginY
    • setCoarseBeginZ

      public void setCoarseBeginZ(float z)
      Accessor to set the coarse sample beginZ.
      Parameters:
      z - Coarse beginZ
    • setCoarseEndX

      public void setCoarseEndX(float x)
      Accessor to set the coarse sample endX.
      Parameters:
      x - Coarse endX
    • setCoarseEndY

      public void setCoarseEndY(float y)
      Accessor to set the coarse sample endY.
      Parameters:
      y - Coarse endY
    • setCoarseEndZ

      public void setCoarseEndZ(float z)
      Accessor to set the coarse sample endZ.
      Parameters:
      z - Coarse endZ
    • setCoarseRateX

      public void setCoarseRateX(float x)
      Accessor to set the coarse sample rateX.
      Parameters:
      x - Coarse rateX
    • setCoarseRateY

      public void setCoarseRateY(float y)
      Accessor to set the coarse sample rateY.
      Parameters:
      y - Coarse rateY
    • setCoarseRateZ

      public void setCoarseRateZ(float z)
      Accessor to set the coarse sample rateZ.
      Parameters:
      z - Coarse rateZ
    • setCostChoice

      public void setCostChoice(int x)
      Accessor to set the choice of cost function.
      Parameters:
      x - Cost function.
    • setDisplayTransform

      public void setDisplayTransform(boolean flag)
      Accessor to set the display transform flag.
      Parameters:
      flag - true means display the transformed image.
    • setDOF

      public void setDOF(int x)
      Accessor to set the degrees of freedom.
      Parameters:
      x - Degrees of freedom
    • setFastMode

      public void setFastMode(boolean flag)
      Accessor to set whether or not to execute the fast mode (skip sub sample and goto last final optimization).
      Parameters:
      flag - true then skip to level one (last ) optimization.
    • setFineRateX

      public void setFineRateX(float x)
      Accessor to set the fine sample rateX.
      Parameters:
      x - Fine rateX
    • setFineRateY

      public void setFineRateY(float y)
      Accessor to set the fine sample rateY.
      Parameters:
      y - Fine rateY
    • setFineRateZ

      public void setFineRateZ(float z)
      Accessor to set the fine sample rateZ.
      Parameters:
      z - Fine rateZ
    • setInputWeightImage

      public void setInputWeightImage(ModelImage im)
      Accessor to set the input weight image.
      Parameters:
      im - Input weight image.
    • setInterp

      public void setInterp(int x)
      Accessor to set the initial interpolation.
      Parameters:
      x - Interpolation
    • setInterp2

      public void setInterp2(int x)
      Accessor to set the final interpolation.
      Parameters:
      x - Interpolation
    • setMaxOfMinResol

      public void setMaxOfMinResol(boolean flag)
      Accessor to set the maximum resolutions flag.
      Parameters:
      flag - true then use the maximum of minimums of the resolutions of the images.
    • setReferenceImage

      public void setReferenceImage(ModelImage im)
      Accessor to set the reference image.
      Parameters:
      im - Reference image.
    • setReferenceWeightImage

      public void setReferenceWeightImage(ModelImage im)
      Accessor to set the reference weight image.
      Parameters:
      im - Reference weight image.
    • setSubsample

      public void setSubsample(boolean doSubsample)
      Accessor to set whether or not subsampling occurs.
      Parameters:
      doSubsample - DOCUMENT ME!
    • setSearchAlgorithm

      public void setSearchAlgorithm(int searchAlgorithm)
      Parameters:
      searchAlgorithm -
    • setMultiThread

      public void setMultiThread(boolean doMultiThread)
      Accessor to set whether or not powell's algorithm uses multithreading
      Parameters:
      doMultiThread -
    • setVoisOnly

      public void setVoisOnly(boolean flag)
      Accessor to set the VOIs only flag.
      Parameters:
      flag - true then only register the parts of the images in the VOIs.
    • setWeighted

      public void setWeighted(boolean flag)
      Accessor to set the weighted images flag.
      Parameters:
      flag - true means there are weighted images.
    • setOutOfBoundsIndex

      public void setOutOfBoundsIndex(int outOfBoundsIndex)
      tells how to select fill value for out of bounds data 0 for image minimum 1 for NaN for float, zero otherwise. 2 for user defined 3 for image max
      Parameters:
      outOfBoundsIndex -
    • setFillValue

      public void setFillValue(float fillValue)
      Accessor to set intensity value for out of bounds data
      Parameters:
      fillValue -
    • setMatrixDirectory

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

      protected void callAlgorithm()
      Calls the algorithm with the set-up parameters.
      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.
    • buildAdvancedDialog

      private JDialog buildAdvancedDialog(int maxIter, int numMinima)
      Build advanced settings dialog. Returns JDialog.
      Parameters:
      maxIter - DOCUMENT ME!
      numMinima - DOCUMENT ME!
      bracketBound - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • buildImgComboBox

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

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

      private boolean setVariables()
      Sets the variables needed to call the registration algorithm based on the values entered in the dialog.
      Returns:
      true if the variables are properly set, false otherwise.
    • testType

      private boolean testType(int type, float value)
      Determine if the value is in the image type range and within the float range since AlgorithmTransform does not use double buffers.
      Parameters:
      type - image type
      value - value tested
      Returns:
      true if value is within acceptable range
    • showX

      private void showX()
      DOCUMENT ME!
    • showY

      private void showY()
      DOCUMENT ME!
    • showZ

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