From CNI Wiki
Most data processing is done in individual laboratories and tailored to specific data sets. There are certain general processing methods that are provided by the CNI staff. These methods are intended to improve the quality of specific data acquired with certain protocols (EPI, Spiral, Diffusion) within the CNI facility. This Data Processing page first defines these CNI-specific methods. This is followed by links to external sites either at Stanford or elsewhere that offer software for processing MRI and EEG data.
- 1 CNI Data Information
- 2 CNI Data processing
- 3 MRI data processing resources
- 4 EEG data processing resources
CNI Data Information
Many labs at CNI use a gradient-echo EPI sequence for BOLD fMRI imaging. This sequence is a modified version of the stock EPI sequence provided by GE. Some useful information about his sequence:
- The latest version is cni_epi_2201. Be sure that your PSD field shows this.
- Slice order: The slices are acquired interleaved by default, with odd slices first, then even slices. (Kendrick Kay from the Wandell lab has confirmed this empirically.) Be sure to take this into account when doing slice timing correction. You can use the "TriggerTime" field in the DICOM head to confirm the slice acquisition timing. Also note that the time points at which slices are acquired are equally spaced within the TR.
- Triggering: There is a UserCV to control the acquisition trigger. You can have no special triggering (scan starts when you hit 'scan'), external trigger to start the scan (see MR Hardware#Scan Triggers for details), or cardiac gating.
- Image reconstruction size: By default, the images are reconstructed at the native image size instead of being zero-padded up to the next higher power of two. This results in faster recons, smaller files, and no image interpolation, so it is generally preferred. But, if you want -power-of-two image sizes, you can change this UserCV to get that behavior.
Arterial-Spin Labeling (ASL)
CNI Data processing
Field map estimation
All MR data is subject to distortions arising from imperfections in the mean magnetic field (B0). All centers make an effort to correct for these imperfections. The CNI community is developing methods to assess the field map imperfections during the measurement process and corresponding pre-processing software that corrects for these imperfections during the reconstruction process.
Gradient-reversal Unwarping ('pepolar')
Some of the CNI pulse sequences support reversing the gradient read-out direction (GE calls this 'pepolar' for 'phase-encode polarity'). If you acquire fMRI or diffusion data with one pepolar direction (e.g., pepolar=0, the default readout direction) and another dataset with the reversed direction (e.g., pepolar=1), then you can use the two sets of images to estimate the fieldmap and unwarp the data. For our multiband ('mux', aka SMS-EPI) pulse sequences, the gradient read-out direction can be set as a user CV.
To unwarp the data, we suggest that you use the FSL topup tools. For fMRI data, you will do something like this:
echo '0 1 0 [etl]' > acq_params.txt echo '0 -1 0 [etl]' >> acq_params.txt # To compute the etl (echo train length), run: # fslhd rs_pe0.nii.gz | grep desc # and compute acq*ec/1000 fsl5.0-fslroi rs_pe0.nii.gz bu 1 1 fsl5.0-fslroi rs_pe1.nii.gz bd 1 1 fsl5.0-fslmerge -t bud bu bd fsl5.0-topup --imain=bud --datain=acq_params.txt --config=b02b0.cnf --out=rs_topup fsl5.0-applytopup --imain=rs_pe0 --inindex=1 --method=jac --datain=acq_params.txt --topup=rs_topup --out=rs0_unwarped fsl5.0-applytopup --imain=rs_pe1 --inindex=2 --method=jac --datain=acq_params.txt --topup=rs_topup --out=rs1_unwarped
For diffusion data, have a look at this code: https://github.com/cni/nims/blob/master/scripts/pepolar_unwarp.py
If you need to add a slice (topup requires even numbers for x, y and z), the run this before running the lines above:
mv rs_pe0.nii.gz rs_pe0_ORIG.nii.gz mv rs_pe1.nii.gz rs_pe1_ORIG.nii.gz fsl5.0-fslroi rs_pe0.nii.gz /tmp/pe0 0 -1 0 -1 0 1 0 -1 fsl5.0-fslroi rs_pe1.nii.gz /tmp/pe1 0 -1 0 -1 0 1 0 -1 fsl5.0-fslmerge -z rs_pe1 /tmp/pe1 rs_pe1_ORIG.nii.gz fsl5.0-fslmerge -z rs_pe0 /tmp/pe0 rs_pe0_ORIG.nii.gz
Then, after topup finishes, you can remove the extra slice:
fsl5.0-fslroi rs_pe0_unwarped.nii.gz rs_pe0_unwarped_resize.nii.gz 0 -1 0 -1 1 -1 0 -1 fsl5.0-fslroi rs_pe1_unwarped.nii.gz rs_pe1_unwarped_resize.nii.gz 0 -1 0 -1 1 -1 0 -1
Complete procedure for mux qT1 data:
fslroi 9619_22_pe1.nii.gz /tmp/pe1 0 -1 0 -1 0 1 0 -1 fslroi 9619_23_pe0.nii.gz /tmp/pe0 0 -1 0 -1 0 1 0 -1 fslmerge -z pe1 /tmp/pe1.nii.gz 9619_22_pe1.nii.gz fslmerge -z pe0 /tmp/pe0.nii.gz 9619_23_pe0.nii.gz fslroi pe0 bu 1 1 fslroi pe1 bd 1 1 fslmerge -t bud bu bd topup --imain=bud --datain=acq_params.txt --config=b02b0.cnf --out=topup applytopup --imain=pe0 --inindex=1 --method=jac --datain=acq_params.txt --topup=topup --out=pe0_unwarped applytopup --imain=pe1 --inindex=2 --method=jac --datain=acq_params.txt --topup=topup --out=pe1_unwarped fslmaths pe0_unwarped.nii.gz -add pe1_unwarped.nii.gz /tmp/unwarped fslroi /tmp/unwarped.nii.gz unwarped 0 -1 0 -1 1 -1 0 -1 bet unwarped.nii.gz brain -m ~/git/t1fit/t1_fitter.py -u -t 30 -m brain_mask.nii.gz unwarped.nii.gz qt1
MRI data processing resources
CNI LX Containers (virtual machines)
The Wandell lab wiki describes a large collection of software for processing and visualizing anatomical, functional, and diffusion-weighted MR data.
Other lab sites could to be listed here.
Some online analysis notes for the Phillips lab.
Notes for the CHIMe lab.
EEG data processing resources
Something about the Norcia lab here.
MATLAB based: SPM, EEGLAB