-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeface_test.sh
62 lines (56 loc) · 2.08 KB
/
deface_test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/bash
# ------------------------------------------------------------------------------
# Script name: deface_test.sh
#
# Description: Runs three different defacing algorithms on a set of images: pydeface, fsl_deface and mri_deface.
#
# Author: Caroline Nettekoven, 2020
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
input_dir=/Users/CN/Documents/Projects/BOLD_study_local/deidentification/example_subject/sub-650BT/
work_dir=${input_dir}/defaced
tool_dir=/Users/CN/Documents/Projects/BOLD_study_local/bin/
py_dir=/Users/CN/Documents/Projects/Joystick_Cereb_MRS/bin/mrsi_code/env/bin
# ------------------------------------------------------------------------------
images_to_deface="\
anat/sub-650BT_T1w_nrm.nii.gz \
anat/sub-650BT_T1w_raw.nii.gz \
dwi/sub-650BT_acq-AP_dwi.nii.gz \
dwi/sub-650BT_acq-AP_sbref.nii.gz \
dwi/sub-650BT_acq-PA_dwi.nii.gz \
dwi/sub-650BT_acq-PA_sbref.nii.gz \
fmap/sub-650BT_magnitude1.nii.gz \
fmap/sub-650BT_magnitude2.nii.gz \
fmap/sub-650BT_phase.nii.gz \
func/sub-650BT_task-nwr_bold.nii.gz \
func/sub-650BT_task-nwr_sbref.nii.gz \
func/sub-650BT_task-rest_bold.nii.gz \
func/sub-650BT_task-rest_sbref.nii.gz \
func/sub-650BT_task-verbgen_bold.nii.gz \
func/sub-650BT_task-verbgen_sbref.nii.gz \
"
# ------------------------------------------------------------------------------
for image in ${images_to_deface}; do
echo "Defacing ${image}..."
img=${input_dir}/${image}
img_stem=${image#*BT_}
img_stem=${img_stem%.nii*}
if [ ! -f ${work_dir}/${img_stem}_pydeface.nii.gz ]; then
${py_dir}/pydeface --outfile \
${work_dir}/${img_stem}_pydeface \
${img}
fi
if [ ! -f ${work_dir}/${img_stem}_fsl.nii.gz ]; then
fsl_deface \
${img} \
${work_dir}/${img_stem}_fsl
fi
if [ ! -f ${work_dir}/${img_stem}_freesurfer.nii.gz ]; then
${tool_dir}/mri_deface \
${img} \
${tool_dir}/talairach_mixed_with_skull.gca \
${tool_dir}/face.gca \
${work_dir}/${img_stem}_freesurfer.nii.gz
fi
done