Class JDialogScriptableTransform

  • All Implemented Interfaces:
    AlgorithmInterface, ScriptableActionInterface, DialogDefaultsInterface, ActionDiscovery, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

    public class JDialogScriptableTransform
    extends JDialogScriptableBase
    implements AlgorithmInterface, javax.swing.event.ChangeListener, ActionDiscovery
    Dialog to get user input, then call algorithmTransform. User may select resample or transform. User may input matrix or use image's associated transformation matrix. User may input desired resolutions and dims. User may select interpolation method. Creates new volume. You can choose either of 2 goals in bilinear or trilinear interpolation, but you cannot choose both. You can choose to: 1.) Match the start row, column, and slice in the original image with the start row, column, and slice in the transformed image with no duplication of start values and match the end row, column, and slice in the original image with the end row column, and slice in the transformed image with no duplication of end values with a smooth interpolation occurring between the beginning and end. For a smooth bilinear or trilinear interpolation you must map from 0 to n1t - 1 in the transformed image to 0 to n1 - 1 in the original image. Mapping from n1t - 1 to n1t in the transformed image to n1 - 1 to n1 in the source image would lead to multiple identical transformed copies for source image values between n1 - 1 and n1 - 0.5 and identical or out of bounds transformed values for source values from n1 - 0.5 to n1. This necessitates using equations of the form (dim - 1) * res = (transformedDim - 1) * transformedRes. Since the field of view = dim * res, this does not preserve field of view. If a user wishes to reslice an image and have the beginning and end slices match without duplication, then this would be the method to select 2.) If a user simply wishes to magnify the field of view and is not worried about duplicate beginning and end values, then preserve the field of view = dim * res = transformedDim * transformedRes. If the interpolation is not bilinear or trilinear, then the purpose of interpolation is always to preserve the FOV. For either interpolation purpose, note that if the user selects the new dimension, then the floating point resolution can be perfectly adjusted, but if the user selects the new resolution, since dimensions are integers, the new dimension value may not be perfectly adjusted.
    Version:
    0.1 Nov. 19, 1999
    Author:
    Delia McGarry, Neva Cherniavsky, Zohara Cohen
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JDialog

        javax.swing.JDialog.AccessibleJDialog
      • Nested classes/interfaces inherited from class java.awt.Dialog

        java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Closes dialog box when the OK button is pressed, sets the variables, and calls the algorithm.
      void algorithmPerformed​(AlgorithmBase algorithm)
      This method is required if the AlgorithmPerformed interface is implemented.
      private void buildComboBox()
      Builds a list of images to register to the template image.
      private javax.swing.JPanel buildMatrixPanel()
      Builds the matrixPanel.
      private javax.swing.JPanel buildOptionPanel()
      Builds the OptionPanel.
      private javax.swing.JPanel buildResamplePanel()
      Builds the resample panel.
      protected void callAlgorithm()
      Calls the algorithm with the set variables.
      private void callTalAlgorithm()
      DOCUMENT ME!
      ParameterTable createInputParameters()
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in setGUIFromParams()).
      ParameterTable createOutputParameters()
      Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).
      protected void doPostAlgorithmActions()
      Used to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table).
      private void enableDims​(boolean state)
      DOCUMENT ME!
      private void enableResols​(boolean state)
      DOCUMENT ME!
      private void enableYSettings​(boolean state)
      DOCUMENT ME!
      void finalize()  
      void focusLost​(java.awt.event.FocusEvent event)
      When the user clicks the mouse out of a text field, resets the necessary variables.
      ActionMetadata getActionMetadata()
      Return meta-information about this discoverable action for categorization and labeling purposes.
      private int[] getAxisOrientation​(float[][] array)
      Return the 3 axis orientation codes that correspond to the closest standard anatomical orientation of the (i,j,k) axes.
      java.lang.String getOutputImageName​(java.lang.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).
      ModelImage getResultImage()
      Accessor that returns the image.
      private void init()
      Initializes the dialog box to a certain size and adds the components.
      boolean isActionComplete()
      Returns whether the action has successfully completed its execution.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Method to handle item events.
      java.lang.String matrixFileMenu()
      Allows the user to select matrix file.
      TransMatrix readTransformMatrixFile​(java.lang.String fileName)
      Reads a matrix from a file.
      private TransMatrix reorientCoordSystem​(TransMatrix rkMatrix)
      Re-orient the matrix to world and left-hand coordinate systems if required.
      static TransMatrix reorientCoordSystem​(TransMatrix rkMatrix, ModelImage rkImage, ModelImage rkResampleImage, boolean bWcSystem, boolean bLeftHandSystem)
      Re-orient the matrix to world and left-hand coordinate systems if required.
      void setClipFlag​(boolean flag)
      Accessor that sets the clip flag.
      private void setDefaultResampleToUser()
      DOCUMENT ME!
      void setDimAndResXYZ()
      Resets the dimension and resolution fields for resampling panel.
      void setDoInvMat​(boolean flag)
      Accessor that sets the boolean for invert matrix.
      void setDoTalairach​(boolean doTalairach)
      Accessor that sets the boolean for doing a Talairach type transformation.
      void setFileXDim​(int xDim)  
      void setFillValue​(float fillValue)
      Accessor that sets the fillValue.
      protected void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
      void setImage25D​(boolean flag)
      Accessor that sets the slicing flag.
      void setInterp​(int interp)
      Accessor that sets the interpolation method.
      void setLeftHandSystem​(boolean leftHandSys)
      Sets the left-hand coordinate flag.
      void setMatrix​(TransMatrix matrix)
      Accessor that sets the transformation matrix.
      void setOutDimensions​(int[] outDim)
      Accessor to set the output image's dimensions.
      void setOutResolutions​(float[] outRes)
      Accessor to set the output image's resolutions.
      void setPadFlag​(boolean flag)
      Accessor that sets the padding flag.
      void setPreserveFOV​(boolean flag)
      Accessor that sets value for the preserveFOV boolean
      void setQuiet​(boolean quiet)  
      void setTransformType​(int transformType)
      Accessor that sets the type of Talairach transformation.
      void setUnits​(int[] units)
      Accessor that sets the units.
      void setUpdateOrigin​(boolean flag)
      Accessor that sets the update origin flag.
      private boolean setVariables()
      Sets the variables needed to run the algorithm.
      void setVOIFlag​(boolean flag)
      Accessor that sets the voi flag.
      void setWCSystem​(boolean wcSys)
      Sets the world coordinate flag.
      void stateChanged​(javax.swing.event.ChangeEvent event)
      Sets values based on knob along slider.
      protected void storeParamsFromGUI()
      Record the parameters just used to run this algorithm in a script.
      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.
      • Methods inherited from class javax.swing.JDialog

        addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Dialog

        addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • algoTrans

        private AlgorithmTransform algoTrans
        or if the source image is to be replaced.
      • clipCheckbox

        private javax.swing.JCheckBox clipCheckbox
        DOCUMENT ME!
      • voiCheckbox

        private javax.swing.JCheckBox voiCheckbox
        DOCUMENT ME!
      • image25DCheckbox

        private javax.swing.JCheckBox image25DCheckbox
        DOCUMENT ME!
      • updateOriginCheckbox

        private javax.swing.JCheckBox updateOriginCheckbox
        DOCUMENT ME!
      • invertCheckbox

        private javax.swing.JCheckBox invertCheckbox
        DOCUMENT ME!
      • comboBoxImage

        private javax.swing.JComboBox comboBoxImage
        DOCUMENT ME!
      • comboBoxInterp

        private javax.swing.JComboBox comboBoxInterp
        DOCUMENT ME!
      • comboBoxTalTransform

        private javax.swing.JComboBox comboBoxTalTransform
        DOCUMENT ME!
      • computeTImage

        private javax.swing.JRadioButton computeTImage
        DOCUMENT ME!
      • do25D

        private boolean do25D
        DOCUMENT ME!
      • doRotateCenter

        private boolean doRotateCenter
        DOCUMENT ME!
      • doTalairach

        private boolean doTalairach
        DOCUMENT ME!
      • doVOI

        private boolean doVOI
        DOCUMENT ME!
      • doClip

        private boolean doClip
        DOCUMENT ME!
      • doPad

        private boolean doPad
        DOCUMENT ME!
      • preserveFOV

        private boolean preserveFOV
        DOCUMENT ME!
      • doUpdateOrigin

        private boolean doUpdateOrigin
        DOCUMENT ME!
      • doInvMat

        private boolean doInvMat
        DOCUMENT ME!
      • fileTransMatrix

        private TransMatrix fileTransMatrix
        Stores the matrix read in from a file it then can be converted to the corrected axis orientation (i.e. world coordinate and/or left-hand coordinate systems).
      • interp

        private int interp
        Interpolation method
      • fillValue

        private float fillValue
      • labelOrigin

        private javax.swing.JLabel labelOrigin
      • labelResX

        private javax.swing.JLabel labelResX
        DOCUMENT ME!
      • labelResY

        private javax.swing.JLabel labelResY
        DOCUMENT ME!
      • labelResZ

        private javax.swing.JLabel labelResZ
        DOCUMENT ME!
      • labelDimX

        private javax.swing.JLabel labelDimX
        DOCUMENT ME!
      • labelDimY

        private javax.swing.JLabel labelDimY
        DOCUMENT ME!
      • labelDimZ

        private javax.swing.JLabel labelDimZ
        DOCUMENT ME!
      • labelTx

        private javax.swing.JLabel labelTx
        DOCUMENT ME!
      • labelTy

        private javax.swing.JLabel labelTy
        DOCUMENT ME!
      • labelTz

        private javax.swing.JLabel labelTz
        DOCUMENT ME!
      • labelRx

        private javax.swing.JLabel labelRx
        DOCUMENT ME!
      • labelRy

        private javax.swing.JLabel labelRy
        DOCUMENT ME!
      • labelRz

        private javax.swing.JLabel labelRz
        DOCUMENT ME!
      • labelSx

        private javax.swing.JLabel labelSx
        DOCUMENT ME!
      • labelSy

        private javax.swing.JLabel labelSy
        DOCUMENT ME!
      • labelSz

        private javax.swing.JLabel labelSz
        DOCUMENT ME!
      • labelSKx

        private javax.swing.JLabel labelSKx
        DOCUMENT ME!
      • labelSKy

        private javax.swing.JLabel labelSKy
        DOCUMENT ME!
      • labelSKz

        private javax.swing.JLabel labelSKz
        DOCUMENT ME!
      • leftHandSystem

        private boolean leftHandSystem
        If true change matrix to the left-hand coordinate system.
      • magSlider

        private javax.swing.JSlider magSlider
        DOCUMENT ME!
      • matrixDeterminationGroup

        private javax.swing.ButtonGroup matrixDeterminationGroup
        DOCUMENT ME!
      • rotationAxisGroup

        private javax.swing.ButtonGroup rotationAxisGroup
        DOCUMENT ME!
      • cropOrPad

        private javax.swing.ButtonGroup cropOrPad
        DOCUMENT ME!
      • matrixFile

        private java.lang.String matrixFile
        DOCUMENT ME!
      • matrixDirectory

        private java.lang.String matrixDirectory
      • matrixFName

        private javax.swing.JTextField matrixFName
        DOCUMENT ME!
      • max

        private int max
        DOCUMENT ME!
      • min

        private int min
        DOCUMENT ME!
      • maximum

        private javax.swing.JLabel maximum
        DOCUMENT ME!
      • minimum

        private javax.swing.JLabel minimum
        DOCUMENT ME!
      • current

        private javax.swing.JLabel current
        DOCUMENT ME!
      • oXdim

        private int oXdim
        DOCUMENT ME!
      • oYdim

        private int oYdim
        DOCUMENT ME!
      • oZdim

        private int oZdim
        DOCUMENT ME!
      • cXdim

        private int cXdim
        DOCUMENT ME!
      • cYdim

        private int cYdim
        DOCUMENT ME!
      • cZdim

        private int cZdim
        DOCUMENT ME!
      • oXres

        private float oXres
        DOCUMENT ME!
      • oYres

        private float oYres
        DOCUMENT ME!
      • oZres

        private float oZres
        DOCUMENT ME!
      • cXres

        private float cXres
        DOCUMENT ME!
      • cYres

        private float cYres
        DOCUMENT ME!
      • cZres

        private float cZres
        DOCUMENT ME!
      • units

        private int[] units
      • resampleGroup

        private javax.swing.ButtonGroup resampleGroup
        DOCUMENT ME!
      • resampleImage

        private ModelImage resampleImage
        DOCUMENT ME!
      • resampletoUser

        private javax.swing.JRadioButton resampletoUser
        DOCUMENT ME!
      • resampletoImage

        private javax.swing.JRadioButton resampletoImage
        DOCUMENT ME!
      • resampleSlider

        private javax.swing.JRadioButton resampleSlider
        DOCUMENT ME!
      • resultImage

        private ModelImage resultImage
        DOCUMENT ME!
      • rotCenter

        private javax.swing.JRadioButton rotCenter
        DOCUMENT ME!
      • rotOrigin

        private javax.swing.JRadioButton rotOrigin
        DOCUMENT ME!
      • cropRadio

        private javax.swing.JRadioButton cropRadio
        DOCUMENT ME!
      • padRadio

        private javax.swing.JRadioButton padRadio
        DOCUMENT ME!
      • storedMatrix

        private javax.swing.JRadioButton storedMatrix
        DOCUMENT ME!
      • noTransform

        private javax.swing.JRadioButton noTransform
        DOCUMENT ME!
      • userDefinedMatrix

        private javax.swing.JRadioButton userDefinedMatrix
        DOCUMENT ME!
      • fileMatrix

        private javax.swing.JRadioButton fileMatrix
        DOCUMENT ME!
      • storedMatrixBox

        private javax.swing.JComboBox storedMatrixBox
      • textResX

        private javax.swing.JTextField textResX
        DOCUMENT ME!
      • textResY

        private javax.swing.JTextField textResY
        DOCUMENT ME!
      • textResZ

        private javax.swing.JTextField textResZ
        DOCUMENT ME!
      • textDimX

        private javax.swing.JTextField textDimX
        DOCUMENT ME!
      • textDimY

        private javax.swing.JTextField textDimY
        DOCUMENT ME!
      • textDimZ

        private javax.swing.JTextField textDimZ
        DOCUMENT ME!
      • textTx

        private javax.swing.JTextField textTx
        DOCUMENT ME!
      • textTy

        private javax.swing.JTextField textTy
        DOCUMENT ME!
      • textTz

        private javax.swing.JTextField textTz
        DOCUMENT ME!
      • textRx

        private javax.swing.JTextField textRx
        DOCUMENT ME!
      • textRy

        private javax.swing.JTextField textRy
        DOCUMENT ME!
      • textRz

        private javax.swing.JTextField textRz
        DOCUMENT ME!
      • textSx

        private javax.swing.JTextField textSx
        DOCUMENT ME!
      • textSy

        private javax.swing.JTextField textSy
        DOCUMENT ME!
      • textSz

        private javax.swing.JTextField textSz
        DOCUMENT ME!
      • textSKx

        private javax.swing.JTextField textSKx
        DOCUMENT ME!
      • textSKy

        private javax.swing.JTextField textSKy
        DOCUMENT ME!
      • textSKz

        private javax.swing.JTextField textSKz
        DOCUMENT ME!
      • transformType

        private int transformType
        DOCUMENT ME!
      • tVal

        private java.lang.String[] tVal
        DOCUMENT ME!
      • wcSystem

        private boolean wcSystem
        If true change matrix to the world coordinate system.
      • xyAspectRatio

        private javax.swing.JCheckBox xyAspectRatio
        DOCUMENT ME!
      • xyzAspectRatio

        private javax.swing.JCheckBox xyzAspectRatio
        DOCUMENT ME!
      • preserveFOVButton

        private javax.swing.JRadioButton preserveFOVButton
      • preserveOutputDimsButton

        private javax.swing.JRadioButton preserveOutputDimsButton
      • outputDimsGroup

        private javax.swing.ButtonGroup outputDimsGroup
      • preserveFOV2Button

        private javax.swing.JRadioButton preserveFOV2Button
      • separateDimResButton

        private javax.swing.JRadioButton separateDimResButton
      • resDimGroup

        private javax.swing.ButtonGroup resDimGroup
      • useSACenterBox

        private javax.swing.JCheckBox useSACenterBox
        checkbox telling the algorithm to use the scanner coordinate center rather than the image center
      • useSACenter

        private boolean useSACenter
      • tabbedPane

        private javax.swing.JTabbedPane tabbedPane
        Tabbed pane
      • isSATransform

        private boolean isSATransform
        is this a scanner anatomical transform (->AXIAL)
      • enableSATransform

        private boolean enableSATransform
      • constantFOV

        private int constantFOV
        We use the constant to preserve the FOV. Either 1 or 0;
      • interpFOVgroup

        private javax.swing.ButtonGroup interpFOVgroup
        Button group for interpolation type, contant FOV or start, end matching.
      • constantFOVradio

        private javax.swing.JRadioButton constantFOVradio
        Radio button for constant FOV interpolation.
      • endMatchFOVradio

        private javax.swing.JRadioButton endMatchFOVradio
        Radio button for slice start & end matching interpolation.
      • dims

        private float[] dims
      • resols

        private float[] resols
      • outOfBoundsLabel

        private javax.swing.JLabel outOfBoundsLabel
      • outOfBoundsComboBox

        private javax.swing.JComboBox outOfBoundsComboBox
      • valueLabel

        private javax.swing.JLabel valueLabel
      • valueText

        private javax.swing.JTextField valueText
      • imageMin

        private double imageMin
      • imageMax

        private double imageMax
      • dataType

        private int dataType
      • resamplePanel

        private javax.swing.JPanel resamplePanel
      • 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
      • fileInterp

        private int[] fileInterp
      • fileXres

        private float[] fileXres
      • fileYres

        private float[] fileYres
      • fileZres

        private float[] fileZres
      • fileXdim

        private int[] fileXdim
      • fileYdim

        private int[] fileYdim
      • fileZdim

        private int[] fileZdim
      • filetVOI

        private boolean[] filetVOI
      • fileClip

        private boolean[] fileClip
      • filePad

        private boolean[] filePad
      • quiet

        private boolean quiet
    • Constructor Detail

      • JDialogScriptableTransform

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

        public JDialogScriptableTransform​(java.awt.Frame theParentFrame,
                                          ModelImage im)
        Constructs new transform dialog and sets up GUI components.
        Parameters:
        theParentFrame - Parent frame.
        im - Source image.
      • JDialogScriptableTransform

        public JDialogScriptableTransform​(java.awt.Frame theParentFrame,
                                          ModelImage im,
                                          boolean doInit)
        Constructs new transform dialog and sets up GUI components.
        Parameters:
        theParentFrame - Parent frame.
        im - Source image.
    • Method Detail

      • setQuiet

        public void setQuiet​(boolean quiet)
        Parameters:
        quiet -
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Closes dialog box when the OK button is pressed, sets the variables, and calls the algorithm.
        Specified by:
        actionPerformed in interface java.awt.event.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.
      • finalize

        public void finalize()
        Overrides:
        finalize in class java.lang.Object
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent event)
        When the user clicks the mouse out of a text field, resets the necessary variables.
        Specified by:
        focusLost in interface java.awt.event.FocusListener
        Overrides:
        focusLost in class JDialogBase
        Parameters:
        event - event that triggers this function
      • getResultImage

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

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Method to handle item events.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Overrides:
        itemStateChanged in class JDialogBase
        Parameters:
        event - event that cause the method to fire
      • matrixFileMenu

        public java.lang.String matrixFileMenu()
        Allows the user to select matrix file.
        Returns:
        fileName
      • readTransformMatrixFile

        public TransMatrix readTransformMatrixFile​(java.lang.String fileName)
        Reads a matrix from a file.
        Parameters:
        fileName - name of the matrix file.
      • setPreserveFOV

        public void setPreserveFOV​(boolean flag)
        Accessor that sets value for the preserveFOV boolean
        Parameters:
        flag - true indicates that output dim should be set from input dim*res or input (dim-1)*res. flag false indicates that the output dim should be set from the selected image output dim.
      • setClipFlag

        public void setClipFlag​(boolean flag)
        Accessor that sets the clip flag.
        Parameters:
        flag - true indicates clip image, false otherwise.
      • setDoInvMat

        public void setDoInvMat​(boolean flag)
        Accessor that sets the boolean for invert matrix.
        Parameters:
        flag - true indicates invert matrix, false otherwise.
      • setDimAndResXYZ

        public void setDimAndResXYZ()
        Resets the dimension and resolution fields for resampling panel. Called by focusLost.
      • setDoTalairach

        public void setDoTalairach​(boolean doTalairach)
        Accessor that sets the boolean for doing a Talairach type transformation.
        Parameters:
        doTalairach - boolean
      • setImage25D

        public void setImage25D​(boolean flag)
        Accessor that sets the slicing flag.
        Parameters:
        flag - true indicates slices should be blurred independently.
      • setInterp

        public void setInterp​(int interp)
        Accessor that sets the interpolation method.
        Parameters:
        interp - DOCUMENT ME!
      • setLeftHandSystem

        public void setLeftHandSystem​(boolean leftHandSys)
        Sets the left-hand coordinate flag. If true, change matrix to the left-hand coordinate system.
        Overrides:
        setLeftHandSystem in class JDialogBase
        Parameters:
        leftHandSys - DOCUMENT ME!
      • setMatrix

        public void setMatrix​(TransMatrix matrix)
        Accessor that sets the transformation matrix.
        Parameters:
        matrix - The transformation matrix.
      • setOutDimensions

        public void setOutDimensions​(int[] outDim)
        Accessor to set the output image's dimensions.
        Parameters:
        outDim - Array of the dimensions.
      • setOutResolutions

        public void setOutResolutions​(float[] outRes)
        Accessor to set the output image's resolutions.
        Parameters:
        outRes - Array of the resolutions.
      • setPadFlag

        public void setPadFlag​(boolean flag)
        Accessor that sets the padding flag.
        Parameters:
        flag - true indicates slices should be blurred independently.
      • setFillValue

        public void setFillValue​(float fillValue)
        Accessor that sets the fillValue.
        Parameters:
        fillValue - DOCUMENT ME!
      • setTransformType

        public void setTransformType​(int transformType)
        Accessor that sets the type of Talairach transformation.
        Parameters:
        transformType - int
      • setUnits

        public void setUnits​(int[] units)
        Accessor that sets the units.
        Parameters:
        units - of image
      • setUpdateOrigin

        public void setUpdateOrigin​(boolean flag)
        Accessor that sets the update origin flag.
        Parameters:
        flag - true indicates to update the image origin using the transformation matrix.
      • setVOIFlag

        public void setVOIFlag​(boolean flag)
        Accessor that sets the voi flag.
        Parameters:
        flag - true indicates transform VOI, false otherwise.
      • setWCSystem

        public void setWCSystem​(boolean wcSys)
        Sets the world coordinate flag. If true, change matrix to the world coordinate system.
        Overrides:
        setWCSystem in class JDialogBase
        Parameters:
        wcSys - DOCUMENT ME!
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent event)
        Sets values based on knob along slider.
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        Parameters:
        event - ChangeEvent event that triggered this function
      • setFileXDim

        public void setFileXDim​(int xDim)
        Parameters:
        xDim - By setting fileXdim[0] to zero can change path selected in callAlgorithm
      • doPostAlgorithmActions

        protected void doPostAlgorithmActions()
        Used to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table). Defaults to no action, override to actually have it do something.
        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
      • buildComboBox

        private void buildComboBox()
        Builds a list of images to register to the template image.
      • buildMatrixPanel

        private javax.swing.JPanel buildMatrixPanel()
        Builds the matrixPanel.
        Returns:
        The matrix panel.
      • buildOptionPanel

        private javax.swing.JPanel buildOptionPanel()
        Builds the OptionPanel.
        Returns:
        DOCUMENT ME!
      • buildResamplePanel

        private javax.swing.JPanel buildResamplePanel()
        Builds the resample panel.
        Returns:
        The resample panel.
      • callTalAlgorithm

        private void callTalAlgorithm()
        DOCUMENT ME!
      • enableDims

        private void enableDims​(boolean state)
        DOCUMENT ME!
        Parameters:
        state - DOCUMENT ME!
      • enableResols

        private void enableResols​(boolean state)
        DOCUMENT ME!
        Parameters:
        state - DOCUMENT ME!
      • enableYSettings

        private void enableYSettings​(boolean state)
        DOCUMENT ME!
        Parameters:
        state - DOCUMENT ME!
      • getAxisOrientation

        private int[] getAxisOrientation​(float[][] array)
        Return the 3 axis orientation codes that correspond to the closest standard anatomical orientation of the (i,j,k) axes.
        Parameters:
        array - 4x4 matrix that transforms (i,j,k) indexes to x,y,z coordinates where +x =Left, +y = Posterior, +z = Superior Only the upper-left 3x3 corner of the matrix is used This routine finds the permutation of (x,y,z) which has the smallest angle to the (i,j,k) axes directions, which are columns of the input matrix
        Returns:
        DOCUMENT ME!
      • init

        private void init()
        Initializes the dialog box to a certain size and adds the components.
      • reorientCoordSystem

        public static TransMatrix reorientCoordSystem​(TransMatrix rkMatrix,
                                                      ModelImage rkImage,
                                                      ModelImage rkResampleImage,
                                                      boolean bWcSystem,
                                                      boolean bLeftHandSystem)
        Re-orient the matrix to world and left-hand coordinate systems if required. Note at the moment the voxel resolutions are handled in the transformation algorithm. At some future point we should adjust for voxel resolutions in the transformation matrix - its faster.
        Parameters:
        rkMatrix - the matrix to be converted
        rkImage - main image
        rkResampleImage - resampled image
        bWcSystem - true if world coord system
        bLeftHandSystem - true if left-handed system.
        Returns:
        result
      • setDefaultResampleToUser

        private void setDefaultResampleToUser()
        DOCUMENT ME!
      • setVariables

        private boolean setVariables()
        Sets the variables needed to run the algorithm.
        Returns:
        Flag indicating successful set of the variables.
      • 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
      • 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 java.lang.String getOutputImageName​(java.lang.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.