Differences between revisions 14 and 15
Deletions are marked like this. Additions are marked like this.
Line 97: Line 97:


== ROI-based MRTM2 ===
Fr the MRTM2 analysis, we must first run MRTM1 on the high-binding TAC generated by mri_gtmpvc above:
{{{
mri_glmfit --y gtm.psf6/km.hb.tac.nii.gz --mrtm1 gtm.psf6/km.ref.tac.dat frame.time.dat --o gtm.psf6/mrtm1hb --no-est-fwhm --nii.gzmri_glmfit --y gtm.nii.gz --mrtm1 km.ref.tac.dat ../frame.time.dat --o mrtm1.roi --nii.gz
}}}
 * --y gtm.nii.gz - this is the AC of the high-binding region, the input to the MRTM1 algorithm
 * --mrtm1 km.ref.tac.dat ../frame.time.dat : this tells mri_glmfit to run the MRTM1 analysis using the reference TAC that was computed above; the frame timing is also passed
 * --o mrtm1.roi : this is the output folder
 * --nii.gz : save output in nii.gz format (default for mri_glmfit is mgh, which would also have been ok too)

If you look in the output folder, you will see several files and folders:
 * bp.nii.gz - this is the binding potential (BPnd). If you run mri_info on it, you will see that it has 100 columns, one for each ROI. This can be loaded in matlab for converted to text with mri_convert bp.nii.gz --ascii bp.text.dat
 * k2/gamma.nii.gz - this is the k2 parameter for each ROI. Same for k2a/gamma.nii.gz and R1/gamma.nii.gz

1. PETsurfer Kinetic Modeling Tutorial Data Description

The dynamic PET data were completely synthesized based on on average ROI time activity curves (TACs) from a study using [11C]SB207145 which targets the serotonin 5HT4 receptor (see Beliveau, et all, 2016). These ROI TACs where then applied to the anatomical MRIs of subjects not in the PET study to create PET-like dynamic images. The anatomical images are 18 real subjects distributed as part of the FSFAST fMRI tutorial. The anatomical images were gradient unwarped prior to analyzing in recon-all. The data are suitable for analyzing using the MRTM1 and MRTM2 models. The data were synthesized with both tissue fraction effects (TFEs) and partial volume effects (PVEs). The PVE is an isotropic 6mm Gaussian kernel. The data were simulated with slight differences in subjects according to two (arbitrary) groups so that there will be a group effect in the bindind potentials.

2. Getting the Data (not necessary for the Boston FreeSurfer Course)

3. Analyzing an Individual Subject

Change directory into the project folder. There you will see 18 folders called s01, s02, etc. Change directory into sb01. You will see several files:

3.1. Examine Input Data

tac.vol.nii.gz -- this is a multi frame volume holding the time activity curves (TACs) for each voxel
frame.time.dat -- text file indicating the time at which each frame was acquired.
subjectname -- text file with the name of the !FreeSurfer-analyzed anatomy of the subject, uw.fsf01anat in this case.  

Examine the contents of frame.time.dat using any text viewer or editor. Verify that the time file has 38 entries. Also notice that the frames are NOT uniformly distributed in time.

Now examine the dimensions of the TAC with

mri_info tac.vol.nii.gz

Verify that the TAC also has 38 frames (the spatial dimensions are 64x64x30)

3.2. Compute the mean of the TAC and Visualize

Run

mri_concat tac.vol.nii.gz --mean --o tac.vol.mean.nii.gz

Visualize the mean and the TAC volume

freeview  tac.vol.nii.gz tac.vol.mean.nii.gz

Click on the "tac.vol.nii.gz" item in the menu, then show the time series. Click around the brain. Generally, you should see a curve that rises and then slowly returns to 0. Note that freeview displays the curve assuming that the time points are uniformly spaced in time (though they are not, see above).

3.3. Register TAC Mean to the Anatomical

