File size: 4,212 Bytes
e4b9a7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
set -e
# script for running the examples


# install necessary packages
pip install numpy
pip install torch
pip install 'monai[nibabel]'


# home directory
homedir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TEMP_LOG="temp.txt"

cd "$homedir"
find "$homedir" -type f -name $TEMP_LOG -delete


# download data to specific directory
if [ -e "./testing_ixi_t1.tar.gz" ] && [ -d "./workspace/" ]; then
	echo "1" >> $TEMP_LOG
else
	wget  https://www.dropbox.com/s/y890gb6axzzqff5/testing_ixi_t1.tar.gz?dl=1
        mv testing_ixi_t1.tar.gz?dl=1 testing_ixi_t1.tar.gz
        mkdir -p ./workspace/data/medical/ixi/IXI-T1/
        tar -C ./workspace/data/medical/ixi/IXI-T1/ -xf testing_ixi_t1.tar.gz
fi


# run training files in examples/classification_3d
for file in "examples/classification_3d"/*train*
do
    python "$file"
done

# check training files generated from examples/classification_3d
[ -e "./best_metric_model_classification3d_array.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples classification_3d: model file not generated" | tee $TEMP_LOG && exit 0)
[ -e "./best_metric_model_classification3d_dict.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples classification_3d: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval files in examples/classification_3d
for file in "examples/classification_3d"/*eval*
do
    python "$file"
done


# run training files in examples/classification_3d_ignite
for file in "examples/classification_3d_ignite"/*train*
do
    python "$file"
done

# check training files generated from examples/classification_3d_ignite
[ -e "./runs_array/net_checkpoint_20.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples classification_3d_ignite: model file not generated" | tee $TEMP_LOG && exit 0)
[ -e "./runs_dict/net_checkpoint_20.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples classification_3d_ignite: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval files in examples/classification_3d_ignite
for file in "examples/classification_3d_ignite"/*eval*
do
    python "$file"
done


# run training files in examples/segmentation_3d
for file in "examples/segmentation_3d"/*train*
do
    python "$file"
done

# check training files generated from examples/segmentation_3d
[ -e "./best_metric_model_segmentation3d_array.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples segmentation_3d: model file not generated" | tee $TEMP_LOG && exit 0)
[ -e "./best_metric_model_segmentation3d_dict.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples segmentation_3d: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval files in examples/segmentation_3d
for file in "examples/segmentation_3d"/*eval*
do
    python "$file"
done


# run training files in examples/segmentation_3d_ignite
for file in "examples/segmentation_3d_ignite"/*train*
do
    python "$file"
done

# check training files generated from examples/segmentation_3d_ignite
[ -e "./runs_array/net_checkpoint_100.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples segmentation_3d_ignite: model file not generated" | tee $TEMP_LOG && exit 0)
[ -e "./runs_dict/net_checkpoint_50.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples segmentation_3d_ignite: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval files in examples/segmentation_3d_ignite
for file in "examples/segmentation_3d_ignite"/*eval*
do
    python "$file"
done


# run training file in examples/workflows
for file in "examples/workflows"/*train*
do
    python "$file"
done

# check training file generated from examples/workflows
[ -e "./runs/net_key_metric*.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples workflows: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval file in examples/workflows
for file in "examples/workflows"/*eval*
do
    python "$file"
done


# run training file in examples/synthesis
for file in "examples/synthesis"/*train*
do
    python "$file"
done

# check training file generated from examples/synthesis
[ -e "./model_out/*.pth" ] && echo "1" >> $TEMP_LOG || (echo "examples synthesis: model file not generated" | tee $TEMP_LOG && exit 0)

# run eval file in examples/synthesis
for file in "examples/synthesis"/*eval*
do
    python "$file"
done