|
a |
|
b/scripts/msk-qdess |
|
|
1 |
#!/bin/bash |
|
|
2 |
|
|
|
3 |
# msk-qdess |
|
|
4 |
# |
|
|
5 |
# @brief: Run DESS analysis for femoral cartilage on patient folder specified as an argument |
|
|
6 |
# 1. Do automatic segmentation |
|
|
7 |
# 2. Calculate T2 map |
|
|
8 |
# 3. Analyze all supp |
|
|
9 |
# |
|
|
10 |
# @usage (from terminal/command line): |
|
|
11 |
# ./msk-qdess PATH_TO_PATIENT_FOLDER qDESS_DICOM_FOLDER_NAME |
|
|
12 |
# eg: "./msk-qdess subject_scans/patient01 001" |
|
|
13 |
# |
|
|
14 |
# @initialization protocol: |
|
|
15 |
# 1. run "chmod +x msk-qdess" from the command line |
|
|
16 |
# 2. Update `WEIGHTS_DIRECTORY` field below |
|
|
17 |
# |
|
|
18 |
# @author: Arjun Desai, Stanford University |
|
|
19 |
# (c) Stanford University, 2018 |
|
|
20 |
|
|
|
21 |
WEIGHTS_DIRECTORY="" |
|
|
22 |
if [ -z "$WEIGHTS_DIRECTORY" ]; then |
|
|
23 |
echo "Please define WEIGHTS_DIRECTORY in script. Use the absolute path" |
|
|
24 |
exit 125 |
|
|
25 |
fi |
|
|
26 |
|
|
|
27 |
if [ $# -eq 1 ] |
|
|
28 |
then |
|
|
29 |
SERIES="qdess" |
|
|
30 |
else |
|
|
31 |
SERIES=$2 |
|
|
32 |
fi |
|
|
33 |
|
|
|
34 |
# find relevant dicom files |
|
|
35 |
|
|
|
36 |
FILES=$(find $1 -type d -name $SERIES) |
|
|
37 |
|
|
|
38 |
cd .. |
|
|
39 |
|
|
|
40 |
for i in $FILES; do |
|
|
41 |
DIRNAME=$(dirname $i) |
|
|
42 |
DIRNAME="$DIRNAME/data" |
|
|
43 |
dosma --d $i --s $DIRNAME qdess --fc segment --rms --weights_dir $WEIGHTS_DIRECTORY |
|
|
44 |
dosma --l $DIRNAME qdess --fc t2 |
|
|
45 |
dosma --l $DIRNAME knee --fc --t2 |
|
|
46 |
done |