mri_coreg --s uw.fsf01anat --mov tac.vol.mean.nii.gz --reg egistration.lta

This will compute a 6DOF registration to the FreeSurfer anatomical. Check the registration with

tkregisterfv --mov tac.vol.mean.nii.gz --reg registration.lta --surfs

Verify that it is accurate.

3.4. Run Partial Volume Correction

mri_gtmpvc --i tac.vol.nii.gz --o gtm.psf6 --psf 6 - --seg gtmseg.mgz --reg registration.lta \
   --mgx .01 --km-ref 8 47 --km-hb 11 12 50 51 --no-rescale --auto-mask 1 .1 \
   --default-seg-merge  --update-tt  

This command does a lot so let's break it down:
--i tac.vol.nii.gz : this is the multi-frame input that we want to analyze
--o gtm.psf : this is the output folder
--psf 6 : assume the scanner has a 6mm Gaussian point spread function (PSF) -- this is how it was simulated. When you analyze your data, you must know what the PSF for your scanner is. DON'T JUST USE "6"!
--seg gtmseg.mgz : this is a segmentation in the FreeSurfer analysis created by running gtmseg --s uw.fsf01anat.
--reg registration.lta : registration to FreeSurfer analysis created above. The subjectname is imbedded
--mgx .01 : this instructs mri_gtmpvc to produce "extended" Muller-Gartner PVC maps. The .01 requires that a voxels have at least 1% gray matter or else it is set to 0. This is a liberal threshold that can be superceded in later processing
--km-ref 8 47 : save the average TAC from these segmentations in a text file called km.ref.tac.dat. This will be used as the reference TAC in the MRTM1 and MRTM2 analysis below. For this particular tracer (SB207145) we will use the cerebellar gray matter (8 and 47 are left and right cerebellar gray as found in $FREESURFER_HOME/FreeSurferColorLUT.txt). Different tracers may require different reference regions.
-km-hb 11 12 50 51 : save the average TAC from these segmentations in a file called km.hb.tac.dat. This will be used as the TAC from the "high-binding" regions when running MRTM2. For this tracer, we will use caudate and putamen. Different tracers may require different HB regions.
--no-rescale : do not rescale the output (often done in SUVR analysis)
--auto-mask 1 .1 : automatically create a mask so that irrelevant voxels outside of the are not analyzed. "1 .1" will roughly extend the mask about 1mm beyond the head. This is fine for all applications. The explanation of what "1 .1" means is a little complicated and not necessary to explain right now.
--default-seg-merge : merge smaller segmentations with larger ones

After this runs, cd into the output folder and examine the contents. There are a lot of files, and we'll only look at a couple of them:

  • km.ref.tac.dat - reference TAC as described above; view with any text/ascii viewer.
  • km.hb.tac.dat - high-binding TAC as described above; view with any text/ascii viewer.
    • gtm.nii.gz - this is a binary file the PVCed TACs for each ROI. This will be the input used for ROI-based MRTM1 and MRTM2 analysis. If you run mri_info on it, you will see that it has 100 columns (one for each ROI) and 38 frames (one for each time point). This is not easy to view (but can be viewed using, eg, matlab).
  • gtm.stats.dat - this is a text file with a list of segmentations and data about the first frame of the input after PVC. For kinetic modeling, this file is not that important.
  • mgx.subctxgm.nii.gz and mgx.ctxgm.nii.gz are the partial volume corrected TACs (using extended Muller-Gartner) for subcortial areas (subctxgm) and cortex (ctxgm). First, run mri_info on one of them. You can see that the spatial dimensions are 46x62x30; this is smaller than the input data above. This is because mri_gtmpvc reduces the field of view (FoV) so as to reduce storage and processing requirements. These volumescan be viewed with

freeview mgx.subctxgm.nii.gz:grayscale=0,3000  mgx.ctxgm.nii.gz:grayscale=0,3000

