Class JPanelDTIImportData

  • All Implemented Interfaces:
    AlgorithmInterface, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

    public class JPanelDTIImportData
    extends javax.swing.JPanel
    implements AlgorithmInterface, java.awt.event.ActionListener

    The copyright below only pertains to methods within JDialogImageInfo that relate to the Gradient Table Creator for Philips PAR/REC files V3/V4 that is displayed in the DTI tab. Portions of code that relate to this copyright are denoted with comments giving credit to software and authors.
     Copyright (c) 2011, Bennett Landman
     All rights reserved.
     Redistribution and use in source and binary forms, with or without 
     modification, are permitted provided that the following conditions are met:
     
          - Redistributions of source code must retain the above copyright 
            notice, this list of conditions and the following disclaimer.
            
          - Redistributions in binary form must reproduce the above copyright 
            notice, this list of conditions and the following disclaimer in the 
            documentation and/or other materials provided with the distribution.
            
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
     SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
     OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
     TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     
     
    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
      • 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)
      When Apply button is pressed, applies changes to all three areas: image name, resolutions, and transformation matrix.
      void algorithmPerformed​(AlgorithmBase algorithm)
      Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).
      void angulationCorrection​(double[][] tablein)  
      double[][] applyRotation​(double[][] A, double[][] table)  
      private java.util.HashMap<java.lang.String,​java.lang.Integer> buildParSliceMap()  
      private java.util.HashMap<java.lang.String,​java.lang.String> buildParVolMap()  
      private javax.swing.JPanel buildSaveGradBvalPanel()  
      private javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)  
      void checkSiemens3d()  
      private double cos​(double a)  
      boolean createBVGradBMatFileTXT()
      This method creates the B-Value/Gradient file for DTI Tab
      private void DWIJonesKirbyDialog()  
      static double[][] getHigh()  
      static double[][] getHighOP_24prev()  
      static double[][] getHighOP_25post()  
      static double[][] getHighOP_rel25()  
      private void getImageDTIParams()  
      static double[][] getJones30()  
      static double[][] getJones30VMS()  
      boolean getLastStackFlag()  
      static double[][] getLow()  
      static double[][] getLowOP()  
      static double[][] getLowOP2()  
      static double[][] getMedium()  
      static double[][] getMediumOP()  
      static double[][] getMediumOP2()  
      private void gradientTableCreator()  
      private javax.swing.border.TitledBorder highlightTitledBorder​(java.lang.String title)  
      void init()
      init
      void loadDWIFile()  
      void loadT2File()  
      double[][] matrixMultiply​(double[][] A, double[][] B)  
      void niftiParExtraction​(java.io.File parFileName)  
      private double[][] normalizeTable​(double[][] table)  
      private java.lang.String[] parse​(java.lang.String inString)
      DOCUMENT ME!
      void philipsDicomGradExtract()  
      boolean readBVGradBMatfile​(java.lang.String gradientFilePath)
      reads the bval/gradient file...dti studio format, BRUKER method, and fsl format are accepted
      private java.lang.String readLine​(java.io.RandomAccessFile raFile, boolean[] foundEOF)
      Reads lines of the file until a nonnull String results or the end of the file is reached.
      private double sin​(double a)  
      • 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
      • Methods inherited from class java.lang.Object

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

      • m_kDWIImage

        public ModelImage m_kDWIImage
        Diffusion Tensor image.
      • m_kT2Image

        public ModelImage m_kT2Image
        T2 image.
      • scrollPane

        public javax.swing.JScrollPane scrollPane
      • serif12

        private java.awt.Font serif12
      • outputTextArea

        private javax.swing.JTextArea outputTextArea
        TextArea of main dialogfor text output.*
      • srcBvalGradTable

        private javax.swing.JTable srcBvalGradTable
      • textDWIDataimage

        private javax.swing.JTextField textDWIDataimage
      • invertedBox

        private javax.swing.JComboBox invertedBox
        DOCUMENT ME!
      • fslButton

        javax.swing.JRadioButton fslButton
        Radio button to save gradBval text file in FSL format
      • dtiStudioButton

        javax.swing.JRadioButton dtiStudioButton
        Radio button to save gradBval text file in DTIStudio format
      • mipavStandardButton

        javax.swing.JRadioButton mipavStandardButton
        Radio button to save gradBval text file in mipavStandard format
      • filebvalGradTxtName

        java.lang.String filebvalGradTxtName
        bValGrad test file name from user
      • numVolumes

        private int numVolumes
        number of Volumes in DWI Image
      • gradBvalText

        private int gradBvalText
        int to determine which format user selects for gradBval test file
      • saveGradchooser

        private javax.swing.JFileChooser saveGradchooser
        chooser for save gradBval text dialog
      • srcTableModel

        public javax.swing.table.DefaultTableModel srcTableModel
        table model for the srcimages.
      • isDWICellEditBox

        private javax.swing.JCheckBox isDWICellEditBox
        DOCUMENT ME!
      • negXCheckBox

        private javax.swing.JCheckBox negXCheckBox
        DOCUMENT ME!
      • negYCheckBox

        private javax.swing.JCheckBox negYCheckBox
        DOCUMENT ME!
      • negZCheckBox

        private javax.swing.JCheckBox negZCheckBox
        DOCUMENT ME!
      • openedImageCheckBox

        private javax.swing.JCheckBox openedImageCheckBox
        DOCUMENT ME!
      • openDWIButton

        private javax.swing.JButton openDWIButton
        DOCUMENT ME!
      • useT2CheckBox

        public javax.swing.JCheckBox useT2CheckBox
        DOCUMENT ME!
      • t2FileLabel

        private javax.swing.JLabel t2FileLabel
        DOCUMENT ME!
      • bvalGradFileLabel

        private javax.swing.JLabel bvalGradFileLabel
        DOCUMENT ME!
      • textT2image

        private javax.swing.JTextField textT2image
        DOCUMENT ME!
      • textBvalGradFile

        private javax.swing.JTextField textBvalGradFile
        DOCUMENT ME!
      • openT2Button

        private javax.swing.JButton openT2Button
        DOCUMENT ME!
      • bvalGradAppButton

        private javax.swing.JButton bvalGradAppButton
        DOCUMENT ME!
      • isJonesBox

        private javax.swing.JCheckBox isJonesBox
        DOCUMENT ME!
      • isKirbyBox

        private javax.swing.JCheckBox isKirbyBox
        DOCUMENT ME!
      • fatshiftBox

        private javax.swing.JComboBox fatshiftBox
        DOCUMENT ME!
      • gradResBox

        private javax.swing.JComboBox gradResBox
        DOCUMENT ME!
      • gradOPBox

        private javax.swing.JComboBox gradOPBox
        DOCUMENT ME!
      • philRelBox

        private javax.swing.JComboBox philRelBox
        DOCUMENT ME!
      • patientPosBox

        private javax.swing.JComboBox patientPosBox
        DOCUMENT ME!
      • patientOrientBox

        private javax.swing.JComboBox patientOrientBox
        DOCUMENT ME!
      • foldOverBox

        private javax.swing.JComboBox foldOverBox
        DOCUMENT ME!
      • osBox

        private javax.swing.JComboBox osBox
        DOCUMENT ME!
      • gradCreatetable

        private double[][] gradCreatetable
        DOCUMENT ME!
      • angCorrGT

        private double[][] angCorrGT
        DOCUMENT ME!
      • rev_angCorrGT

        private double[][] rev_angCorrGT
        DOCUMENT ME!
      • space

        private java.lang.String space
        DOCUMENT ME!
      • osLabel

        private javax.swing.JLabel osLabel
        DOCUMENT ME!
      • invertedLabel

        private javax.swing.JLabel invertedLabel
        DOCUMENT ME!
      • gradResLabel

        private javax.swing.JLabel gradResLabel
        DOCUMENT ME!
      • gradOPLabel

        private javax.swing.JLabel gradOPLabel
        DOCUMENT ME!
      • fatShiftLabel

        private javax.swing.JLabel fatShiftLabel
        DOCUMENT ME!
      • patientPosLabel

        private javax.swing.JLabel patientPosLabel
        DOCUMENT ME!
      • patientOrientLabel

        private javax.swing.JLabel patientOrientLabel
        DOCUMENT ME!
      • foldOverLabel

        private javax.swing.JLabel foldOverLabel
        DOCUMENT ME!
      • philRelLabel

        private javax.swing.JLabel philRelLabel
        DOCUMENT ME!
      • currDir

        private java.lang.String currDir
        current directory *
      • lastStackFlag

        private boolean lastStackFlag
      • srcPanel

        private javax.swing.JPanel srcPanel
      • openImageNames

        java.util.Vector<java.lang.String> openImageNames
      • browseDWIButton

        private javax.swing.JRadioButton browseDWIButton
      • activeDWIButton

        private javax.swing.JRadioButton activeDWIButton
      • DWIOpenPanel

        private javax.swing.JPanel DWIOpenPanel
      • t2OpenPanel

        private javax.swing.JPanel t2OpenPanel
      • loadTable

        private javax.swing.JPanel loadTable
      • DWIButtonPanel

        private javax.swing.JPanel DWIButtonPanel
      • loadBValGradFileButton

        private javax.swing.JButton loadBValGradFileButton
      • clearDWITableButton

        private javax.swing.JButton clearDWITableButton
      • saveBvalGradButton

        private javax.swing.JButton saveBvalGradButton
      • sliceAng0

        private double sliceAng0
      • sliceAng1

        private double sliceAng1
      • sliceAng2

        private double sliceAng2
      • gradResWOP

        private java.lang.String gradResWOP
      • parNversion

        private java.lang.String parNversion
      • parNExamName

        private java.lang.String parNExamName
      • parNProtocolName

        private java.lang.String parNProtocolName
      • parNPatientPosition

        private java.lang.String parNPatientPosition
      • parNfoldover

        private java.lang.String parNfoldover
      • parNsliceAng

        private double[] parNsliceAng
      • parNoffCentre

        private double[] parNoffCentre
      • parNorient

        private int parNorient
      • isBmatFile

        private boolean isBmatFile
      • checkSiemens

        private boolean checkSiemens
      • gradientButton

        private javax.swing.JRadioButton gradientButton
      • BMatrixButton

        private javax.swing.JRadioButton BMatrixButton
    • Constructor Detail

      • JPanelDTIImportData

        public JPanelDTIImportData​(DTIPipeline pipeline)
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        When Apply button is pressed, applies changes to all three areas: image name, resolutions, and transformation matrix. When OK button is pressed, applies changes and closes dialog box. When Cancel button is pressed, closes dialog without making any additional changes.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        event - Event that triggers this function.
      • init

        public void init()
        init
      • getImageDTIParams

        private void getImageDTIParams()
      • buildTitledBorder

        private javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
      • highlightTitledBorder

        private javax.swing.border.TitledBorder highlightTitledBorder​(java.lang.String title)
      • buildSaveGradBvalPanel

        private javax.swing.JPanel buildSaveGradBvalPanel()
      • DWIJonesKirbyDialog

        private void DWIJonesKirbyDialog()
      • gradientTableCreator

        private void gradientTableCreator()
      • getLowOP

        public static final double[][] getLowOP()
      • getMediumOP

        public static final double[][] getMediumOP()
      • getLowOP2

        public static final double[][] getLowOP2()
      • getMediumOP2

        public static final double[][] getMediumOP2()
      • getHighOP_24prev

        public static final double[][] getHighOP_24prev()
      • getHighOP_rel25

        public static final double[][] getHighOP_rel25()
      • getHighOP_25post

        public static final double[][] getHighOP_25post()
      • getLow

        public static final double[][] getLow()
      • getMedium

        public static final double[][] getMedium()
      • getHigh

        public static final double[][] getHigh()
      • getJones30

        public static final double[][] getJones30()
      • getJones30VMS

        public static final double[][] getJones30VMS()
      • cos

        private double cos​(double a)
      • sin

        private double sin​(double a)
      • matrixMultiply

        public double[][] matrixMultiply​(double[][] A,
                                         double[][] B)
      • applyRotation

        public double[][] applyRotation​(double[][] A,
                                        double[][] table)
      • normalizeTable

        private double[][] normalizeTable​(double[][] table)
      • angulationCorrection

        public void angulationCorrection​(double[][] tablein)
      • loadDWIFile

        public void loadDWIFile()
      • niftiParExtraction

        public void niftiParExtraction​(java.io.File parFileName)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • philipsDicomGradExtract

        public void philipsDicomGradExtract()
      • checkSiemens3d

        public void checkSiemens3d()
      • loadT2File

        public void loadT2File()
      • getLastStackFlag

        public boolean getLastStackFlag()
      • readBVGradBMatfile

        public boolean readBVGradBMatfile​(java.lang.String gradientFilePath)
        reads the bval/gradient file...dti studio format, BRUKER method, and fsl format are accepted
        Parameters:
        gradientFilePath -
        Returns:
      • parse

        private java.lang.String[] parse​(java.lang.String inString)
        DOCUMENT ME!
        Parameters:
        inString - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • readLine

        private java.lang.String readLine​(java.io.RandomAccessFile raFile,
                                          boolean[] foundEOF)
                                   throws java.io.IOException
        Reads lines of the file until a nonnull String results or the end of the file is reached.
        Returns:
        the line read in
        Throws:
        java.io.IOException - if there is an error reading the file
      • createBVGradBMatFileTXT

        public boolean createBVGradBMatFileTXT()
        This method creates the B-Value/Gradient file for DTI Tab
        Returns:
      • buildParVolMap

        private java.util.HashMap<java.lang.String,​java.lang.String> buildParVolMap()
      • buildParSliceMap

        private java.util.HashMap<java.lang.String,​java.lang.Integer> buildParSliceMap()
      • algorithmPerformed

        public void algorithmPerformed​(AlgorithmBase algorithm)
        Description copied from interface: AlgorithmInterface
        Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.
        Specified by:
        algorithmPerformed in interface AlgorithmInterface
        Parameters:
        algorithm - the algorithm which has just completed