Chapter 17 FSL dtifit
Log onto the remote computer.
17.1 Job Script
On the remote computer create job script.
vi ~/scripts/ACAP/fsl-dtifit-job.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}
# Location of FSL processed data
DATA_DIR=/work/${username}/data/ACAP/fsl/${1}
cd ${DATA_DIR}
# Separate the non-diffusion volume from other DWI images
fslroi ecmoco.nii.gz b0.nii.gz 0 1
# FSL Brain Extraction Tool (BET) on Eddy Current and Motion Corrected b=0 file
bet b0.nii.gz ecmoco-brain -f 0.05 -g 0 -m
# FSL DTIFIT on Eddy Current and Motion Corrected data
dtifit \
--data=ecmoco.nii.gz \
--out=ecmoco_dti \
--mask=ecmoco-brain_mask.nii.gz \
--bvecs=ecmoco.eddy_rotated_bvecs \
--bvals=bvals
17.2 Batch Script
First check that your subjid
is correct.
for i in $(find /work/ashley.ware/data/ACAP/fsl/ -name "ecmoco.nii.gz"); do
subjid=`echo $i | cut -d "/" -f7`
echo $subjid
done
If everything is correct then you can create your batch file.
Create batch script.
vi ~/scripts/ACAP/fsl-dtifit-batch.sh
Copy and paste.
#!/bin/bash
curTime=`date +"%Y%m%d-%H%M%S"`
username=`id -un`
mkdir -p ~/logfiles/ACAP/${curTime}
for i in $(find /work/ashley.ware/data/ACAP/fsl/ -name "ecmoco.nii.gz"); do
subjid=`echo $i | cut -d "/" -f7`
sbatch \
-o ~/logfiles/ACAP/${curTime}/output_${subjid}.txt \
-e ~/logfiles/ACAP/${curTime}/error_${subjid}.txt \
~/scripts/ACAP/fsl-dtifit-job.sh \
${subjid}
sleep 1
done
17.3 Submit Jobs with Batch Script
Submit jobs.
sh ~/scripts/ACAP/fsl-dtifit-batch.sh
You can check the status of your jobs by checking if it is running or pending.
squeue
You can check the outputs.
tail -n 5 ~/logfiles/ACAP/<date>/output*
17.4 Download Directory / Sync Directory with Arc
Back on your local computer make sure you have the directory already.
mkdir -p /Volumes/bobo/data/ACAP/fsl
Then sync the data from the remote computer to your local computer.
rsync -rauv \
ashley.ware@arc.ucalgary.ca:/work/ashley.ware/data/ACAP/fsl/ \
/Volumes/bobo/data/ACAP/fsl/