Class JPanelEPIDistortionCorrection
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- gov.nih.mipav.view.renderer.WildMagic.DTI_FrameWork.JPanelEPIDistortionCorrection
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
public class JPanelEPIDistortionCorrection extends javax.swing.JPanel implements java.awt.event.ActionListener
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JTextField
B0MatrixFile
private javax.swing.JPanel
B0toStructTransPanel
private java.lang.String
computeDefFieldCommand
private javax.swing.JButton
computeDeformationFieldButton
button for computing the deformation field:private java.lang.String
computeEpiCommand
private javax.swing.JButton
computeEpiCorrectionButton
button for applying the deformation field to the input 4D imageprivate javax.swing.JPanel
DefLoadPanel
private ModelImage
deformationB0T2
deformation field from registering the B0 volume to the resampled T2 volume with VABRAprivate javax.swing.JTextField
deformationB0T2Text
private ModelImage
deformedDWI
DWI image series after applying the list of deformation fieldsprivate javax.swing.JCheckBox
displayDeformationField
output image display options:private javax.swing.JCheckBox
displayEPIResult
private javax.swing.JCheckBox
displayRegisteredB0
private javax.swing.JPanel
DWITransPanel
private java.lang.String
loadAllMatrixComand
private java.lang.String
loadB0MatrixComand
private java.lang.String
loadDeformationFieldCommand
private java.lang.String
loadDWICommand
private java.lang.String
loadT2Command
button commandsprivate javax.swing.JPanel
mainPanel
main panelprivate TransMatrix
matB0T2
Transformation matrix from registering B0 to T2.private TransMatrix[]
matRegistered
Array of transformation matrices after registering the DWI image series to the B0 reference volume.private javax.swing.JTextField
matricesFile
private java.lang.String
outputCommand
private javax.swing.JTextField
outputDir
private javax.swing.JPanel
OutputPanel
private DTIPipeline
pipeline
reference to the DTI Pipelineprivate javax.swing.JTextField
refImageNumText
Text fields for entering the input images:private ModelImage
registeredB0
B0 volume extracted from the DWI series.private ModelImage
registeredDWI
DWI image series that has been registered within series to the B0 volume.private javax.swing.JPanel
RegisteredDWIPanel
private javax.swing.JTextField
registeredDWIText
private ModelImage
resampledT2
Structural T2 image, resampled to match the DWI image series.private javax.swing.JTextField
resampledT2Text
private static long
serialVersionUID
private javax.swing.JPanel
T2loadPanel
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description JPanelEPIDistortionCorrection(DTIPipeline pipeline)
Creates the EPI-Distortion correction panel for the DTI Pipeline
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
private void
applyDefField(ModelImage vol4DIn, ModelImage vol4DOut, int vol, Jama.Matrix m, ModelImage defField, int[] extents, float[] resolutions)
Creates a deformation field from the input matrix and deformation field and applies it to the input image.private ModelImage
applyDeformationField(int indexB0, TransMatrix b0toStructMatrix, TransMatrix[] arrayTransMatrix, ModelImage defField, ModelImage result35RegImage)
Applies the input B0 to T2 matrix, list of within-volume matrices and input deformation field to the 4D volume series.javax.swing.JPanel
buildLoadPanel(java.awt.event.ActionListener listener, javax.swing.JPanel mainPanel, javax.swing.JLabel label, javax.swing.JTextField imageName, java.lang.String tooltip, java.lang.String actionCommand, javax.swing.JPanel panelName)
private void
enableComputeEpiDistortion()
Checks that all the parameters necessary to run the epi-distortion correction are set and enables the compute button and display check-box.private void
enableComputeVabra()
Checks that all the parameters necessary to run the VABRA registration are set and enables the compute button and display check-boxes.static ModelImage
extractSubVolume(ModelImage dwiImage, int index)
ModelImage
getResult()
Returns the distortion-corrected DWI 4D image series.private void
init()
User-interface intialization.private ModelImage
loadFile(javax.swing.JTextField textField)
Loads a user-selected image file.private TransMatrix[]
readMultiTransformMatrix(javax.swing.JTextField textField)
Reads the multiple-matrix file from disk.private TransMatrix
readTransformMatrix(javax.swing.JTextField textField)
Reads a single matrix file from disk.private void
runVabra()
Run the VABRA registration.void
setB0toT2Matrix(TransMatrix matrix, java.lang.String fileName)
Sets the B0 to T2 matrix.void
setRegisteredDWIImage(ModelImage registeredImage)
Sets the with-in volume registered 4D DWI image.void
setRegisteredMatrices(TransMatrix[] matrix, java.lang.String fileName)
Sets the within-volume array of matrices.void
setResampledT2Image(ModelImage resampledImage)
Sets the resampled T2 structural image, from the DTIPipeline pre-processing panel, or by the user loading the file disk.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
pipeline
private DTIPipeline pipeline
reference to the DTI Pipeline
-
mainPanel
private javax.swing.JPanel mainPanel
main panel
-
refImageNumText
private javax.swing.JTextField refImageNumText
Text fields for entering the input images:
-
resampledT2Text
private javax.swing.JTextField resampledT2Text
-
registeredDWIText
private javax.swing.JTextField registeredDWIText
-
deformationB0T2Text
private javax.swing.JTextField deformationB0T2Text
-
matricesFile
private javax.swing.JTextField matricesFile
-
B0MatrixFile
private javax.swing.JTextField B0MatrixFile
-
outputDir
private javax.swing.JTextField outputDir
-
displayDeformationField
private javax.swing.JCheckBox displayDeformationField
output image display options:
-
displayRegisteredB0
private javax.swing.JCheckBox displayRegisteredB0
-
displayEPIResult
private javax.swing.JCheckBox displayEPIResult
-
loadT2Command
private java.lang.String loadT2Command
button commands
-
loadDWICommand
private java.lang.String loadDWICommand
-
loadDeformationFieldCommand
private java.lang.String loadDeformationFieldCommand
-
outputCommand
private java.lang.String outputCommand
-
computeDefFieldCommand
private java.lang.String computeDefFieldCommand
-
computeEpiCommand
private java.lang.String computeEpiCommand
-
loadB0MatrixComand
private java.lang.String loadB0MatrixComand
-
loadAllMatrixComand
private java.lang.String loadAllMatrixComand
-
computeDeformationFieldButton
private javax.swing.JButton computeDeformationFieldButton
button for computing the deformation field:
-
computeEpiCorrectionButton
private javax.swing.JButton computeEpiCorrectionButton
button for applying the deformation field to the input 4D image
-
resampledT2
private ModelImage resampledT2
Structural T2 image, resampled to match the DWI image series.
-
registeredDWI
private ModelImage registeredDWI
DWI image series that has been registered within series to the B0 volume.
-
registeredB0
private ModelImage registeredB0
B0 volume extracted from the DWI series.
-
deformationB0T2
private ModelImage deformationB0T2
deformation field from registering the B0 volume to the resampled T2 volume with VABRA
-
deformedDWI
private ModelImage deformedDWI
DWI image series after applying the list of deformation fields
-
matB0T2
private TransMatrix matB0T2
Transformation matrix from registering B0 to T2.
-
matRegistered
private TransMatrix[] matRegistered
Array of transformation matrices after registering the DWI image series to the B0 reference volume.
-
T2loadPanel
private javax.swing.JPanel T2loadPanel
-
RegisteredDWIPanel
private javax.swing.JPanel RegisteredDWIPanel
-
DefLoadPanel
private javax.swing.JPanel DefLoadPanel
-
B0toStructTransPanel
private javax.swing.JPanel B0toStructTransPanel
-
DWITransPanel
private javax.swing.JPanel DWITransPanel
-
OutputPanel
private javax.swing.JPanel OutputPanel
-
-
Constructor Detail
-
JPanelEPIDistortionCorrection
public JPanelEPIDistortionCorrection(DTIPipeline pipeline)
Creates the EPI-Distortion correction panel for the DTI Pipeline- Parameters:
pipeline
-
-
-
Method Detail
-
extractSubVolume
public static ModelImage extractSubVolume(ModelImage dwiImage, int index)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
getResult
public ModelImage getResult()
Returns the distortion-corrected DWI 4D image series.- Returns:
- the distortion-corrected DWI 4D image series.
-
setB0toT2Matrix
public void setB0toT2Matrix(TransMatrix matrix, java.lang.String fileName)
Sets the B0 to T2 matrix. Set from the DTI Pipeline pre-processing panel, or by the user loading the .mtx file from disk.- Parameters:
matrix
-fileName
-
-
setRegisteredDWIImage
public void setRegisteredDWIImage(ModelImage registeredImage)
Sets the with-in volume registered 4D DWI image. Can be set from the DTI Pipeline pre-processing panel or by the user loading the file from disk.- Parameters:
registeredImage
-
-
setRegisteredMatrices
public void setRegisteredMatrices(TransMatrix[] matrix, java.lang.String fileName)
Sets the within-volume array of matrices. Set from the DTI Pipeline pre-processing panel, or by the user loading the .mtx file from disk.- Parameters:
matrix
-fileName
-
-
setResampledT2Image
public void setResampledT2Image(ModelImage resampledImage)
Sets the resampled T2 structural image, from the DTIPipeline pre-processing panel, or by the user loading the file disk.- Parameters:
resampledImage
-
-
applyDefField
private void applyDefField(ModelImage vol4DIn, ModelImage vol4DOut, int vol, Jama.Matrix m, ModelImage defField, int[] extents, float[] resolutions)
Creates a deformation field from the input matrix and deformation field and applies it to the input image. Returns the new image result.- Parameters:
m
- input matriximage
- input imagedefField
- input deformation fieldresolutions
- resolutions of the input image
-
applyDeformationField
private ModelImage applyDeformationField(int indexB0, TransMatrix b0toStructMatrix, TransMatrix[] arrayTransMatrix, ModelImage defField, ModelImage result35RegImage)
Applies the input B0 to T2 matrix, list of within-volume matrices and input deformation field to the 4D volume series.- Parameters:
indexB0
- index of the B0 image in the 4D imageb0toStructMatrix
- B0 to T2 transformation matrixarrayTransMatrix
- array of transformation matrices from the within-volume registrationdefField
- B0 to T2 deformation field, computed from VABRAresult35RegImage
- input 4D image- Returns:
- new image result
-
enableComputeEpiDistortion
private void enableComputeEpiDistortion()
Checks that all the parameters necessary to run the epi-distortion correction are set and enables the compute button and display check-box.
-
enableComputeVabra
private void enableComputeVabra()
Checks that all the parameters necessary to run the VABRA registration are set and enables the compute button and display check-boxes.
-
init
private void init()
User-interface intialization.
-
loadFile
private ModelImage loadFile(javax.swing.JTextField textField)
Loads a user-selected image file. Sets the input text field to the file name.- Parameters:
textField
-- Returns:
-
readMultiTransformMatrix
private TransMatrix[] readMultiTransformMatrix(javax.swing.JTextField textField)
Reads the multiple-matrix file from disk. Sets the input text field to list the file name.- Parameters:
textField
-- Returns:
-
readTransformMatrix
private TransMatrix readTransformMatrix(javax.swing.JTextField textField)
Reads a single matrix file from disk. Sets the input text field to match the file name.- Parameters:
textField
-- Returns:
-
runVabra
private void runVabra()
Run the VABRA registration. Saves the deformation field and the registered B0 image to disk. Enables the epi-distortion correction.
-
buildLoadPanel
public javax.swing.JPanel buildLoadPanel(java.awt.event.ActionListener listener, javax.swing.JPanel mainPanel, javax.swing.JLabel label, javax.swing.JTextField imageName, java.lang.String tooltip, java.lang.String actionCommand, javax.swing.JPanel panelName)
-
-