-
Notifications
You must be signed in to change notification settings - Fork 12
/
run_reconstructions.sh
executable file
·71 lines (56 loc) · 2.35 KB
/
run_reconstructions.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
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
#! /bin/sh -e
# This script does everything in one go. You might want to execute the steps one by one.
# It is called by run_reconstruction_brain.sh etc and assumed that
# certain par files and input data are available in the current directory
if test -r FBP2D.par
then
echo "Running reconstructions. Files are/will be in"
echo " `pwd`"
else
echo "I do not find FBP2D.par in the current directory."
echo "You might be executing this script directly as opposed to via"
echo "run_reconstruction_brain.sh etc."
echo "Aborting."
exit 1
fi
# running FBP, but need to know if PET or SPECT for precorrections
if test -r my_prompts.hs
then
# PET
echo "running precorrection and FBP"
stir_math -s --mult norm_ac_prompts.hs my_prompts.hs my_multfactors.hs > precorrection.log 2>&1
stir_subtract -s precorrected.hs norm_ac_prompts.hs my_additive_sinogram.hs >> precorrection.log 2>&1
elif test -r my_sim.hs
then
# SPECT
# no precorrections
echo "running FBP (without attenuation correction)"
else
echo "I find no data in the folder."
echo "Expecting either my_prompts.hs or my_sim.hs."
echo "Did you run the simulation?"
echo "Aborting."
exit 1
fi
FBP2D FBP2D.par > FBP2D.log 2>&1
echo "running EMML 240 iterations (this might take a while)"
OSMAPOSL EMML.par > EMML.log 2>&1
echo filtering the end result
postfilter filtered_EMML_240.hv EMML_240.hv postfilter_Gaussian.par > postfilter_EMML.log 2>&1
echo running OSEM 240 subiterations
OSMAPOSL OSEM.par > OSEM.log 2>&1
echo filtering the end result
postfilter filtered_OSEM_240.hv OSEM_240.hv postfilter_Gaussian.par > postfilter_OSEM.log 2>&1
echo "continue OSEM from 240 sub-iterations onwards, saving every sub-iteration"
OSMAPOSL OSEMcont.par > OSEMcont.log 2>&1
echo "continue EMML from 240 iterations onwards, saving every iteration"
OSMAPOSL EMMLcont.par > EMMLcont.log 2>&1
#echo running OSEM with PSF
#OSMAPOSL OSEMPSF.par > OSEMPSF.log 2>&1
echo filtering the end result
postfilter filtered_OSEM_240.hv OSEM_240.hv postfilter_Gaussian.par > postfilter_OSEM.log 2>&1
echo "Creating ground_truth.hv (with same voxel-size as the reconstruction)"
zoom_image --template OSEM_24.hv ground_truth.hv emission.hv
# rescale to STIR units used by the reconstruction
zoom_image --scaling preserve_projections --template OSEM_24.hv ground_truth.hv emission.hv
echo DONE