-
Notifications
You must be signed in to change notification settings - Fork 6
T1w T2w Ratio
T1w/T2w ratio has been used as a myelin index (Glasser et al., 2011; Shams et al., 2019).
Be careful : T1w/T2w ratio value is not only related to myelin content but also to other molecules such as iron.
T1w and T2w images are ones of the few most standard MRI images, which makes this metric relatively easy to obtain a measure of myelin.
bestlinreg_g -nmi -lsq6 T2.mnc T1.mnc transform.xfm
mincresample -like T1.mnc -sinc -short -unsigned -transform transform.xfm T2.mnc T2_lsq6.mnc
minccalc -expression "(A[0]>0.05*$(mincstats -quiet -max T1.mnc) && A[1]>0.05*$(mincstats -quiet -max T2_lsq6.mnc))?A[0]/A[1]:0" T1.mnc T2_lsq6.mnc ratio.mnc
Important: Whether the goal is to only extract the ratio values for a certain structure (i.e. globus pallidus) or to extract the ratio values for the whole brain, it will be necessary to use the appropriate mask ( in this wiki, "mask" can refers either to wholebrain maks, MAGeT labels or other binary mnc file and is sometimes used interchangeably with "label") of the desired structure for each subject.
The script used in later step requires one folder per subject. The subject folder name should be names based on the ID of the subject and each folder should initially store 2 files (or more if there are more than one mask used): the T1w/T2w ratio image and the mask file for the corresponding subject. Any outputs should also be stored in their corresponding subject specific folders seeing as the script runs on a per subject basis (1 job per subject).
(Steps developed by Rai; see /data/chamal/projects/raihaan/projects/misc/t1t2-ratio/filter_instructions for detailed instructions.
From Glasser & Van Essen, 2011: Method for correcting aberrant T1w/T2w values “Each vertex’s cortical thickness and T1w/T2w values were compared with the mean values of the neighbors within 10 steps across the surface. If the values of both the cortical thickness and the T1w/T2w exceeded 2 SDs from the mean, it was assumed that an error had occurred in surface reconstruction and thus the data were unreliable. These values were replaced by a Gaussian-weighted average of their neighbors using a geodesic distance weighting. Only vertices having cortical thickness values and T1w/T2w values <2 SDs from the mean were included in the Gaussian weighted average.”
mkdir subjectID
cp subjectID_ratio.mnc subjectID/
cp subjectID_mask.mnc subjectID/
Nedded to ensure that mask 1 doesn’t end up as 1.01 in future conversion.
mincreshape -normalize -unsigned -byte -image_range 0 255 -valid_range 0 255 mask.mnc mask_fix.mnc
mincinfo ratio.mnc
mincinfo mask_fix.mnc
module load ANTs
antsApplyTransforms -d 3 -i ratio.mnc -r mask_fix.mnc -o ratio_cropped.mnc
mnc2nii mask_fix.mnc mask_fix.nii
mnc2nii ratio_cropped.mnc ratio_cropped.nii
See example: /data/chamal/projects/raihaan/projects/misc/t1t2-ratio/label_lookup.csv. The column names must be the same as those used in this example .csv
To visualise it on the terminal:
cat /data/chamal/projects/raihaan/projects/misc/t1t2-ratio/label_lookup.csv
(example if the mask used is a label of the left and right globus pallidus)
Label_val, Label
2, left_gp_lb
5, right_gp_lb
cp /data/chamal/projects/raihaan/projects/misc/t1t2-ratio/generic_t1t2_filter.py .
module unload minc-toolkit
module load anaconda qbatch
for subj in *HA*; do echo python generic_t1t2_filter.py --resn 0.64 --lookup labels_subcort.csv --subjdir $subj --t1t2_stem ratio.nii.gz --label_stem labels.nii.gz --left_gp_lb 2 --right_gp_lb 5; done > filterjobs
It assumes the files in a given folder pertain to 1 subject. Required inputs:
--resn resolution of T1w/T2w files
--lookup .csv lookup table with label,structure name
--subjdir path to directory containing subjects files. this folder should contain 2 files: nifti t1t2 image and a nifti label for the given subject
--t1t2_stem suffix of T1w/T2w image - so it knows which file in subjdir is the T1w/T2w image
--label_stem suffix of label file - so it knows which file in subjdir is the label_file
Optional Inputs:
--left_gp_lb the label value for the left gp, if included in label set
--right_gp_lb the label value for the right gp, if included in label set
As noted in the optional inputs, if your label set includes the globus pallidus you must include the appropriate option to specify the label values for the left and right gp. As the gp is a smaller structure, a slight modification to the smoothing parameters is required. If your label set does not include these structures, do not use the --left_gp_lb or --right_gp_lb options.
qbatch -c 1 --ppj 2 -w 1:00:00 filterjobs
Please note: these settings that have worked when running about 100 Healthy Aging Subjects
Can be very long if the label used is the wholebrain mask. In this case, run qbatch -c 1 --ppj 2 filterjobs
2.10. Get summary stats for all subjects (less meaningful if used wholebrain mask than structure-wise labels)
The generic_t1t2_filter.py script outputs two .csv files for each subject - one containing the mean t1/t2 in each structure and another containing the stdev of t1/t2 in each structure. Use bash to concatenate these for all subjects.
head -n1 subject1/subject1_meant1t2.csv > group_meant1t2.csv #Get the header for subj in allsubjectdirs; do tail -n1 $subj/"$subj"_meant1t2.csv; done >> group_meant1t2.csv
It can be done at the cortex level using CIVET outputs or at the structure level using MAGeT morph outputs.
Look at https://github.com/CoBrALab/documentation/wiki/Surface-Sampling-Using-CIVET-surfaces for more details in how to do it.
Create a new ratio images that contains only the T1w/T2w values (after filtering) for the structure(s) of interest.
module load FSL
Will get label 0 only for the striatum (for example)
fslmaths labels.nii.gz -binv inverted-labels.nii.gz
fslmaths ratio.nii.gz -mul inverted-labels.nii.gz -add L_stri_filter.nii.gz ratio-filter.nii.gz
Note: L_stri_filter.nii.gz is the output of the generic_subcorticalfilter.py script (see above)
nii2mnc ratio-filter.nii.gz ratio-filter.mnc