Chapter 17 FSL dtifit

Log onto the remote computer.

17.1 Job Script

On the remote computer create job script.

vi ~/scripts/ACAP/

Copy and paste.


#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

username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/

# Location of FSL processed data
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 \

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

If everything is correct then you can create your batch file.

Create batch script.

vi ~/scripts/ACAP/

Copy and paste.

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/ \
  sleep 1

17.3 Submit Jobs with Batch Script

Submit jobs.

sh ~/scripts/ACAP/

You can check the status of your jobs by checking if it is running or pending.


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 \ \