-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7. PrepareEddy.sh
46 lines (35 loc) · 1.2 KB
/
7. PrepareEddy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/env bash
# Prepare EDDY
echo "PREPARING FOR EDDY"
# definitions
studyDir=/vols/Scratch/alazari/paTMS/diffusion_Jul2018
dataDir=$studyDir/data
# list the subjects
subjectList="P1 P2 P3"
# Loop over subjects
for subj in $subjectList; do
echo " subj: $subj"
# make and specify directories
mkdir -p $dataDir/$subj/dMRI/brainextraction
mkdir -p $dataDir/$subj/dMRI/eddy
eddyDir=$dataDir/$subj/dMRI/eddy
outputDir=$dataDir/$subj/dMRI/brainextraction
topupDir=$dataDir/$subj/dMRI/topup
rawDir=$dataDir/$subj/dMRI/raw
echo " calculating brain mask"
# make a brain mask
fslmaths $topupDir/topup_iout_$subj -Tmean $outputDir/hifib0_$subj
echo " brain extraction"
# extract brain with BET using the brain mask
bet $outputDir/hifib0_$subj $outputDir/nodif_brain_$subj -m -f 0.2
# calculate number of volumes
echo " calculating number of volumes"
numVols=$(fslval $rawDir/data_AP dim4)
echo " nr of volumes: $numVols"
# make an 'index.txt' file with a row of 1's for the number of volumes
echo " making index file with volumes"
indx=" "
for ((i=1; i<=$numVols; i+=1)); do indx="$indx 1"; done
echo $indx > $eddyDir/index.txt
done
echo "EDDY PREPARATION DONE"