-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeface.sh
40 lines (35 loc) · 860 Bytes
/
deface.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
#!/bin/bash
# A simple script to deface (with use of fsl_deface) multiple T1/T2-weightened files prepared according to the BIDS standard.
# Note: files will be overwritten with new versions, preserving the BIDS naming standard.
#
# Syntax: ./deface.sh [-o|-t]
#
# Options:
# without an option -- de-face both T1/T2-weightened images
# -o -- de-face only T1-weigtened images
# -t -- de-face only T2-weigtened images
#
# github.com/ptdz, 2023
while getopts "ot" option; do
case $option in
o)
filetype="*T1w.nii.gz"
;;
t)
filetype="*T2w.nii.gz"
;;
\?) #Invalid option
echo "Error: invalid option. Syntax: ./deface.sh [-o|-t]"
;;
esac
done
if [ -z "$1" ]
then
filetype="*.nii.gz"
fi
filelist=$(find "$PWD" -name "$filetype")
for f in $filelist
do
fsl_deface $f $f
echo $f "file processed successfully"
done