Chapter 19 Modified TBSS using ENGIMA
FA Analysis
19.1 Copy FA images
mkdir -p /work/ashley.ware/data/ACAP/enigma/tbss/
for i in $(ls /work/ashley.ware/data/ACAP/enigma/dwiprep/ | grep "sub-*"); do
cp -v \
/work/ashley.ware/data/ACAP/enigma/dwiprep/${i}/dti_FA.nii.gz \
/work/ashley.ware/data/ACAP/enigma/tbss/${i}_FA.nii.gz
done
19.2 TBSS Step 1
Create script:
vi ~/scripts/ACAP/ENIGMA-tbss-1-preproc.sh
Copy and paste:
#!/bin/bash
#SBATCH --time=06:00:00 # walltime
#SBATCH --ntasks=1 # number of processor cores (i.e. tasks)
#SBATCH --nodes=1 # number of nodes
#SBATCH --mem-per-cpu=12G # memory per CPU core
# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/
PATH=${ANTSPATH}:${PATH}
# INSERT CODE, AND RUN YOUR PROGRAMS HERE
cd /work/ashley.ware/data/ACAP/enigma/tbss/
tbss_1_preproc \*.nii.gz
Submit script:
curTime=`date +"%Y%m%d-%H%M%S"`
mkdir -p ~/logfiles/ACAP/$curTime
sbatch \
-o ~/logfiles/ACAP/${curTime}/output.txt \
-e ~/logfiles/ACAP/${curTime}/error.txt \
~/scripts/ACAP/ENIGMA-tbss-1-preproc.sh
19.3 Sync Data
rsync -rauv \
ashley.ware@arc.ucalgary.ca:/work/ashley.ware/data/ACAP/enigma/tbss/ \
/Volumes/bobo/data/ACAP/enigma/tbss/
To view, point your web browser to:
file:/Volumes/bobo/data/ACAP/enigma/tbss/FA/slicesdir/index.html
19.4 TBSS Step 2
Download the ENIGMA templates:
mkdir -p ~/templates/ENIGMA
cd ~/templates/ENIGMA
wget http://enigma.ini.usc.edu/wp-content/uploads/2013/02/enigmaDTI.zip
unzip enigmaDTI.zip && rm enigmaDTI.zip
Create script:
vi ~/scripts/ACAP/ENIGMA-tbss-2-reg.sh
Copy and paste:
#!/bin/bash
#SBATCH --time=30:00:00 # walltime
#SBATCH --ntasks=1 # number of processor cores (i.e. tasks)
#SBATCH --nodes=1 # number of nodes
#SBATCH --mem-per-cpu=16G # memory per CPU core
# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/
PATH=${ANTSPATH}:${PATH}
# INSERT CODE, AND RUN YOUR PROGRAMS HERE
cd /work/ashley.ware/data/ACAP/enigma/tbss/
tbss_2_reg -t ~/templates/ENIGMA/ENIGMA_DTI_FA.nii.gz
Submit script:
curTime=`date +"%Y%m%d-%H%M%S"`
mkdir -p ~/logfiles/ACAP/$curTime
sbatch \
-o ~/logfiles/ACAP/${curTime}/output.txt \
-e ~/logfiles/ACAP/${curTime}/error.txt \
~/scripts/ACAP/ENIGMA-tbss-2-reg.sh
19.5 TBSS Part 3
Create script:
vi ~/scripts/ACAP/ENIGMA-tbss-3-postreg.sh
Copy and paste:
#!/bin/bash
#SBATCH --time=02:00:00 # walltime
#SBATCH --ntasks=1 # number of processor cores (i.e. tasks)
#SBATCH --nodes=1 # number of nodes
#SBATCH --mem-per-cpu=16G # memory per CPU core
# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/
PATH=${ANTSPATH}:${PATH}
# INSERT CODE, AND RUN YOUR PROGRAMS HERE
cd /work/ashley.ware/data/ACAP/enigma/tbss/
tbss_3_postreg -S
Submit script:
curTime=`date +"%Y%m%d-%H%M%S"`
mkdir -p ~/logfiles/ACAP/$curTime
sbatch \
-o ~/logfiles/ACAP/${curTime}/output.txt \
-e ~/logfiles/ACAP/${curTime}/error.txt \
~/scripts/ACAP/ENIGMA-tbss-3-postreg.sh
19.6 Sync Data
rsync -rauv \
ashley.ware@arc.ucalgary.ca:/work/ashley.ware/data/ACAP/enigma/tbss/ \
/Volumes/bobo/data/ACAP/enigma/tbss/
Make sure your mean_FA.nii.gz
image looks alright before proceeding. You will find this image under /Volumes/bobo/data/ACAP/enigma/tbss/stats/
.
19.7 TBSS Part 4
Create script:
vi ~/scripts/ACAP/ENIGMA-tbss-4-prestats.sh
Copy and paste:
#!/bin/bash
#SBATCH --time=02:00:00 # walltime
#SBATCH --ntasks=1 # number of processor cores (i.e. tasks)
#SBATCH --nodes=1 # number of nodes
#SBATCH --mem-per-cpu=16G # memory per CPU core
# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/
PATH=${ANTSPATH}:${PATH}
# INSERT CODE, AND RUN YOUR PROGRAMS HERE
cd /work/ashley.ware/data/ACAP/enigma/tbss/
tbss_4_prestats -0.049
Submit script:
curTime=`date +"%Y%m%d-%H%M%S"`
mkdir -p ~/logfiles/ACAP/$curTime
sbatch \
-o ~/logfiles/ACAP/${curTime}/output.txt \
-e ~/logfiles/ACAP/${curTime}/error.txt \
~/scripts/ACAP/ENIGMA-tbss-4-prestats.sh
19.8 Skeletonize Participant Images
cd /work/ashley.ware/data/ACAP/enigma/tbss/
for i in $(ls /work/ashley.ware/data/ACAP/enigma/tbss/origdata | grep "sub*"); do
# COPY NORMALIZED IMAGE FILE TO INDIVIDUAL DIRECTORY
subjid=`echo $i | cut -d "_" -f1`
mkdir -p ./FA-individ/${subjid}/stats/
mkdir -p ./FA-individ/${subjid}/FA/
cp -v ./FA/${subjid}_*.nii.gz ./FA-individ/${subjid}/FA/
# SKULL STRIP / BRAIN EXTRACT
fslmaths \
./FA-individ/${subjid}/FA/${subjid}_*FA_to_target.nii.gz \
-mas ./stats/mean_FA_mask.nii.gz \
./FA-individ/${subjid}/FA/${subjid}_masked_FA.nii.gz
# SKELETONIZE
tbss_skeleton \
-i ./FA-individ/${subjid}/FA/${subjid}_masked_FA.nii.gz \
-p 0.049 \
./stats/mean_FA_skeleton_mask_dst \
~/apps/fsl/data/standard/LowerCingulum_1mm.nii.gz \
./FA-individ/${subjid}/FA/${subjid}_masked_FA.nii.gz \
./FA-individ/${subjid}/stats/${subjid}_masked_FAskel.nii.gz \
-s ./stats/mean_FA_skeleton_mask.nii.gz
done