-
Notifications
You must be signed in to change notification settings - Fork 6
/
skullstrip_t1.sh
executable file
·36 lines (32 loc) · 1.32 KB
/
skullstrip_t1.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
#!/bin/bash
#Author: Anne
#Purpose: register t1 to standard space
# Things it does
# 1. skull strip data
# 2. register to standard space
# 3. invert transformation
# input is if you're running it the first time and have to convert from dicoms
source globals.sh
echo "subject number is $subjectNum, day $dayNum, run $runNum"
subject_save_path=$project_path/data/subject$subjectNum/day$dayNum/reg
# move into subjects directory
mkdir -pv $subject_save_path
cd $subject_save_path
echo "moving into folder: $subject_save_path"
echo "looking for dicoms in $scanFolder"
# Process t1-weighted MPRAGE and check brain extraction!
highresFN=highres
highresfiles_genstr=$(printf "%s/001_0000%02d_0*" "$scanFolder" "$highresScan")
if [ $1 -eq 1 ]
then
mkdir -pv $subject_save_path/tempdcm
cp $highresfiles_genstr $subject_save_path/tempdcm/
dcm2niix -f highres -o $subject_save_path/ -z y $subject_save_path/tempdcm/
rm -r $subject_save_path/tempdcm
fi
bet $highresFN.nii.gz $highresFN'_'brain.nii.gz -R -m -f 0.6
fslview $highresFN.nii.gz $highresFN'_'brain.nii.gz $highresFN'_'brain_mask.nii.gz &
echo "copying this version of file into subject folder for safe keeping!"
mkdir -pv $project_path/data/subject$subjectNum/usedscripts/
cp $project_path/skullstrip_t1.sh $project_path/data/subject$subjectNum/usedscripts/skullstrip_T1.sh
echo "done!"