These images look a little funny. The MGX correction only applies to voxels that have at least 1% gray matter after applying the PSF blurring. mgx.ctxgm only applies to cortical gray matter, and mgx.subctxgm only applies to subcortical gray matter. If you hit the show-time-series button, you can see the TAC at each voxel.

  • aux folder : this contains auxiliary information that may or may not be useful
  • aux/bbpet2pet.lta - this is a registration file that maps the reduced FoV to the anatomical
  • aux/seg.ctab - this is a color lookup table (ctab) that has a list of all the ROIs in the final analysis; view it with any text viewer. For this analysis, there will be 101 entries, one for each ROI analyzed plus an "Unknown" label for outside the head. Each ROI also has a tissue type.
  • aux/seg.nii.gz - this contains the final hard segmentation in PET space. You can view it with freeview aux/seg.nii.gz:colormap=lut:lut=aux/seg.ctab
  • aux/tissue.fraction.nii.gz - this is a map of the tissue fraction for each tissue type. View it with freeview aux/tissue.fraction.nii.gz. Scroll through the different frames to see the TF for each tissue type.

3.5. Run ROI-based Kinetic Modeling

3.5.1. ROI-based MRTM1

First, run the MRTM1 analysis. Both the MRTM1 and MRTM2 analyses are types of linear models, so we can use mri_glmfit, the generic linear model solver that exists in FreeSurfer:

mri_glmfit --y gtm.nii.gz --mrtm1 km.ref.tac.dat ../frame.time.dat --o mrtm1.roi --nii.gz
  • --y gtm.nii.gz - this is the AC of the high-binding region, the input to the MRTM1 algorithm
  • --mrtm1 km.ref.tac.dat ../frame.time.dat : this tells mri_glmfit to run the MRTM1 analysis using the reference TAC that was computed above; the frame timing is also passed
  • --o mrtm1.roi : this is the output folder
  • --nii.gz : save output in nii.gz format (default for mri_glmfit is mgh, which would also have been ok too)

If you look in the output folder, you will see several files and folders:

  • bp.nii.gz - this is the binding potential (BPnd). If you run mri_info on it, you will see that it has 100 columns, one for each ROI. This can be loaded in matlab for converted to text with mri_convert bp.nii.gz --ascii bp.text.dat
  • k2/gamma.nii.gz - this is the k2 parameter for each ROI. Same for k2a/gamma.nii.gz and R1/gamma.nii.gz

== ROI-based MRTM2 === Fr the MRTM2 analysis, we must first run MRTM1 on the high-binding TAC generated by mri_gtmpvc above:

mri_glmfit --y gtm.psf6/km.hb.tac.nii.gz --mrtm1 gtm.psf6/km.ref.tac.dat frame.time.dat --o gtm.psf6/mrtm1hb --no-est-fwhm --nii.gzmri_glmfit --y gtm.nii.gz --mrtm1 km.ref.tac.dat ../frame.time.dat --o mrtm1.roi --nii.gz
  • --y gtm.nii.gz - this is the AC of the high-binding region, the input to the MRTM1 algorithm
  • --mrtm1 km.ref.tac.dat ../frame.time.dat : this tells mri_glmfit to run the MRTM1 analysis using the reference TAC that was computed above; the frame timing is also passed
  • --o mrtm1.roi : this is the output folder
  • --nii.gz : save output in nii.gz format (default for mri_glmfit is mgh, which would also have been ok too)

If you look in the output folder, you will see several files and folders:

  • bp.nii.gz - this is the binding potential (BPnd). If you run mri_info on it, you will see that it has 100 columns, one for each ROI. This can be loaded in matlab for converted to text with mri_convert bp.nii.gz --ascii bp.text.dat
  • k2/gamma.nii.gz - this is the k2 parameter for each ROI. Same for k2a/gamma.nii.gz and R1/gamma.nii.gz

PetSurferKmTutorial (last edited 2019-09-25 18:21:27 by DougGreve)