Package gov.nih.mipav.view.dialogs
Class JDialogScriptableTransform
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
gov.nih.mipav.view.dialogs.JDialogBase
gov.nih.mipav.view.dialogs.JDialogScriptableBase
gov.nih.mipav.view.dialogs.JDialogScriptableTransform
- All Implemented Interfaces:
AlgorithmInterface,ScriptableActionInterface,DialogDefaultsInterface,ActionDiscovery,ActionListener,FocusListener,ItemListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,RootPaneContainer,WindowConstants
public class JDialogScriptableTransform
extends JDialogScriptableBase
implements AlgorithmInterface, 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:
-
Nested Class Summary
Nested classes/interfaces inherited from class gov.nih.mipav.view.dialogs.JDialogBase
JDialogBase.CancelAction, JDialogBase.HelpAction, JDialogBase.OKActionNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intDOCUMENT ME!private static final intDOCUMENT ME!private AlgorithmTalairachTransformDOCUMENT ME!private AlgorithmTransformor if the source image is to be replaced.private JCheckBoxDOCUMENT ME!private JComboBoxDOCUMENT ME!private JComboBoxDOCUMENT ME!private JComboBoxDOCUMENT ME!private JRadioButtonDOCUMENT ME!private intWe use the constant to preserve the FOV.private JRadioButtonRadio button for constant FOV interpolation.private ButtonGroupDOCUMENT ME!private JRadioButtonDOCUMENT ME!private JLabelDOCUMENT ME!private intDOCUMENT ME!private floatDOCUMENT ME!private intDOCUMENT ME!private floatDOCUMENT ME!private intDOCUMENT ME!private floatDOCUMENT ME!private intprivate float[]private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanprivate JRadioButtonRadio button for slice start invalid input: '&' end matching interpolation.private boolean[]private int[]private JRadioButtonDOCUMENT ME!private boolean[]private TransMatrixStores 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).private boolean[]private floatprivate ModelImagesource imageprivate JCheckBoxDOCUMENT ME!private doubleprivate doubleprivate intInterpolation methodprivate ButtonGroupButton group for interpolation type, contant FOV or start, end matching.private JCheckBoxDOCUMENT ME!private booleanis this a scanner anatomical transform (->AXIAL)private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelprivate JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelprivate JLabelprivate JLabelprivate JLabelprivate JLabelprivate JLabelprivate JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private JLabelDOCUMENT ME!private booleanIf true change matrix to the left-hand coordinate system.private JSliderDOCUMENT ME!private ButtonGroupDOCUMENT ME!private Stringprivate StringDOCUMENT ME!private JTextFieldDOCUMENT ME!private intDOCUMENT ME!private JLabelDOCUMENT ME!private intDOCUMENT ME!private JLabelDOCUMENT ME!private JRadioButtonDOCUMENT ME!private static final intDOCUMENT ME!private static final intDOCUMENT ME!private JComboBoxprivate intTells 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 maximumprivate JLabelprivate ButtonGroupprivate intDOCUMENT ME!private floatDOCUMENT ME!private intDOCUMENT ME!private floatDOCUMENT ME!private intDOCUMENT ME!private floatDOCUMENT ME!private JRadioButtonDOCUMENT ME!private booleanDOCUMENT ME!private JRadioButtonprivate JRadioButtonprivate JRadioButtonprivate JRadioButtonprivate booleanprivate Stringprivate ButtonGroupDOCUMENT ME!private ModelImageDOCUMENT ME!private JRadioButtonprivate JRadioButtonprivate JPanelprivate JRadioButtonDOCUMENT ME!private JTextFieldprivate JRadioButtonDOCUMENT ME!private JRadioButtonDOCUMENT ME!private JRadioButtonDOCUMENT ME!private ButtonGroupprivate float[]private ButtonGroupprivate ModelImageDOCUMENT ME!private ButtonGroupDOCUMENT ME!private JRadioButtonDOCUMENT ME!private JRadioButtonDOCUMENT ME!private JRadioButtonprivate static final longUse serialVersionUID for interoperability.private int[]private float[]private int[]private float[]private int[]private float[]private AlgorithmTPSplineprivate JRadioButtonDOCUMENT ME!private JComboBoxprivate JTabbedPaneTabbed paneprivate int[]private float[]private int[]private float[]private int[]private float[]private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldprivate JTextFieldprivate JTextFieldprivate JTextFieldprivate JTextFieldprivate JTextFieldprivate JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private TalairachTransformInfoDOCUMENT ME!private static final intDOCUMENT ME!private static final intDOCUMENT ME!private Stringprivate JTextFieldprivate intDOCUMENT ME!private String[]DOCUMENT ME!private int[]private JCheckBoxDOCUMENT ME!private JRadioButtonDOCUMENT ME!private ViewUserInterfaceDOCUMENT ME!private booleanprivate JCheckBoxcheckbox telling the algorithm to use the scanner coordinate center rather than the image centerprivate JLabelprivate JTextFieldprivate JCheckBoxDOCUMENT ME!private booleanIf true change matrix to the world coordinate system.private TransMatrixDOCUMENT ME!private JCheckBoxDOCUMENT ME!private JCheckBoxDOCUMENT ME!Fields inherited from class gov.nih.mipav.view.dialogs.JDialogScriptableBase
displayInNewFrame, isComplete, scriptParametersFields inherited from class gov.nih.mipav.view.dialogs.JDialogBase
applyButton, bar, cancelButton, cancelFlag, closeButton, HELP, helpButton, mainDialogPanel, NEW, OKButton, parentFrame, progressBar, REPLACE, runInSeparateThread, runningScriptFlag, runQuiet, serif12, serif12B, voiManagerFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor needed for dynamic instantiation (used during scripting).JDialogScriptableTransform(Frame theParentFrame, ModelImage im) Constructs new transform dialog and sets up GUI components.JDialogScriptableTransform(Frame theParentFrame, ModelImage im, boolean doInit) Constructs new transform dialog and sets up GUI components. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Closes dialog box when the OK button is pressed, sets the variables, and calls the algorithm.voidalgorithmPerformed(AlgorithmBase algorithm) This method is required if the AlgorithmPerformed interface is implemented.private voidBuilds a list of images to register to the template image.private JPanelBuilds the matrixPanel.private JPanelBuilds the OptionPanel.private JPanelBuilds the resample panel.(package private) JPanel(package private) JPanelprotected voidCalls the algorithm with the set variables.private voidDOCUMENT ME!private voidprivate voidprivate voidReturns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used insetGUIFromParams()).Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).private voidprotected voidUsed to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table).private voidenableDims(boolean state) DOCUMENT ME!private voidprivate voidprivate voidenableResols(boolean state) DOCUMENT ME!private voidenableYSettings(boolean state) DOCUMENT ME!voidfinalize()voidfocusLost(FocusEvent event) When the user clicks the mouse out of a text field, resets the necessary variables.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.(package private) FilegetFileFromName(String fileName) 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).Accessor that returns the image.private booleanprivate voidinit()Initializes the dialog box to a certain size and adds the components.booleanReturns whether the action has successfully completed its execution.private booleanisCorrectTranformMatrixFile(String fileName) private booleanprivate booleanvoiditemStateChanged(ItemEvent event) Method to handle item events.Allows the user to select matrix file.private voidreadTransformMatrixFile(String fileName) Reads a matrix from a file.private TransMatrixreadTransformMatrixFile(String fileName, boolean runningFromScript) Reads a matrix from a file.private TransMatrixreorientCoordSystem(TransMatrix rkMatrix) Re-orient the matrix to world and left-hand coordinate systems if required.static TransMatrixreorientCoordSystem(TransMatrix rkMatrix, ModelImage rkImage, ModelImage rkResampleImage, boolean bWcSystem, boolean bLeftHandSystem) Re-orient the matrix to world and left-hand coordinate systems if required.voidsetClipFlag(boolean flag) Accessor that sets the clip flag.private voidDOCUMENT ME!voidResets the dimension and resolution fields for resampling panel.voidsetDoInvMat(boolean flag) Accessor that sets the boolean for invert matrix.voidsetDoTalairach(boolean doTalairach) Accessor that sets the boolean for doing a Talairach type transformation.voidsetFileXDim(int xDim) voidsetFillValue(float fillValue) Accessor that sets the fillValue.protected voidSet the dialog GUI using the script parameters while running this algorithm as part of a script.voidsetImage25D(boolean flag) Accessor that sets the slicing flag.voidsetInterp(int interp) Accessor that sets the interpolation method.voidsetLeftHandSystem(boolean leftHandSys) Sets the left-hand coordinate flag.voidsetMatrix(TransMatrix matrix) Accessor that sets the transformation matrix.voidsetOutDimensions(int[] outDim) Accessor to set the output image's dimensions.voidsetOutResolutions(float[] outRes) Accessor to set the output image's resolutions.voidsetPadFlag(boolean flag) Accessor that sets the padding flag.voidsetPreserveFOV(boolean flag) Accessor that sets value for the preserveFOV booleanvoidsetQuiet(boolean quiet) private voidsetResampleStatusBox(String status) private voidsetTransformStatusBox(String status) voidsetTransformType(int transformType) Accessor that sets the type of Talairach transformation.voidsetUnits(int[] units) Accessor that sets the units.voidsetUpdateOrigin(boolean flag) Accessor that sets the update origin flag.private booleanSets the variables needed to run the algorithm.voidsetVOIFlag(boolean flag) Accessor that sets the voi flag.voidsetWCSystem(boolean wcSys) Sets the world coordinate flag.voidstateChanged(ChangeEvent event) Sets values based on knob along slider.protected voidRecord the parameters just used to run this algorithm in a script.private booleantestType(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.private voidprivate voidMethods inherited from class gov.nih.mipav.view.dialogs.JDialogScriptableBase
getDialogActionString, insertScriptLine, isComplete, scriptRun, setCompleteMethods inherited from class gov.nih.mipav.view.dialogs.JDialogBase
buildApplyButton, buildButtons, buildCancelButton, buildCancelButton, buildCloseButton, buildHelpButton, buildImageComboBox, buildOKButton, buildOKButton, buildOKCancelButtons, buildTitledBorder, buildTitledBorder, createLabel, createProgressBar, createProgressBar, createTextField, focusGained, getDialogName, isCancelled, isQuietRunning, isRunInSeparateThread, isScriptRunning, loadDefaults, loadDefaults, makeImageName, makeString, openNewFrame, saveDefaults, saveDefaults, setQuietRunning, setScriptRunning, setSeparateThread, setVisible, setVisible, setVisibleMenuBar, setVisibleStandard, setVOIManager, testParameter, testParameterMin, updateFFTFileInfo, updateFileInfo, updateFileInfoOtherModality, updateFileInfoStatic, updateFileInfoStatic, updateFileTypeInfo, updateFileTypeInfo, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods 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, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods 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, toFrontMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gov.nih.mipav.view.dialogs.ActionDiscovery
scriptRun
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
ORIG_TO_ACPC
private static final int ORIG_TO_ACPCDOCUMENT ME!- See Also:
-
ORIG_TO_TLRC
private static final int ORIG_TO_TLRCDOCUMENT ME!- See Also:
-
ACPC_TO_TLRC
private static final int ACPC_TO_TLRCDOCUMENT ME!- See Also:
-
TLRC_TO_ACPC
private static final int TLRC_TO_ACPCDOCUMENT ME!- See Also:
-
TLRC_TO_ORIG
private static final int TLRC_TO_ORIGDOCUMENT ME!- See Also:
-
ACPC_TO_ORIG
private static final int ACPC_TO_ORIGDOCUMENT ME!- See Also:
-
algoTal
DOCUMENT ME! -
algoTrans
or if the source image is to be replaced. -
clipCheckbox
DOCUMENT ME! -
voiCheckbox
DOCUMENT ME! -
image25DCheckbox
DOCUMENT ME! -
updateOriginCheckbox
DOCUMENT ME! -
invertCheckbox
DOCUMENT ME! -
comboBoxImage
DOCUMENT ME! -
comboBoxInterp
DOCUMENT ME! -
comboBoxTalTransform
DOCUMENT ME! -
computeTImage
DOCUMENT ME! -
do25D
private boolean do25DDOCUMENT ME! -
doRotateCenter
private boolean doRotateCenterDOCUMENT ME! -
doTalairach
private boolean doTalairachDOCUMENT ME! -
doVOI
private boolean doVOIDOCUMENT ME! -
doClip
private boolean doClipDOCUMENT ME! -
doPad
private boolean doPadDOCUMENT ME! -
preserveFOV
private boolean preserveFOVDOCUMENT ME! -
doUpdateOrigin
private boolean doUpdateOriginDOCUMENT ME! -
doInvMat
private boolean doInvMatDOCUMENT ME! -
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). -
image
source image -
interp
private int interpInterpolation method -
fillValue
private float fillValue -
labelOrigin
-
labelResX
DOCUMENT ME! -
labelResY
DOCUMENT ME! -
labelResZ
DOCUMENT ME! -
labelDimX
DOCUMENT ME! -
labelDimY
DOCUMENT ME! -
labelDimZ
DOCUMENT ME! -
labelTransformResX
-
labelTransformResY
-
labelTransformResZ
-
labelTransformDimX
-
labelTransformDimY
-
labelTransformDimZ
-
textTransformResX
-
textTransformResY
-
textTransformResZ
-
textTransformDimX
-
textTransformDimY
-
textTransformDimZ
-
resTransformGroup
-
resampleMatrixSourceButton
-
resampleMatrixTargetButton
-
labelTx
DOCUMENT ME! -
labelTy
DOCUMENT ME! -
labelTz
DOCUMENT ME! -
labelRx
DOCUMENT ME! -
labelRy
DOCUMENT ME! -
labelRz
DOCUMENT ME! -
labelSx
DOCUMENT ME! -
labelSy
DOCUMENT ME! -
labelSz
DOCUMENT ME! -
labelSKx
DOCUMENT ME! -
labelSKy
DOCUMENT ME! -
labelSKz
DOCUMENT ME! -
leftHandSystem
private boolean leftHandSystemIf true change matrix to the left-hand coordinate system. -
magSlider
DOCUMENT ME! -
matrixDeterminationGroup
DOCUMENT ME! -
rotationAxisGroup
DOCUMENT ME! -
cropOrPad
DOCUMENT ME! -
matrixFile
DOCUMENT ME! -
matrixDirectory
-
matrixFName
DOCUMENT ME! -
max
private int maxDOCUMENT ME! -
min
private int minDOCUMENT ME! -
maximum
DOCUMENT ME! -
minimum
DOCUMENT ME! -
current
DOCUMENT ME! -
oXdim
private int oXdimDOCUMENT ME! -
oYdim
private int oYdimDOCUMENT ME! -
oZdim
private int oZdimDOCUMENT ME! -
cXdim
private int cXdimDOCUMENT ME! -
cYdim
private int cYdimDOCUMENT ME! -
cZdim
private int cZdimDOCUMENT ME! -
oXres
private float oXresDOCUMENT ME! -
oYres
private float oYresDOCUMENT ME! -
oZres
private float oZresDOCUMENT ME! -
cXres
private float cXresDOCUMENT ME! -
cYres
private float cYresDOCUMENT ME! -
cZres
private float cZresDOCUMENT ME! -
units
private int[] units -
resampleGroup
DOCUMENT ME! -
resampleImage
DOCUMENT ME! -
resampletoUser
DOCUMENT ME! -
resampletoImage
DOCUMENT ME! -
resampleSlider
DOCUMENT ME! -
resampletoMatrixFile
DOCUMENT ME! -
resultImage
DOCUMENT ME! -
rotCenter
DOCUMENT ME! -
rotOrigin
DOCUMENT ME! -
cropRadio
DOCUMENT ME! -
padRadio
DOCUMENT ME! -
storedMatrix
DOCUMENT ME! -
noTransform
DOCUMENT ME! -
userDefinedMatrix
DOCUMENT ME! -
fileMatrix
DOCUMENT ME! -
storedMatrixBox
-
textResX
DOCUMENT ME! -
textResY
DOCUMENT ME! -
textResZ
DOCUMENT ME! -
textDimX
DOCUMENT ME! -
textDimY
DOCUMENT ME! -
textDimZ
DOCUMENT ME! -
resampleStatusTextField
-
transformStatusTextField
-
textTx
DOCUMENT ME! -
textTy
DOCUMENT ME! -
textTz
DOCUMENT ME! -
textRx
DOCUMENT ME! -
textRy
DOCUMENT ME! -
textRz
DOCUMENT ME! -
textSx
DOCUMENT ME! -
textSy
DOCUMENT ME! -
textSz
DOCUMENT ME! -
textSKx
DOCUMENT ME! -
textSKy
DOCUMENT ME! -
textSKz
DOCUMENT ME! -
tInfo
DOCUMENT ME! -
transformType
private int transformTypeDOCUMENT ME! -
tVal
DOCUMENT ME! -
userInterface
DOCUMENT ME! -
wcSystem
private boolean wcSystemIf true change matrix to the world coordinate system. -
xfrm
DOCUMENT ME! -
xyAspectRatio
DOCUMENT ME! -
xyzAspectRatio
DOCUMENT ME! -
preserveFOVButton
-
preserveOutputDimsButton
-
outputDimsGroup
-
preserveFOV2Button
-
separateDimResButton
-
resDimGroup
-
useSACenterBox
checkbox telling the algorithm to use the scanner coordinate center rather than the image center -
useSACenter
private boolean useSACenter -
tabbedPane
Tabbed pane -
isSATransform
private boolean isSATransformis this a scanner anatomical transform (->AXIAL) -
enableSATransform
private boolean enableSATransform -
constantFOV
private int constantFOVWe use the constant to preserve the FOV. Either 1 or 0; -
interpFOVgroup
Button group for interpolation type, contant FOV or start, end matching. -
constantFOVradio
Radio button for constant FOV interpolation. -
endMatchFOVradio
Radio button for slice start invalid input: '&' end matching interpolation. -
dims
private float[] dims -
resols
private float[] resols -
outOfBoundsLabel
-
outOfBoundsComboBox
-
valueLabel
-
valueText
-
imageMin
private double imageMin -
imageMax
private double imageMax -
dataType
private int dataType -
resamplePanel
-
outOfBoundsIndex
private int outOfBoundsIndexTells 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 -
spline
-
fileInterp
private int[] fileInterp -
sourceXres
private float[] sourceXres -
sourceYres
private float[] sourceYres -
sourceZres
private float[] sourceZres -
targetXres
private float[] targetXres -
targetYres
private float[] targetYres -
targetZres
private float[] targetZres -
sourceXdim
private int[] sourceXdim -
sourceYdim
private int[] sourceYdim -
sourceZdim
private int[] sourceZdim -
targetXdim
private int[] targetXdim -
targetYdim
private int[] targetYdim -
targetZdim
private int[] targetZdim -
filetVOI
private boolean[] filetVOI -
fileClip
private boolean[] fileClip -
filePad
private boolean[] filePad -
quiet
private boolean quiet -
RESAMPLE_STATUS_DEFAULT_TEXT
-
TRANSFORM_STATUS_DEFAULT_TEXT
-
prevSelectedTransformRadioButton
-
-
Constructor Details
-
JDialogScriptableTransform
public JDialogScriptableTransform()Empty constructor needed for dynamic instantiation (used during scripting). -
JDialogScriptableTransform
Constructs new transform dialog and sets up GUI components.- Parameters:
theParentFrame- Parent frame.im- Source image.
-
JDialogScriptableTransform
Constructs new transform dialog and sets up GUI components.- Parameters:
theParentFrame- Parent frame.im- Source image.
-
-
Method Details
-
setQuiet
public void setQuiet(boolean quiet) - Parameters:
quiet-
-
actionPerformed
Closes dialog box when the OK button is pressed, sets the variables, and calls the algorithm.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classJDialogBase- Parameters:
event- Event that triggers function.
-
algorithmPerformed
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:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- Algorithm that caused the event.
-
finalize
public void finalize() -
focusLost
When the user clicks the mouse out of a text field, resets the necessary variables.- Specified by:
focusLostin interfaceFocusListener- Overrides:
focusLostin classJDialogBase- Parameters:
event- event that triggers this function
-
getResultImage
Accessor that returns the image.- Returns:
- The result image
-
itemStateChanged
Method to handle item events.- Specified by:
itemStateChangedin interfaceItemListener- Overrides:
itemStateChangedin classJDialogBase- Parameters:
event- event that cause the method to fire
-
matrixFileMenu
Allows the user to select matrix file.- Returns:
- fileName
-
getFileFromName
-
isCorrectTranformMatrixFile
-
readTransformMatrixFile
Reads a matrix from a file.- Parameters:
fileName- name of the matrix file.runningFromScript- if this was invoked from the script runner
-
readTransformMatrixFile
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-trueindicates that output dim should be set from input dim*res or input (dim-1)*res. flagfalseindicates 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-trueindicates clip image,falseotherwise.
-
setDoInvMat
public void setDoInvMat(boolean flag) Accessor that sets the boolean for invert matrix.- Parameters:
flag-trueindicates invert matrix,falseotherwise.
-
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-trueindicates 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:
setLeftHandSystemin classJDialogBase- Parameters:
leftHandSys- DOCUMENT ME!
-
setMatrix
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-trueindicates 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-trueindicates to update the image origin using the transformation matrix.
-
setVOIFlag
public void setVOIFlag(boolean flag) Accessor that sets the voi flag.- Parameters:
flag-trueindicates transform VOI,falseotherwise.
-
setWCSystem
public void setWCSystem(boolean wcSys) Sets the world coordinate flag. If true, change matrix to the world coordinate system.- Overrides:
setWCSystemin classJDialogBase- Parameters:
wcSys- DOCUMENT ME!
-
stateChanged
Sets values based on knob along slider.- Specified by:
stateChangedin interfaceChangeListener- 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
-
callAlgorithm
protected void callAlgorithm()Calls the algorithm with the set variables.- Specified by:
callAlgorithmin classJDialogScriptableBase
-
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:
doPostAlgorithmActionsin classJDialogScriptableBase
-
setGUIFromParams
protected void setGUIFromParams()Set the dialog GUI using the script parameters while running this algorithm as part of a script.- Specified by:
setGUIFromParamsin classJDialogScriptableBase
-
storeParamsFromGUI
Record the parameters just used to run this algorithm in a script.- Specified by:
storeParamsFromGUIin classJDialogScriptableBase- 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. -
buildMatrixPanel
Builds the matrixPanel.- Returns:
- The matrix panel.
-
buildOptionPanel
Builds the OptionPanel.- Returns:
- DOCUMENT ME!
-
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. -
buildResampleStatusPanel
JPanel buildResampleStatusPanel() -
buildTransformStatusPanel
JPanel buildTransformStatusPanel() -
reorientCoordSystem
Re-orient the matrix to world and left-hand coordinate systems if required.- Parameters:
rkMatrix- the matrix to be converted- Returns:
- result
- See Also:
-
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 convertedrkImage- main imagerkResampleImage- resampled imagebWcSystem- true if world coord systembLeftHandSystem- 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 typevalue- value tested- Returns:
- true if value is within acceptable range
-
getActionMetadata
Return meta-information about this discoverable action for categorization and labeling purposes.- Specified by:
getActionMetadatain interfaceActionDiscovery- Returns:
- Metadata for this action.
-
createInputParameters
Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used insetGUIFromParams()).- Specified by:
createInputParametersin interfaceActionDiscovery- Returns:
- A parameter table listing the inputs of this algorithm.
-
createOutputParameters
Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).- Specified by:
createOutputParametersin interfaceActionDiscovery- Returns:
- A parameter table listing the outputs of this algorithm.
-
getOutputImageName
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:
getOutputImageNamein interfaceActionDiscovery- 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:
isActionCompletein interfaceActionDiscovery- Returns:
- True, if the action is complete. False, if the action failed or is still running.
-
disableResampleMatrixFileButton
private void disableResampleMatrixFileButton() -
enableResampleMatrixFileButton
private void enableResampleMatrixFileButton() -
enableResampleMatrixFileButtonTargetOnly
private void enableResampleMatrixFileButtonTargetOnly() -
populateResampleMatrixFileValues
private void populateResampleMatrixFileValues() -
clearResampleOriginalValues
private void clearResampleOriginalValues() -
setResampleStatusBox
-
clearResampleStatusBox
private void clearResampleStatusBox() -
isValidV2MatrixFileRead
private boolean isValidV2MatrixFileRead() -
isV2MatrixDataFile
private boolean isV2MatrixDataFile() -
hasV1TargetData
private boolean hasV1TargetData() -
setTransformStatusBox
-
clearTransformStatusBox
private void clearTransformStatusBox() -
updateResampleStatusUserSpecified
private void updateResampleStatusUserSpecified() -
updateResampleStatusImage
private void updateResampleStatusImage()
-