Commit 899f0550 authored by Kevin Bronik's avatar Kevin Bronik

Upload New File

parent fd7fea5d
#!/bin/bash
# Copyright (C) 2019 UCL
#
# Developed at Department of Medical Physics and Biomedical Engineering
# University, UCL, UK
#
#
# This software/script calculates all the following important performance metrics:
# Dice Similarity Index(SI)
# Sensitivity
# Precision
# Specificity
# Jaccardindex
# Conformity
# HausdorffDistance
# Overlapcoefficient
# Tanimotocoefficient
# Matthewscorrelationcoefficient
# Accuracy
# Voxel-level false discovery rate(FDR)
# Voxel-level false negative ratio(FNR)
# Cluster-level FDR
# Cluster-level FNR
# Detection error rate(DER)
# utline error rate(OER)
# Mean Total Area(MTA)
# Volume of segmentation
# Volume of manual mask
if [ $# -lt 1 ] ; then
echo "Usage: `basename $0` <lesionmask> <threshold> <manualmask> <foldershortname> <modelname> <distancefunction> <factor> <symmetry> <weight> <p_norm> <saveoutput>"
echo " "
echo "For example:
bash RunMe.sh *lesionmask*.nii.gz 0.5 *manualmask*.nii.gz testing modeldatatrain euclidean mean symmetric 1.0 2.0 1"
echo " "
echo "The script calculates measures of overlap between the lesion mask generated by any algorithm and the manual mask and lesion volumes of both"
echo " "
echo "Threshold = probability threshold that will be applied to output before calculation of the overlap measures"
echo " "
echo "Saveoutput = if set to 0 it will output the measures' names and values on the screen with the following format:"
echo "
# Dice Similarity Index(SI)
# Sensitivity
# Precision
# Specificity
# Jaccardindex
# Conformity
# HausdorffDistance
# Overlapcoefficient
# Tanimotocoefficient
# Matthewscorrelationcoefficient
# Accuracy
# Voxel-level false discovery rate(FDR)
# Voxel-level false negative ratio(FNR)
# Cluster-level FDR
# Cluster-level FNR
# Detection error rate(DER)
# utline error rate(OER)
# Mean Total Area(MTA)
# Volume of segmentation
# Volume of manual mask"
echo " "
echo "-If Saveoutput set to 1 it will save only the values (in the same order) in a .txt filethe output file will be saved in the same folder of the lesion mask with the name Overlap_and_Volumes_<lesionmask>_<threshold>.txt"
exit 1
fi
lesionmask=$1
threshold=$2
manualmask=$3
foldershortname=$4
modelname=$5
distancefunction=$6
factor=$7
symmetry=$8
weight=$9
p_norm=${10}
saveoutput=${11}
if [ -z "$lesionmask" ] || [ -z "$threshold" ] || [ -z "$manualmask" ] || [ -z "$foldershortname" ] || [ -z "$modelname" ] || [ -z "$distancefunction" ] || [ -z "$factor" ] || [ -z "$symmetry" ] || [ -z "$weight" ] || [ -z "$p_norm" ] || [ -z "$saveoutput" ] ; then
clear
echo "Please try again and enter the required arguments"
echo "For example:
bash RunMe.sh *lesionmask*.nii.gz 0.5 *manualmask*.nii.gz testing modeldatatrain euclidean mean symmetric 1.0 2.0 1"
exit
else
continue
fi
for f in $(find *${foldershortname}* -type d);
do
echo "Preprocessing on the folder: "$f
# mv ${file/_flair3D.nii.gz}* /home/kbronik/Desktop/STARTINGNEWTEST/ms-smart/${file/_flair3D.nii.gz}_training
cp universal_HD.py $f
cp performanceanalysis $f
cp $f/${modelname}/* $f
rm -rf $f/tmp
rm -rf $f/${modelname}
done
echo -e "Dice Similarity Index(SI)[1] \nSensitivity[2] \nPrecision[3] \nSpecificity[4] \nJaccardindex[5] \nConformity[6] \n${factor}${symmetry}HausdorffDistance[7] \nOverlapcoefficient[8] \nTanimotocoefficient[9] \nMatthewscorrelationcoefficient[10] \nAccuracy[11] \nVoxel-level false discovery rate(FDR)[12] \nVoxel-level false negative ratio(FNR)[13] \nCluster-level FDR[14] \nCluster-level FNR[15] \nDetection error rate(DER)[16] \nOutline error rate(OER)[17] \nMean Total Area(MTA)[18] \nVolume of segmentation[19] \nVolume of manual mask[20]" >> final_result.txt
echo -e "[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]" >> final_result.txt
clear
for folder in $(find *${foldershortname}* -type d);
do
echo "Calculation of performance metrics will be processed on the folder: "$folder
bash $folder/performanceanalysis $folder/*${lesionmask}* ${threshold} $folder/*${manualmask}* ${distancefunction} ${factor} ${symmetry} ${weight} ${p_norm} ${saveoutput}}
# mv $file /home/kbronik/Desktop/STARTINGNEWTEST/olddata/$file
rm -rf $folder/tmp
rm -rf $folder/${modelname}
done
echo "All calculation of performance metrics finished and completed"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment