Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
mrtools:layeranalysis [2020/05/12 17:28]
eli
mrtools:layeranalysis [2020/05/12 18:07] (current)
eli
Line 1: Line 1:
 ====== Layer fMRI and VASO Tutorial ====== ====== Layer fMRI and VASO Tutorial ======
  
-This tutorial explains how to do layer fMRI analysis using mrTools. Much of this pipeline was developed by Renzo Huber and is described on his [[https://​layerfmri.com/​|blog]],​ though ​many steps have been adapted to mrTools. A number of software packages are required in addition to mrTools, including [[https://​fsl.fmrib.ox.ac.uk/​fsl/​fslwiki/​FSLeyes|FSLeyes]],​ [[http://​stnava.github.io/​ANTs/​| ANTs]], [[http://​www.itksnap.org/​pmwiki/​pmwiki.php | itk-SNAP]], and [[https://​github.com/​layerfMRI/​LAYNII | LAYNII]], and my layer analysis [[https://​github.com/​elimerriam/​mlrLayertools | github repository]]. ​+This tutorial explains how to do layer fMRI analysis using mrTools. Much of this pipeline was developed by Renzo Huber and is described on his [[https://​layerfmri.com/​|blog]],​ though ​several ​steps have been adapted to mrTools. A number of software packages are required in addition to mrTools, including [[https://​fsl.fmrib.ox.ac.uk/​fsl/​fslwiki/​FSLeyes|FSLeyes]],​ [[http://​stnava.github.io/​ANTs/​| ANTs]], [[http://​www.itksnap.org/​pmwiki/​pmwiki.php | itk-SNAP]], and [[https://​github.com/​layerfMRI/​LAYNII | LAYNII]], and Eli'​s ​layer analysis ​MLR functions ​[[https://​github.com/​elimerriam/​mlrLayertools | github repository]]. ​
  
 ===== Overview ===== ===== Overview =====
Line 16: Line 16:
 == 1.1 Motion correction for VASO data == == 1.1 Motion correction for VASO data ==
  
-I have been using standard mrTools motionComp, with the tSmooth option set to 2. This flag averages n frames before and after the current image that is being registered. I think this helps with VASO registration for the following reason. The alternating images of nulled and not-nulled contrast have slightly different spatial profiles of image intensity. If you register each frame independently (without averaging), a slightly different transform is computed for nulled and not-nulled images. So, if you don't set the tSmooth flag, the resulting motionComp transforms have an alternating sawtooth pattern - that is bad. I also recommend using '​cubic'​ interpolation,​ which blurs the data less than the standard '​linear'​ option. Renzo has an entire [[https://​layerfmri.com/​2019/​03/​22/​analysispipeline/​|blog post]] on motion correction.+I have been using standard mrTools motionComp, with the tSmooth option set to 2. This flag averages n frames before and after the frame that is being registered. I think this helps with VASO registration for the following reason. The alternating images of nulled and not-nulled contrast have slightly different spatial profiles of image intensity. If you register each frame independently ​to a base image (without averaging), a slightly different transform is computed for nulled and not-nulled images. So, if you don't set the tSmooth flag, the resulting motionComp transforms have an alternating sawtooth pattern - that is bad. Setting tSmooth seems to fix this. I also recommend using '​cubic'​ interpolation,​ which blurs the data less than the standard '​linear'​ option. Renzo has an entire [[https://​layerfmri.com/​2019/​03/​22/​analysispipeline/​|blog post]] on motion correction ​for VASO.
  
 == 1.2 Computing VASO contrast from not-nulled (BOLD) and blood-nulled images ==  == 1.2 Computing VASO contrast from not-nulled (BOLD) and blood-nulled images == 
  
-The time series in a VASO scan consists of alternating images of BOLD and blood-nulled contrast. VASO is computed by dividing the blood-nulled images by the BOLD images. The result is a measure of cerebral blood volume, and is a negative contrast (more negative means larger response). The matlab function '​computeVaso'​ takes each scan in the MotionComp group in mrLoadRet, separates the BOLD and nulled images, temporally upsamples them to be on the same temporal grid, divides one by the other, creates two new MLR groups ('​Bold'​ and '​Vaso'​) and saves out the appropriate tSeries files to each group. ​  ​+The time series in a VASO scan consists of alternating images of BOLD and blood-nulled contrast. VASO is computed by dividing the blood-nulled images by the BOLD images. The result is a measure of cerebral blood volume, and is a negative contrast (more negative means larger response). The matlab function '​computeVaso'​ takes each scan in the MotionComp group in mrLoadRet, separates the BOLD and nulled images, temporally upsamples them to be on the same temporal grid, divides one by the other, creates two new MLR groups ('​Bold'​ and '​Vaso'​) and saves out the appropriate tSeries files to each group.
  
 <​code>​ >> computeVaso</​code>​ <​code>​ >> computeVaso</​code>​
Line 34: Line 34:
 We typically collect multiple "in plane" MP2RAGE T1-weighted anatomical scans in the same session as the VASO data. These are typically 0.5x0.5x0.5 mm, and have the same slice angle and field of view as the VASO scans. Even though we are going to use the vasoAnat to draw the layer boundaries, this MP2RAGE scan is useful for guiding layer definition, and estimating the location of the stria of genarri. ​ We typically collect multiple "in plane" MP2RAGE T1-weighted anatomical scans in the same session as the VASO data. These are typically 0.5x0.5x0.5 mm, and have the same slice angle and field of view as the VASO scans. Even though we are going to use the vasoAnat to draw the layer boundaries, this MP2RAGE scan is useful for guiding layer definition, and estimating the location of the stria of genarri. ​
  
-These are high res anatomical images are processed in four steps using [[http://​stnava.github.io/​ANTs/​ | ANTs software]].+These high-res, T1-weighted ​anatomical images are processed in four steps using [[http://​stnava.github.io/​ANTs/​ | ANTs software]].
  
 Align them with one another with ANTS: Align them with one another with ANTS:
 <​code>​antsRegistrationSyNQuick.sh -d 3 -f anat01_mr_0021.nii -m anat02_mr_0029.nii -o anat02_mr_0029_</​code>​ <​code>​antsRegistrationSyNQuick.sh -d 3 -f anat01_mr_0021.nii -m anat02_mr_0029.nii -o anat02_mr_0029_</​code>​
  
-Average:+Average ​them together:
 <​code>​AverageImages 3 anatMean.nii 1 anat01_mr_0021.nii anat02_mr_0029_Warped.nii.gz</​code>​ <​code>​AverageImages 3 anatMean.nii 1 anat01_mr_0021.nii anat02_mr_0029_Warped.nii.gz</​code>​
  
Line 45: Line 45:
 <​code>​DenoiseImage -d 3 -n Rician -i anatMean.nii -o anatDenoise.nii</​code>​ <​code>​DenoiseImage -d 3 -n Rician -i anatMean.nii -o anatDenoise.nii</​code>​
  
-Warp the averaged, denoised anatomical T1 to match vasoAnat:+Spatially warp the averaged, denoised anatomical T1 to match vasoAnat:
 <​code>​antsRegistrationSyNQuick.sh -d 3 -f vasoAnatUpsample.nii -m anatDenoise.nii -o anat -i initial_transform.txt -x mask.nii</​code>​ <​code>​antsRegistrationSyNQuick.sh -d 3 -f vasoAnatUpsample.nii -m anatDenoise.nii -o anat -i initial_transform.txt -x mask.nii</​code>​
 +
 +NOTE: This last step with antsRegistrationSyNQuick.sh requires an "​initial_transform.txt,"​ which is created interactively with itkSNAP and a file called mask.nii, which is a binary mask defining a region of interest. I need to expand this page to describe how these are created.
  
 This results in an anatomical called antWarped.nii,​ which we will use to guide layer definition. This results in an anatomical called antWarped.nii,​ which we will use to guide layer definition.
Line 70: Line 72:
  
 {{mrtools:​calcarinereg.png?​}} {{mrtools:​calcarinereg.png?​}}
- 
  
 This step roughly follows the procedures described on [[https://​layerfmri.com/​2018/​03/​11/​quick-layering/​| Renzo'​s blog]]. This step roughly follows the procedures described on [[https://​layerfmri.com/​2018/​03/​11/​quick-layering/​| Renzo'​s blog]].
Line 90: Line 91:
 === 3.3 Make a ribbon intensity mask (RIM) === === 3.3 Make a ribbon intensity mask (RIM) ===
  
-Join the inner and outer borders with a value of 3, fill the cortical ribbon with a value of 3, and save file:+Join the inner and outer borders with a value of 3, fill the cortical ribbon with a value of 3 with the bucket tool, and save the file:
  
 {{mrtools:​corticalribbon.png?​250}} {{mrtools:​corticalribbon.png?​250}}
- 
  
 ===== 4. Grow layers with LAYNII =====  ​ ===== 4. Grow layers with LAYNII =====  ​
Line 114: Line 114:
  
 === Useful links === === Useful links ===
 +
 +This is a tool that may be useful for segmenting images with a small FOV.
  
 https://​github.com/​ofgulban/​segmentator https://​github.com/​ofgulban/​segmentator