-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfetch-dicoms
executable file
·35 lines (32 loc) · 1.17 KB
/
fetch-dicoms
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
#!/bin/bash
# Extract Batch of DICOMS
# ------------------------------------------------------------------------------------------------------------
# Default Arguments
me=$(whoami)
today=$(date)
r="/Volumes/CFMI-CFS/mnt/CFMI-DICOMS/"
o="/Volumes/CFMI-CFS/sync/ADS/data/mri/dicoms"
f="${HOME}/ADS-MRI-DATES.txt"
# Get Meta Data For Extraction From File (f)
echo -e "\n📃 Extracting Subject IDS and Scan Dates from $f\n"
subject=$(awk '{print $1}' $f)
scandate=($(awk '{print $2}' $f))
session=($(awk '{print $3}' $f))
# ------------------------------------------------------------------------------------------------------------
# Run Batch (do this in parallel you dope!) --> address TODO in fetch dicom for subject parsing
counter=0
for s in $subject; do
# Get Session Label
# ss=${session[$counter]}
# Extract Year, Month and Day
datestr=${scandate[$counter]}
SAVEIFS=${IFS} && IFS='-' read -ra datestr <<< "$datestr"
year="${datestr[0]}"
mon="${datestr[1]}"
day="${datestr[2]}"
IFS=${SAVEIFS}
fetch-dicom -s ${s} -o ${o} -y $year -m $mon -d $day -r ${r}
# Pull dicom for subject
counter=$((counter+1))
done
echo -e '✅ job complete - now go publish some papers\n\n'