This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

MRI phase Processing

Tutorials about processing MRI phase

1 - Quantitative Susceptibility Mapping

Example workflow for Quantitative Susceptibility Mapping

This tutorial was created by Steffen Bollmann and Ashley Stewart.

Github: @stebo85; @astewartau Web: Twitter: @sbollmann_MRI

Quantitative Susceptibility Mapping in Neurodesk with QSMxT

Neurodesk provides QSMxT, an end-to-end pipeline that automates the reconstruction, segmentation and analysis of QSM data across large groups of participants, from scanner images (DICOMs) through to susceptibility maps and quantitative outputs.

QSMxT provides pipelines implemented in Python that:

  1. Automatically convert unorganised DICOM or NIfTI data to the Brain Imaging Data Structure (BIDS)
  2. Automatically reconstruct QSM, including steps for:
    1. Masking
    2. Phase unwrapping
    3. Background field removal
    4. Dipole inversion
    5. Multi-echo combination
  3. Automatically generate a common group space for the cohort, as well as average magnitude and QSM images that facilitate group-level analyses.
  4. Automatically segment T1w data and register them to the QSM space to extract quantitative values in anatomical regions of interest.
  5. Export quantitative data to CSV for all subjects using the automated segmentations, or a custom segmentation in the group space (we recommend ITK-SNAP to perform manual segmenations).

For a list of algorithms QSMxT uses, see the Reference List on the GitHub page.

Open QSMxT

Start QSMxT v1.3.3 from the applications menu in the desktop (Neurodesk > Quantitative Imaging > qsmxt)

Download test DICOMs

Start by downloading the test DICOM data we provide for QSMxT:

osf -p ru43c clone qsmxt-demo
unzip qsmxt-demo/osfstorage/GRE_2subj_1mm_TE20ms/sub1/ -d qsmxt-demo/0_dicoms
unzip qsmxt-demo/osfstorage/GRE_2subj_1mm_TE20ms/sub1/ -d qsmxt-demo/0_dicoms
unzip qsmxt-demo/osfstorage/GRE_2subj_1mm_TE20ms/sub2/ -d qsmxt-demo/0_dicoms
unzip qsmxt-demo/osfstorage/GRE_2subj_1mm_TE20ms/sub2/ -d qsmxt-demo/0_dicoms

Convert DICOMs to BIDS

Next, we need to sort the DICOMs into the structure QSMxT expects (by subject, session, and series), and then convert to the Brain Imaging Data Structure (BIDS) by running the following:

cd qsmxt-demo 0_dicoms 1_dicoms_sorted 1_dicoms_sorted 2_bids

The conversion to BIDS will prompt you to enter which sequence matches your QSM data. For the demo data, you can simply enter 1 when prompted:

Enter ‘1’ when prompted for the acquisition relevant for QSM

The demo data comes without a structural scan (automatically recognised if t1w is in the protocol name.

Run QSM pipeline

Finally, we can run the QSM pipeline using: 2_bids 3_qsm

You will first be prompted to choose an initial premade pipeline. Simply press ENTER to use the default pipeline, or choose one of the other premade pipelines (e.g. fast for QSMxT’s fastest reconstruction pipeline):

QSMxT prompts the user to select a pipeline

QSMxT then allows you to adjust any relevant reconstruction settings. The defaults should be fine for this data, so simply enter ‘run’:

QSMxT prompts the user to adjust any settings

The reconstruction may take some time, though QSMxT will attempt to run various processes in parallel wherever possible.

View QSM results

When the processing is finished, you can open a viewer (Visualization -> mricrogl -> mricroglGUI) and you can find the QSM outputs in /neurodesktop-storage/qsmxt-demo/3_qsm:

QSM results in a medical image viewer

Please note that the demo dataset does not have a T1w scan for anatomical segmentation, and therefore the subsequent steps in QSMxT (e.g. 2_bids 4_segmentation) will NOT work.

2 - SWI

Example workflow for SWI processing

This tutorial was created by Steffen Bollmann.

Github: @stebo85 Web: Twitter: @sbollmann_MRI

Download demo data

Open a terminal and run:

pip install osfclient
cd /neurodesktop-storage/
osf -p ru43c fetch /neurodesktop-storage/swi-demo/

unzip /neurodesktop-storage/swi-demo/ -d /neurodesktop-storage/swi-demo/

Open the CLEARSWI tool from the application menu:

paste this julia script in a julia file and execute:

cd /neurodesktop-storage/
vi clearswi.jl

hit a or i and then paste this:


TEs = [20] 
nifti_folder = "/neurodesktop-storage/swi-demo/01_bids/sub-170705134431std1312211075243167001/ses-1/anat"
magfile = joinpath(nifti_folder, "sub-170705134431std1312211075243167001_ses-1_acq-qsm_run-1_magnitude.nii.gz")
phasefile = joinpath(nifti_folder, "sub-170705134431std1312211075243167001_ses-1_acq-qsmPH00_run-1_phase.nii.gz") 

mag = readmag(magfile);
phase = readphase(phasefile);
data = Data(mag, phase, mag.header, TEs);

swi = calculateSWI(data);
# mip = createIntensityProjection(swi, minimum); # minimum intensity projection, other Julia functions can be used instead of minimum
mip = createMIP(swi); # shorthand for createIntensityProjection(swi, minimum)

savenii(swi, "/neurodesktop-storage/swi-demo/swi.nii"; header=mag.header) 
savenii(mip, "/neurodesktop-storage/swi-demo/mip.nii"; header=mag.header)

hit SHIFT-Z-Z and run:

julia clearswi.jl

Open ITK snap from the Visualization Application’s menu and inspect the results (the outputs are in swi-demo/swi.nii and mip.nii) image

3 - Unwrapping

MRI Phase Unwrapping

This tutorial was created by Steffen Bollmann.

Github: @stebo85 Web: Twitter: @sbollmann_MRI

Download demo data

Open a terminal and run:

pip install osfclient
cd /neurodesktop-storage/
osf -p ru43c fetch /neurodesktop-storage/swi-demo/

unzip /neurodesktop-storage/swi-demo/ -d /neurodesktop-storage/swi-demo/

mkdir /neurodesktop-storage/romeo-demo/

cp /neurodesktop-storage/swi-demo/01_bids/sub-170705134431std1312211075243167001/ses-1/anat/sub-170705134431std1312211075243167001_ses-1_acq-qsmPH00_run-1_phase.nii.gz /neurodesktop-storage/romeo-demo/phase.nii.gz

cp /neurodesktop-storage/swi-demo/01_bids/sub-170705134431std1312211075243167001/ses-1/anat/sub-170705134431std1312211075243167001_ses-1_acq-qsm_run-1_magnitude.nii.gz /neurodesktop-storage/romeo-demo/mag.nii.gz

gunzip /neurodesktop-storage/romeo-demo/mag.nii.gz
gunzip /neurodesktop-storage/romeo-demo/phase.nii.gz

Using ROMEO for phase unwrapping

Open the ROMEO tool from the application menu and run:

romeo -p /neurodesktop-storage/romeo-demo/phase.nii -m /neurodesktop-storage/romeo-demo/mag.nii -k nomask -o /neurodesktop-storage/romeo-demo/