|
Size: 10983
Comment:
|
← Revision 23 as of 2015-01-22 12:59:17 ⇥
Size: 8850
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = Gradient Gradient Non-linearity Correction Software Package = | ## page was renamed from GradientUnwarping = Gradient Non-linearity Correction Software Package = |
| Line 4: | Line 5: |
''See also: GradientUnwarping'' |
|
| Line 12: | Line 15: |
| 7. Acknowledgements | |
| Line 15: | Line 17: |
| ==== Overview of distortion correction code =================== | == 1. Overview of distortion correction code == Goal:: To correct for image distortions in MRI data due to non-linearity of the magnetic fields from the imaging gradient coils. |
| Line 17: | Line 21: |
| "Goal:" To correct for image distortions in MRI data due to non-linearity of the magnetic fields from the imaging gradient coils. "Method:" Described in: Jovicich J, Czanner S, Greve D, Haley E, Kouwe A, Gollub R, Kennedy D, Schmitt F, Brown G, MacFall J, Fischl B, Dale A. Reliability in Multi-Site Structural MRI Studies: Effects of Gradient Non-linearity Correction on Phantom and Human Data. NeuroImage NeuroImage (Apr 1;30(2):436-43, 2006) |
Method:: Described in: Jovicich J, Czanner S, Greve D, Haley E, Kouwe A, Gollub R, Kennedy D, Schmitt F, Brown G, MacFall J, Fischl B, Dale A. Reliability in Multi-Site Structural MRI Studies: Effects of Gradient Non-linearity Correction on Phantom and Human Data. NeuroImage NeuroImage (Apr 1;30(2):436-43, 2006) |
| Line 23: | Line 25: |
| 1) Obtain from your local Siemens or GE vendor the spherical harmonics expansion that represents the gradient coils used in the MRI system you want to correct. This is a text file with proprietory information. |
1. Obtain from your local Siemens or GE vendor the spherical harmonics expansion that represents the gradient coils used in the MRI system you want to correct. This is a text file with proprietory information. |
| Line 27: | Line 27: |
| 2) We provide a script (gradient_unwarp_converter.pl ) that reads the spherical harmonics text file and writes out the coefficients in a standard format (for example, avanto.coef). |
2. We provide a script (gradient_unwarp_converter.pl ) that reads the spherical harmonics text file and writes out the coefficients in a standard format (for example, avanto.coef). |
| Line 31: | Line 29: |
| 3) We provide a script (create_displacement_table) that reads in the standard formatted coefficients (e.g., avanto.coef) of your system and writes out a file that has the tables for displacements along the x,y,z axes and also the intensity correction table due to voxel size distortion (e.g., avanto.gwv). |
3. We provide a script (create_displacement_table) that reads in the standard formatted coefficients (e.g., avanto.coef) of your system and writes out a file that has the tables for displacements along the x,y,z axes and also the intensity correction table due to voxel size distortion (e.g., avanto.gwv). |
| Line 36: | Line 31: |
| 4) We provide a script (grad_unwarp) that reads in the correction tables of your system and the dicom image volume you want to correct and writes out the distortion corrected dicom volume. For more details on other image formats see 'Use instructions'. |
4. We provide a script (grad_unwarp) that reads in the correction tables of your system and the dicom image volume you want to correct and writes out the distortion corrected dicom volume. For more details on other image formats see '''Use instructions'''. |
| Line 42: | Line 34: |
| ==== Limitations of the code ============================= | == 2. Limitations of the code == |
| Line 44: | Line 36: |
| - This distortion correction code has been tested on 3D structural images acquired on Siemens (Avanto, Sonata and Allegra gradients) and GE (CRM and BRM gradients) systems - This code consists of linux bash scripts that call matlab functions - This code has been developed for linux platforms and tested on RED HAT, Fedora Core 2 - This code needs a Matlab license and an Image Toolbox license. - This code has been tested on Matlab's version 7.0 (r14) - We are working on creating a c-version of the code |
* This distortion correction code has been tested on 3D structural images acquired on Siemens (Avanto, Sonata and Allegra gradients) and GE (CRM and BRM gradients) systems * This code consists of linux bash scripts that call matlab functions * This code has been developed for linux platforms and tested on RED HAT, Fedora Core 2 * This code needs a Matlab license and an Image Toolbox license. * This code has been tested on Matlab's version 7.0 (r14) * We are working on creating a c-version of the code |
| Line 53: | Line 43: |
| ==== Contents of distribution ============================= | == 3. Contents of distribution == |
| Line 58: | Line 46: |
| matlab // all matlab files scripts // grad_unwarp, create_displacement_table scripts grad_unwarp_tables // *.gvw files, table.mat, files contains the 1st harmonic coefficients sample_phantom_data // sample GE & Siemens phantom data, raw and distortion corrected bin // mri_convert - conversion utility for different data formats (DICOM, MGH, Analyze, COR, ...) |
|| matlab || all matlab files || || scripts || grad_unwarp, create_displacement_table scripts || || grad_unwarp_tables || *.gvw files, table.mat, files contains the 1st harmonic coefficients || || sample_phantom_data || sample GE & Siemens phantom data, raw and distortion corrected || || bin || mri_convert - conversion utility for different data formats (DICOM, MGH, Analyze, COR, ...) || |
| Line 63: | Line 52: |
| ===== Setting up local environment variables ============== | == 4. Setting up local environment variables == |
| Line 68: | Line 56: |
| Setup the environment variable GRAD_UNWARP_DIR to the grad_unwarp_bash directory. | Setup the environment variable '''GRAD_UNWARP_DIR''' to the grad_unwarp_bash directory. |
| Line 70: | Line 58: |
| setenv GRAD_UNWARP_DIR /my_home_directory_path/grad_unwarp_bash | ''setenv GRAD_UNWARP_DIR /my_home_directory_path/grad_unwarp_bash'' |
| Line 72: | Line 61: |
| Setup the variable MATLAB to the path of your matlab executable file | Setup the variable '''MATLAB''' to the path of your matlab executable file |
| Line 74: | Line 63: |
| setenv MATLAB /space/lyon/6/pubsw/common/matlab/7.0/bin/matlab | ''setenv MATLAB /space/lyon/6/pubsw/common/matlab/7.0/bin/matlab'' |
| Line 77: | Line 67: |
| alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp alias create_displacement_table $GRAD_UNWARP_DIR/scripts/create_displacement_table |
''alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp'' ''alias create_displacement_table $GRAD_UNWARP_DIR/scripts/create_displacement_table'' |
| Line 81: | Line 73: |
| grad_unwarp (or grad_unwarp -help) create_displacement_table (or create_displacement_table -help) |
''grad_unwarp (or grad_unwarp -help)'' ''create_displacement_table (or create_displacement_table -help)'' |
| Line 85: | Line 79: |
| ============= How to use it ===================== | == 5. How to use it == |
| Line 87: | Line 81: |
| Script gradient_unwarp_converter.pl is used to convert Siemens .grad or GE .dat to .coef, which is needed to create the displacement table. |
Script gradient_unwarp_converter.pl is used to convert Siemens .grad or GE .dat to .coef, which is needed to create the displacement table. |
| Line 90: | Line 83: |
| Usage: perl gradient_unwarp_converter.pl <filename> Examples: perl gradient_unwarp_converter.pl bay1-gw_coils.dat perl gradient_unwarp_converter.pl coeff_AS05.grad |
Usage:: perl gradient_unwarp_converter.pl <filename> Examples:: perl gradient_unwarp_converter.pl bay1-gw_coils.dat perl gradient_unwarp_converter.pl coeff_AS05.grad |
| Line 99: | Line 92: |
| Usage: create_displacement_table vendor table_name Example: create_displacement_table siemens sonata create_displacement_table ge crm |
Usage:: create_displacement_table vendor table_name Example:: create_displacement_table siemens sonata create_displacement_table ge crm |
| Line 110: | Line 103: |
| alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp grad_unwarp |
''alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp'' ''grad_unwarp'' |
| Line 115: | Line 108: |
| grad_unwarp -help | ''grad_unwarp -help'' |
| Line 120: | Line 113: |
| $GRAD_UNWARP_DIR/sample_phantom_data $GRAD_UNWARP_DIR/sample_phantom_data/dicom_BRM_ucsd |
''$GRAD_UNWARP_DIR/sample_phantom_data'' ''$GRAD_UNWARP_DIR/sample_phantom_data/dicom_BRM_ucsd'' |
| Line 124: | Line 117: |
| ==================== H E L P ========================= | === H E L P === |
| Line 126: | Line 119: |
| grad_unwarp is an unwarping tool. It provides a full 3D unwarping for data from Siemens devices. For data from GE devices there is an assumption that these data are already in-plane dewarped. |
grad_unwarp is an unwarping tool. It provides a full 3D unwarping for data from Siemens devices. For data from GE devices there is an assumption that these data are already in-plane dewarped. |
| Line 130: | Line 121: |
| There are four gradient-coil types supported at the moment: GE BRM, GE CRM, Siemens Sonata/Trio, Siemens Avanto, Siemens Allegra. For each of these, there is a large file somewhere that is an offsets table - for outvol voxel here, look there in invol. Interpolation in the offsets table is trilinear; interpolation in the input volume may be specified by the user with -interp foo. Default is cubic. |
There are four gradient-coil types supported at the moment: GE BRM, GE CRM, Siemens Sonata/Trio, Siemens Avanto, Siemens Allegra. For each of these, there is a large file somewhere that is an offsets table - for outvol voxel here, look there in invol. Interpolation in the offsets table is trilinear; interpolation in the input volume may be specified by the user with -interp foo. Default is cubic. |
| Line 139: | Line 126: |
| (1) If you are using dicom files from a machine we have have specification information on, no type need be supplied: grad_unwarp works it out from the dicom headers. For Siemens, it is sufficient to find ManufacturersModelName 'sonata' or 'avanto' in the headers. For GE, unfortunately, there is no such notation about gradient system in the dicom headers, so we resort to ScannerSerialNumber. This is often not set, so we check the (InstitutionName, StationName) pair. |
1 If you are using dicom files from a machine we have have specification information on, no type need be supplied: grad_unwarp works it out from the dicom headers. For Siemens, it is sufficient to find ManufacturersModelName 'sonata' or 'avanto' in the headers. For GE, unfortunately, there is no such notation about gradient system in the dicom headers, so we resort to ScannerSerialNumber. This is often not set, so we check the (InstitutionName, StationName) pair. |
| Line 147: | Line 128: |
| For dewarping an mgh volume, the user must always specify an unwarp <type>. |
For dewarping an mgh volume, the user must always specify an unwarp <type>. |
| Line 150: | Line 130: |
| (2) FYI, one may also supply a full pathname to some offsets file of choice. |
2 FYI, one may also supply a full pathname to some offsets file of choice. |
| Line 153: | Line 132: |
| (3) The specifically-supported choices are 'sonata' 'avanto' 'brm' and 'crm' (case insensitive). The 1.5T GE scanner at UCSD has the BRM gradient coil. The 1.5T GE scanners at BWH, Duke and MGH-Bay1 have CRM. MGH-Bay2 is a Avanto. |
3 The specifically-supported choices are 'sonata' 'avanto' 'allegra' 'brm' and 'crm' (case insensitive). The 1.5T GE scanner at UCSD has the BRM gradient coil. The 1.5T GE scanners at BWH, Duke and MGH-Bay1 have CRM. MGH-Bay2 is a Avanto. |
| Line 158: | Line 134: |
| A jacobian brightness correction is applied by default - areas of the image that spread out (increase in volume) should dim (decrease in intensity). If for some reason you wish to skip that step, use the -nojac option. |
A jacobian brightness correction is applied by default - areas of the image that spread out (increase in volume) should dim (decrease in intensity). If for some reason you wish to skip that step, use the -nojac option. |
| Line 164: | Line 137: |
| ======= E X A M P L E S ================================================= | === E X A M P L E S === |
| Line 166: | Line 139: |
| grad_unwarp -i avanto.mgh -o avanto_uw.mgh -unwarp avanto | ''grad_unwarp -i avanto.mgh -o avanto_uw.mgh -unwarp avanto'' |
| Line 168: | Line 141: |
| it will read data stored in avanto.mgh and produce a new dewarped data file avanto_uw.mgh The dewarping will be done based on displacement table stored in file avanto.gvw |
it will read data stored in avanto.mgh and produce a new dewarped data file avanto_uw.mgh . The dewarping will be done based on displacement table stored in file avanto.gvw |
| Line 171: | Line 143: |
| grad_unwarp -i dicom_BRM_ucsd/001.dcm -s 6 -o brm_ucsd_uw.mgh -unwarp brm | ''grad_unwarp -i dicom_BRM_ucsd/001.dcm -s 6 -o brm_ucsd_uw.mgh -unwarp brm'' |
| Line 173: | Line 145: |
| it will read the data from DICOM file, serie #6 from directory dicom_BRM_ucsd/, dewarp it and create new data file brm_ucsd_uw.mgh in MGH format |
it will read the data from DICOM file, serie #6 from directory dicom_BRM_ucsd/, dewarp it and create new data file brm_ucsd_uw.mgh in MGH format === MGH data file Viewer === |
| Line 176: | Line 149: |
| ============== FORMAT CONVERSION UTILITY ================================ | There is a simple MGH/MGZ/DICOM data file viewer written in matlab. To use it, you have to run matlab, add new path $GRAD_UNWARP_DIR/matlab and type mgh_viewer in matlab's command window. It will create and open an User interface. |
| Line 178: | Line 151: |
| mri_convert is a utility used for a conversion between different volume formats. | * To load a MGH/MGZ/DICOM file press button LOAD VOLUME * To change a view press one of the buttons SAGITAL, CORONAL and AXIAL * To move through the volume by slices use slider Slice #. * To change the brightmess and contrast use sliders Window and Level. * To quit the Program press button Quit |
| Line 180: | Line 157: |
| Usage: mri_convert [options] <in volume> <out volume> To see all options type: alias mri_convert $GRAD_UNWARP_DIR/bin/Linux/mri_convert mri_convert The input and output file type can be specified in two ways. First, mri_convert will try to figure it out on its own from the format of the file name (eg, files that end in .img are assumed to be in spm analyze format). Second, the user can explicity set the type of file using --in_type and/or --out_type. Legal values for --in_type (-it) and --out_type (-ot) are: cor - MGH-NMR COR format minc - MNI's Medical Imaging NetCDF format (output may not work) analyze - 3D analyze (same as spm) analyze4d - 4D analyze spm - SPM Analyze format (same as analyze and analyze3d) ge - GE Genesis format (input only) gelx - GE LX (input only) lx - same as gelx ximg - GE XIMG variant (input only) siemens - Siemens IMA (input only) dicom - generic DICOM Format (input only) siemens_dicom - Siemens DICOM Format (input only) afni - AFNI format brik - same as afni bshort - MGH-NMR bshort format bfloat - MGH-NMR bfloat format sdt - Varian (?) outline - MGH-NMR Outline format otl - same as outline gdf - GDF volume (requires image stem for output; use -gis) nifti1 - NIfTI-1 volume (separate image and header files) nii - NIfTI-1 volume (single file) Examples: mri_convert -i avanto.mgh -o avanto.img mri_convert -i avanto.mgh -ot COR -o avanto_COR/ mri_convert -i dicom_BRM_ucsd/001.dcm -it dicom -o brm_ucsd.mgh ============== MGH data file Viewer ================================ There is a simple MGH/MGZ/DICOM data file viewer written in matlab. To use it, you have to run matlab, add new path $GRAD_UNWARP_DIR/matlab and type mgh_viewer in matlab's command window. It will create and open an User interface. To load a MGH/MGZ/DICOM file press button LOAD VOLUME To change a view press one of the buttons SAGITAL, CORONAL and AXIAL To move through the volume by slices use slider Slice #. To change the brightmess and contrast use sliders Window and Level. To quit the Program press button Quit ==== Support and contacts =============================================== |
== 6. Support and contacts == |
| Line 245: | Line 162: |
Gradient Non-linearity Correction Software Package
Author: Silvester Czanner (see also: SilvesterNotes)
See also: GradientUnwarping
- Overview of distortion correction code
- Limitations of the code
- Contents in distribution
- Setting up local environment variables for use
- Use instructions
- Support and contacts
1. Overview of distortion correction code
- Goal
- To correct for image distortions in MRI data due to non-linearity of the magnetic fields from the imaging gradient coils.
- Method
Described in: Jovicich J, Czanner S, Greve D, Haley E, Kouwe A, Gollub R, Kennedy D, Schmitt F, Brown G, MacFall J, Fischl B, Dale A. Reliability in Multi-Site Structural MRI Studies: Effects of Gradient Non-linearity Correction on Phantom and Human Data. NeuroImage NeuroImage (Apr 1;30(2):436-43, 2006)
Outline of steps involved:
- Obtain from your local Siemens or GE vendor the spherical harmonics expansion that represents the gradient coils used in the MRI system you want to correct. This is a text file with proprietory information.
- We provide a script (gradient_unwarp_converter.pl ) that reads the spherical harmonics text file and writes out the coefficients in a standard format (for example, avanto.coef).
- We provide a script (create_displacement_table) that reads in the standard formatted coefficients (e.g., avanto.coef) of your system and writes out a file that has the tables for displacements along the x,y,z axes and also the intensity correction table due to voxel size distortion (e.g., avanto.gwv).
We provide a script (grad_unwarp) that reads in the correction tables of your system and the dicom image volume you want to correct and writes out the distortion corrected dicom volume. For more details on other image formats see Use instructions.
2. Limitations of the code
- This distortion correction code has been tested on 3D structural images acquired on Siemens (Avanto, Sonata and Allegra gradients) and GE (CRM and BRM gradients) systems
- This code consists of linux bash scripts that call matlab functions
- This code has been developed for linux platforms and tested on RED HAT, Fedora Core 2
- This code needs a Matlab license and an Image Toolbox license.
- This code has been tested on Matlab's version 7.0 (r14)
- We are working on creating a c-version of the code
3. Contents of distribution
The whole distribution package contains 5 subdirectories:
matlab
all matlab files
scripts
grad_unwarp, create_displacement_table scripts
grad_unwarp_tables
*.gvw files, table.mat, files contains the 1st harmonic coefficients
sample_phantom_data
sample GE & Siemens phantom data, raw and distortion corrected
bin
mri_convert - conversion utility for different data formats (DICOM, MGH, Analyze, COR, ...)
4. Setting up local environment variables
You need to set up the following two variables:
Setup the environment variable GRAD_UNWARP_DIR to the grad_unwarp_bash directory. For example:
setenv GRAD_UNWARP_DIR /my_home_directory_path/grad_unwarp_bash
Setup the variable MATLAB to the path of your matlab executable file For example:
setenv MATLAB /space/lyon/6/pubsw/common/matlab/7.0/bin/matlab
With these environments you can define aliases to run the scripts:
alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp
alias create_displacement_table $GRAD_UNWARP_DIR/scripts/create_displacement_table
And then just run the scripts by typing:
grad_unwarp (or grad_unwarp -help)
create_displacement_table (or create_displacement_table -help)
5. How to use it
Script gradient_unwarp_converter.pl is used to convert Siemens .grad or GE .dat to .coef, which is needed to create the displacement table.
- Usage
perl gradient_unwarp_converter.pl <filename>
- Examples
- perl gradient_unwarp_converter.pl bay1-gw_coils.dat
- perl gradient_unwarp_converter.pl coeff_AS05.grad
Script create_displacement_table is used to create a displacement table (*.gwv). It has 2 parameters: vendor and table name. Supported vendor names are siemens and ge. Allowed table names are avanto, sonata, brm, crm. Meaningful combinations are siemens (avanto or sonata), ge (brm or crm)
- Usage
- create_displacement_table vendor table_name
- Example
- create_displacement_table siemens sonata
- create_displacement_table ge crm
Script is reading file with the 1st harmonic coefficients (*.coef) from $GRAD_UNWARP_DIR/grad_unwarp_tables and calculates the displacement table. The table is saved into $GRAD_UNWARP_DIR/grad_unwarp_tables directory.
Script grad_unwarp is used to unwarp the warped raw images produced by scanner devices. It uses several options. If you are not sure about the options, just type
alias grad_unwarp $GRAD_UNWARP_DIR/scripts/grad_unwarp grad_unwarp
or
grad_unwarp -help
Grad_unwarp script has been tested with avanto, sonata, brm and crm MGH phantom files and with brm dicom files (series #6). You can find the testing data files in
$GRAD_UNWARP_DIR/sample_phantom_data $GRAD_UNWARP_DIR/sample_phantom_data/dicom_BRM_ucsd
H E L P
grad_unwarp is an unwarping tool. It provides a full 3D unwarping for data from Siemens devices. For data from GE devices there is an assumption that these data are already in-plane dewarped.
There are four gradient-coil types supported at the moment: GE BRM, GE CRM, Siemens Sonata/Trio, Siemens Avanto, Siemens Allegra. For each of these, there is a large file somewhere that is an offsets table - for outvol voxel here, look there in invol. Interpolation in the offsets table is trilinear; interpolation in the input volume may be specified by the user with -interp foo. Default is cubic.
There are three ways to use the grad_unwarp flag -unwarp <type>.
1 If you are using dicom files from a machine we have have specification information on, no type need be supplied: grad_unwarp works it out from the dicom headers. For Siemens, it is sufficient to find ManufacturersModelName 'sonata' or 'avanto' in the headers. For GE, unfortunately, there is no such notation about gradient system in the dicom headers, so we resort to ScannerSerialNumber. This is often not set, so we check the (InstitutionName, StationName) pair.
For dewarping an mgh volume, the user must always specify an unwarp <type>.
A jacobian brightness correction is applied by default - areas of the image that spread out (increase in volume) should dim (decrease in intensity). If for some reason you wish to skip that step, use the -nojac option.
E X A M P L E S
grad_unwarp -i avanto.mgh -o avanto_uw.mgh -unwarp avanto
it will read data stored in avanto.mgh and produce a new dewarped data file avanto_uw.mgh . The dewarping will be done based on displacement table stored in file avanto.gvw
grad_unwarp -i dicom_BRM_ucsd/001.dcm -s 6 -o brm_ucsd_uw.mgh -unwarp brm
it will read the data from DICOM file, serie #6 from directory dicom_BRM_ucsd/, dewarp it and create new data file brm_ucsd_uw.mgh in MGH format
MGH data file Viewer
There is a simple MGH/MGZ/DICOM data file viewer written in matlab. To use it, you have to run matlab, add new path $GRAD_UNWARP_DIR/matlab and type mgh_viewer in matlab's command window. It will create and open an User interface.
- To load a MGH/MGZ/DICOM file press button LOAD VOLUME
- To change a view press one of the buttons SAGITAL, CORONAL and AXIAL
- To move through the volume by slices use slider Slice #.
- To change the brightmess and contrast use sliders Window and Level.
- To quit the Program press button Quit
6. Support and contacts
Support is very limited but we will do our best to try to answer your questions. Please email your constructive comments to:
Silvester Czanner (czanner@nmr.mgh.harvard.edu)
