-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_n_dice.sh
33 lines (27 loc) · 1.03 KB
/
main_n_dice.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
#! /bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
t1=$1
mask=$2
outputdir=$3
parc=$4
dice_score=$5
if [ $# -lt 2 ]; then
echo $0: "usage: "$( basename $0 )" <t1.ext> <mask.ext> [<outputdir>]"
exit -1;
fi
echo "t1: "${t1}
echo "mask: "${mask}
input_dir=$( dirname ${t1} )
[ -z ${outputdir} ] && { outputdir=${input_dir}"/segmentation" ; }
echo "outputdir: "${outputdir}
mkdir -p ${outputdir}
output=${outputdir}'/segmentation.nii.gz'
proc_dir=${input_dir}"/proc/"
mkdir -p ${proc_dir}
reference=${SCRIPT_DIR}'/data/IMAGE_0426.nii.gz'
t1_hm=${proc_dir}'/t1_hm.nii.gz'
singularity exec -e docker://brainlife/ants:2.2.0-1bc ImageMath 3 ${t1_hm} HistogramMatch ${t1} ${reference}
chkcp_dir=${SCRIPT_DIR}
singularity exec -e --nv docker://gamorosino/bl_app_dbb_disseg python ${SCRIPT_DIR}/predict.py ${t1_hm} ${output} ${chkcp_dir} --mask ${mask} && \
python ${SCRIPT_DIR}/dice_score.py ${output} ${parc} ${dice_score}
cp ${SCRIPT_DIR}'/data/label.json' ${outputdir}