T2 and ADNI slab images preprocessing - CoBrALab/documentation GitHub Wiki
This document too specific, you need to understand what you're doing, not follow it blindly.
1) Motion QC
- Same thing than for motion QC T1
2) Preprocessing
First, do :
module load minc-toolkit-extras
module load ANTs/20191007
The preprocessing script is :
/data/chamal/projects/gabriel/src/minc-toolkit-extras/t2-slab-preprocess.sh
This script contains the following steps:
- Registration of T1.mnc and T2.mnc and creation of the transform.xfm
- Application of the transform.xfm on T1-mask.mnc to create T2-mask.mnc
- N4 correction
- Resampling of T2-mask.mnc (if needed)
- Application of T2-mask.mnc on T2.mnc to extract the T2-extracted.mnc brain
Apply the script this way :
/data/chamal/projects/gabriel/src/minc-toolkit-extras/t2-slab-preprocess.sh T2.mnc T1.n4correct.cutneckapplyautocrop.mnc T1.n4correct.cutneckapplyautocrop.beastmask.mnc T2-corrected.mnc
- For that you can do a loop :
Example : if you have 2 subjects, SUBJECT1.mnc and SUBJECT2.mnc, you can create different folders such as :
1- A folder raw-T2/ contains :
SUBJECT1.mnc
SUBJECT2.mnc
2- A folder T1-n4correct-cutneck/ contains :
SUBJECT1.n4correct.cutneckapplyautocrop.mnc
SUBJECT2.n4correct.cutneckapplyautocrop.mnc
3- A folder Beastmask/ contains :
SUBJECT1.n4correct.cutneckapplyautocrop.beastmask.mnc
SUBJECT2.n4correct.cutneckapplyautocrop.beastmask.mnc
4- A folder T2-corrected/ contains :
Nothing yet.
- Here is the loop corresponding to this example :
for files in raw-T2/*.mnc ; do echo /data/chamal/projects/gabriel/src/minc-toolkit-extras/t2-slab-preprocess.sh $files T1-n4correct-cutneck/"${files:7:8}".n4correct.cutneckapplyautocrop.mnc Beastmask/"${files:7:8}".n4correct.cutneckapplyautocrop.beastmask.mnc T2-corrected/"${files:7:8}"-T2-corrected.mnc ; done
-
"${files:7:8}" means : take the characters of your files (defined as raw-T2/*.mnc) from character 7, and for a length of 8 characters, so for us : SUBJECT1 or SUBJECT2.
-
echo : will allow you to see the code that you created with the loop and to check if there is no mistakes.
-
When you are sure of your code, you can remove echo, the script will run.
-
Then you check your T2-corrected/ and if everything went well you will obtain :
- SUBJECT1-T2-corrected.mnc
- SUBJECT2-T2-corrected.mnc