Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Energy Window Code #722

Open
wants to merge 290 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
f7f8082
checks
Jan 25, 2019
e461ee2
src/include/stir/scatter/SingleScatterLikelihoodAndGradient.h
Feb 4, 2019
73162b1
sedit
Feb 4, 2019
bc52c9e
new
Feb 8, 2019
23fabe2
upsampling
Jun 3, 2019
7cc058f
merged with MASTER
Jun 4, 2019
ad499bf
first test for upsampling
Jun 4, 2019
7210f0d
nonzero
Jun 4, 2019
5d45e16
output
Jun 4, 2019
8c5f0a5
test
Jun 4, 2019
f94a23f
okk
Jun 4, 2019
c8b0992
pull_done
Jun 4, 2019
c0c1bdb
push to check
Jun 4, 2019
b7c5179
nearly there
Jun 5, 2019
969280f
input output correct order
Jun 5, 2019
b77d127
push sampling correct notation
Jun 5, 2019
43e9e3d
solved scale issue
Jun 6, 2019
3a58151
scaling solved
Jun 6, 2019
7f79686
before changing transpose
Jun 7, 2019
ff0a1bb
push like pull
Jun 24, 2019
bad4408
read segm_in
Jun 24, 2019
b47868b
make transpose
Jun 24, 2019
f7f24d9
transpose interleaving
Jun 24, 2019
52cc03e
correct until pull transpose
Jun 26, 2019
d894538
transpose
Jun 27, 2019
9a2d595
test
Jun 27, 2019
4b5724f
ok
Jun 27, 2019
b708abb
+4
Jun 27, 2019
2e86517
before change
Jun 27, 2019
ce9c957
lower but sym
Jun 27, 2019
af22328
ok
Jun 27, 2019
df90ec3
checked offset
Jun 27, 2019
d39f5b8
ok
Jun 27, 2019
aab2bbd
ok before interleaving
Jun 27, 2019
6715ad3
comments
Jun 27, 2019
f383510
Revert "ok before interleaving"
Jun 27, 2019
d3c92e1
Merge branch 'ludovica_scatter' of https://github.com/UCL/UCL-STIR in…
Jun 27, 2019
f316acc
test
Jun 27, 2019
71729a8
commented ok
Jun 27, 2019
361fd1c
clean
Jun 27, 2019
089a7f5
okokok
Jun 27, 2019
e001945
okokok
Jun 27, 2019
b4c5e13
before removing int
Jun 27, 2019
5b9ac6d
almost done
Jun 27, 2019
e2fe6fc
ok
Jun 27, 2019
09bf533
comments
Jun 28, 2019
dbca795
interleaving fails but dim ok
Jun 28, 2019
1a84a34
unit test ok
Jun 28, 2019
aeac36b
interleaving ok
Jun 28, 2019
f55294d
boundary
Jun 28, 2019
3eaec61
check views
Jun 28, 2019
c7550f5
ok
Jun 30, 2019
6657a2f
func
Jun 30, 2019
0791203
axial
Jun 30, 2019
8f48df6
axial ok
Jun 30, 2019
4e882ab
fine okk
Jun 30, 2019
72364cd
cleaned
Jul 1, 2019
8b4a3f5
ok
Jul 1, 2019
010709d
clean 2
Jul 1, 2019
77b6075
test interpolator
Jul 2, 2019
15dacc2
test1
Jul 2, 2019
dcab687
interleaving ok
Jul 2, 2019
02af63e
errors ok
Jul 2, 2019
1db7135
cleaned
Jul 3, 2019
0478af1
works fine
Jul 4, 2019
e0e3adc
unit test
Jul 4, 2019
fc81ae6
ok
Jul 4, 2019
87d5574
test
Jul 4, 2019
c0238d8
works only for segm 0
Jul 4, 2019
3c53a9b
status
Jul 5, 2019
a0a6398
bug fixed
Jul 5, 2019
d4f2e4a
test ok
Jul 5, 2019
1b067ff
test ok
Jul 5, 2019
fb066e2
works for 0
Jul 5, 2019
7807b2e
ok
Jul 5, 2019
8f1c215
check loop
Jul 5, 2019
449d595
ssrb
Jul 6, 2019
fa10a04
ok
Jul 8, 2019
ff710e0
compiles ok
Jul 9, 2019
f36818c
todo boundary
Jul 9, 2019
ae3af2e
bound
Jul 9, 2019
3ab419d
seg 0 only
Jul 9, 2019
e8423d7
ok
Jul 9, 2019
b84729f
ok
Jul 9, 2019
b4da328
test
Jul 10, 2019
785110a
ssrb test
Jul 10, 2019
1ecc8e4
test
Jul 10, 2019
0c2ded6
random generator
Jul 10, 2019
4c0a9a4
loop
Jul 10, 2019
487855b
loop
Jul 10, 2019
bbb454b
test
Jul 10, 2019
09c79bf
add new index
Jul 10, 2019
6da59ea
missing LORs
Jul 10, 2019
29b45f7
zoom transpose
Jul 11, 2019
6de581e
new tests
Jul 11, 2019
51b7c08
random generator in test
Jul 11, 2019
3753212
added gradient from est data
Jul 15, 2019
653714e
save energy information in ROOT
Jul 15, 2019
33d7a1b
saving energy info
Jul 15, 2019
13d1fe6
changes ok
Jul 27, 2019
afbbcae
zoom and test
Jul 29, 2019
8ced950
fixed bug root
Jul 30, 2019
b90c841
test scatter
Jul 31, 2019
d4c2365
energy pair
Jul 31, 2019
ea10677
root energy
Jul 31, 2019
b108172
unlisting sino
Jul 31, 2019
833ba26
unlist root
Aug 1, 2019
0109d44
clist record
Aug 2, 2019
8a9cd4d
pu
Aug 2, 2019
4f6418c
ok
Aug 2, 2019
7473d8f
okk
Aug 2, 2019
25a0633
correct
Aug 2, 2019
0d294cc
status
Aug 2, 2019
4920e93
cleaned c++
Aug 5, 2019
ceafe3e
maximum order scatter
Aug 5, 2019
8ff6f78
detection efficiency
Aug 6, 2019
e4d8f53
remove swapping
Aug 7, 2019
bb677a8
fixed bug in root ecat
Aug 7, 2019
12080b1
fixed header
Aug 7, 2019
04db55c
ok listmode
Aug 7, 2019
a6e6ed4
detection efficiency
Aug 8, 2019
ddaa2a4
efficiency
Aug 8, 2019
8892f82
src
Aug 8, 2019
ebf28b2
can read data
Aug 9, 2019
d3a8818
test
Aug 9, 2019
a4dca12
array code
Aug 9, 2019
77a9594
checked
Aug 9, 2019
d6b07de
hardcoded for low thres
Aug 10, 2019
6c6f13f
energy
Aug 10, 2019
d422542
scatter sim
Aug 23, 2019
a500198
unit test ok with efficiency
Aug 23, 2019
90d0f1f
added normalisation
Aug 24, 2019
37177f5
fixed bug in norm
Aug 27, 2019
3faf787
mathematica
Aug 27, 2019
107335c
efficiency mathematica
Aug 27, 2019
5043f17
ssrb
Aug 28, 2019
872dcc4
set sino
Aug 28, 2019
97fa9dc
ssrb2
Aug 29, 2019
3f53570
fixed bug root ECAT
Aug 29, 2019
f84802c
set
Sep 9, 2019
3c2bdbf
extend axial
Sep 9, 2019
9fdc743
fixed
Sep 9, 2019
1cc5528
fixed boundaries
Sep 9, 2019
d7ce3a2
detection
Sep 17, 2019
9ac6357
efficiency
Sep 18, 2019
b187ddd
comment
Sep 18, 2019
065c7e2
test omp
Sep 18, 2019
37f43dd
efficiency
Sep 18, 2019
bc44e83
efficiency
Sep 18, 2019
a40d5ae
text threds
Sep 18, 2019
acd075d
changed function detection efficiency so that is faster
Sep 19, 2019
8ac5ba8
gauss
Sep 20, 2019
0811511
thread
Sep 24, 2019
ea48428
for
Sep 24, 2019
d092901
test
Sep 24, 2019
2f9504b
test
Sep 24, 2019
5bef60c
sss
Sep 24, 2019
00daf9a
new model
Sep 24, 2019
7c8b7eb
shift
Sep 25, 2019
6541912
global factor
Sep 25, 2019
ff18bd9
parentesis
Sep 25, 2019
62b9747
cleaned
Sep 25, 2019
444e957
efficiency
Sep 25, 2019
fd69048
test omp
Sep 25, 2019
2e8a6e9
segm
Sep 25, 2019
9ce9515
fix
Sep 25, 2019
b4ef92b
test
Sep 25, 2019
c4f7fef
test
Sep 25, 2019
0833218
remove for
Sep 25, 2019
4b0778a
remove for2
Sep 25, 2019
3dc006f
test 210
Sep 25, 2019
5fa6eab
code fixed
Sep 25, 2019
d32404f
sr
Sep 25, 2019
aa7400a
three terms
Sep 25, 2019
046867b
three terms2
Sep 25, 2019
cd73be4
test
Sep 25, 2019
6fd4bb6
test3
Sep 25, 2019
c821ecb
test
Sep 25, 2019
860e1f6
test ecat
Sep 27, 2019
c081302
positive crystal
Sep 27, 2019
ae7fbe5
negative
Sep 27, 2019
c8d633b
negative
Sep 27, 2019
1ca3f19
negative
Sep 27, 2019
c5c0004
fixed bug in default
Oct 2, 2019
bdb0c40
norm
Oct 8, 2019
0bcb3f3
energy threshold from listmode to projdata
Oct 17, 2019
e593384
remove scatter
Oct 21, 2019
0fdc6e4
added swapping in time and energy
Oct 22, 2019
2e133f7
scatter max angle
Oct 22, 2019
f05cd0f
swap energy
Oct 23, 2019
5bb434e
swap only window
Oct 23, 2019
d7b9b91
changed condition
Oct 23, 2019
f51f631
removed
Oct 23, 2019
8e77a61
swap new
Oct 23, 2019
e08f649
removed swapping energy in root
Oct 24, 2019
16b2f5a
cleaned lm to projdata
Oct 24, 2019
0b6d019
first step
Oct 24, 2019
43c3409
added bin
Oct 24, 2019
5df73be
added energy to bin
Oct 24, 2019
31fe279
test to see diff
Oct 24, 2019
b04b0eb
fixed bug for swig
Oct 24, 2019
d7f41c1
fixed bug constructor bin
Oct 24, 2019
057ce33
gaussian_model_and_unlisting
Oct 25, 2019
8ad5a44
my fist commit
Oct 25, 2019
cad30ce
zero grad
Nov 11, 2019
0f95dfa
typo
Apr 22, 2020
57d25ba
old commit
Apr 22, 2020
05a2a33
merged with 8th april
Apr 22, 2020
7f7cec0
edits scatter swig
Apr 22, 2020
0763557
bin
Apr 22, 2020
3d2f6c4
mergedwithNIKOS8th
Apr 30, 2020
9fa2013
src
May 2, 2020
9e6af02
src2
May 2, 2020
59d18ef
merged ok
May 2, 2020
d92eea3
tested with random hardcoded
Oct 15, 2020
639e72f
merged with july
Oct 15, 2020
57332bb
merged with master release 4 October 2020
Oct 15, 2020
4df1b05
cleaning scatter code
Oct 15, 2020
b95f50b
cleaned
Oct 15, 2020
aabc0e2
removed efficiency integrals
Oct 15, 2020
a7b9bba
ok with may 22
Oct 15, 2020
83a26c8
compiles but energy wrong
Oct 16, 2020
5983a02
unit test
Oct 16, 2020
8d26da8
test
Oct 16, 2020
5461eb6
merged with brutal fix
Oct 16, 2020
b7ffffd
remove printing
Oct 16, 2020
0bc485f
cleaned exam info
Oct 16, 2020
1438537
checkout listmode
Oct 18, 2020
72cb10d
mergeMerge branch 'master' of https://github.com/UCL/STIR into MERGED…
Oct 19, 2020
51be2aa
can read energy info
Oct 19, 2020
dfafb43
added energy window info
Oct 19, 2020
0d3389c
test
Oct 19, 2020
e20fe98
stil have to add exam info
Oct 19, 2020
919a92a
added template
Oct 19, 2020
e4e7857
listmode correct
Oct 19, 2020
38410b8
removed dependency on listenergy
Oct 20, 2020
800517e
removed unused variables for Codacy issue
Oct 20, 2020
7ac2ab8
codacy unused variables
Oct 21, 2020
f057706
Merge branch 'master' of https://github.com/UCL/STIR
Oct 21, 2020
e75bb9a
Merge branch 'master' of https://github.com/UCL/STIR into MERGED_UP_T…
Oct 21, 2020
0c9dea4
removed comment lines
Oct 21, 2020
a3d0dfc
merge
Oct 21, 2020
044b891
fixed stirextra.py for codicy
Oct 21, 2020
39773d5
codicy
Oct 21, 2020
33f646e
hdf5 fix
Oct 24, 2020
8e09e17
Merge commit '33f646e776f6f526991227ddc1d6cca931f94227' of https://gi…
Oct 24, 2020
3f6bd96
Merge branch 'master' of https://github.com/UCL/STIR into MERGED_UP_T…
Oct 24, 2020
ea09325
Merge commit '3f6bd96b3125925cccc3567cb1fcd9297891606b' of https://gi…
Oct 24, 2020
038caf8
_PI
Oct 24, 2020
5470dcf
Merge branch 'MERGED_UP_TO_DATE_OCT' of https://github.com/UCL/UCL-STIR
Oct 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions recon_test_pack/root_header.hroot
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ number of crystals_Z := 4

Singles readout depth := 1
exclude scattered events := ${EXCLUDE_SCATTERED}

;
; If set only a certain order of scatter will be kept
exclude scattered events := ${MAXIMUM_ORDER_OF_SCATTER}

;
; If set the random events will be skipped

exclude random events := ${EXCLUDE_RANDOM}
offset (num of detectors) := 0

Expand Down
25 changes: 15 additions & 10 deletions src/IO/InputStreamFromROOTFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ InputStreamFromROOTFile()
InputStreamFromROOTFile::
InputStreamFromROOTFile(std::string filename,
std::string chain_name,
bool exclude_scattered, bool exclude_randoms,
float low_energy_window, float up_energy_window,
int maximum_order_of_scatter, bool exclude_randoms,
float low_energy_window_1, float up_energy_window_1,
float low_energy_window_2, float up_energy_window_2,
int offset_dets)
: filename(filename), chain_name(chain_name),
exclude_scattered(exclude_scattered), exclude_randoms(exclude_randoms),
low_energy_window(low_energy_window), up_energy_window(up_energy_window), offset_dets(offset_dets)
maximum_order_of_scatter(maximum_order_of_scatter), exclude_randoms(exclude_randoms),
low_energy_window_1(low_energy_window_1), up_energy_window_1(up_energy_window_1),low_energy_window_2(low_energy_window_2), up_energy_window_2(up_energy_window_2), offset_dets(offset_dets)
{
set_defaults();
reset();
Expand All @@ -56,10 +57,12 @@ InputStreamFromROOTFile::set_defaults()
{
starting_stream_position = 0;
singles_readout_depth = -1;
exclude_scattered = false;
maximum_order_of_scatter = 0;
exclude_randoms = false;
low_energy_window = 0.f;
up_energy_window = 1000.f;
low_energy_window_1 = 0.f;
up_energy_window_1 = 1000.f;
low_energy_window_2 = 0.f;
up_energy_window_2 = 1000.f;
read_optional_root_fields=false;
}

Expand All @@ -69,11 +72,13 @@ InputStreamFromROOTFile::initialise_keymap()
this->parser.add_key("name of data file", &this->filename);
this->parser.add_key("Singles readout depth", &this->singles_readout_depth);
this->parser.add_key("name of input TChain", &this->chain_name);
this->parser.add_key("exclude scattered events", &this->exclude_scattered);
this->parser.add_key("maximum order of scatter", &this->maximum_order_of_scatter);
this->parser.add_key("exclude random events", &this->exclude_randoms);
this->parser.add_key("offset (num of detectors)", &this->offset_dets);
this->parser.add_key("low energy window (keV)", &this->low_energy_window);
this->parser.add_key("upper energy window (keV)", &this->up_energy_window);
this->parser.add_key("low energy window 1 (MeV)", &this->low_energy_window_1);
this->parser.add_key("upper energy window 1 (MeV)", &this->up_energy_window_1);
this->parser.add_key("low energy window 2 (MeV)", &this->low_energy_window_2);
this->parser.add_key("upper energy window 2 (MeV)", &this->up_energy_window_2);
this->parser.add_key("read optional ROOT fields", &this->read_optional_root_fields);
}

Expand Down
26 changes: 15 additions & 11 deletions src/IO/InputStreamFromROOTFileForCylindricalPET.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ InputStreamFromROOTFileForCylindricalPET(std::string _filename,
int submodule_repeater_x, int submodule_repeater_y, int submodule_repeater_z,
int module_repeater_x, int module_repeater_y, int module_repeater_z,
int rsector_repeater,
bool _exclude_scattered, bool _exclude_randoms,
float _low_energy_window, float _up_energy_window,
int _maximum_order_of_scatter, bool _exclude_randoms,
float _low_energy_window_1, float _up_energy_window_1,
float _low_energy_window_2, float _up_energy_window_2,
int _offset_dets):
base_type(),
crystal_repeater_x(crystal_repeater_x), crystal_repeater_y(crystal_repeater_y), crystal_repeater_z(crystal_repeater_z),
Expand All @@ -51,10 +52,12 @@ InputStreamFromROOTFileForCylindricalPET(std::string _filename,

filename = _filename;
chain_name = _chain_name;
exclude_scattered = _exclude_scattered;
maximum_order_of_scatter = _maximum_order_of_scatter;
exclude_randoms = _exclude_randoms;
low_energy_window = _low_energy_window;
up_energy_window = _up_energy_window;
low_energy_window_1 = _low_energy_window_1;
up_energy_window_1 = _up_energy_window_1;
low_energy_window_2 = _low_energy_window_2;
up_energy_window_2 = _up_energy_window_2;
offset_dets = _offset_dets;

half_block = module_repeater_y * submodule_repeater_y * crystal_repeater_y / 2 - 1;
Expand All @@ -78,14 +81,14 @@ get_next_record(CListRecordROOT& record)

current_position ++ ;

if ( (this->comptonphantom1 > 0 || this->comptonphantom2 > 0) && this->exclude_scattered )
if (comptonphantom1 + comptonphantom2 > maximum_order_of_scatter)
continue;
if ( (this->eventID1 != this->eventID2) && this->exclude_randoms)
continue;
if (this->energy1 < this->low_energy_window ||
this->energy1 > this->up_energy_window ||
this->energy2 < this->low_energy_window ||
this->energy2 > this->up_energy_window)
if (this->energy1 < this->low_energy_window_1 ||
this->energy1 > this->up_energy_window_1 ||
this->energy2 < this->low_energy_window_2||
this->energy2 > this->up_energy_window_2)
continue;

break;
Expand Down Expand Up @@ -122,7 +125,8 @@ get_next_record(CListRecordROOT& record)
record.init_from_data(ring1, ring2,
crystal1, crystal2,
time1, time2,
eventID1, eventID2);
eventID1, eventID2,
energy1,energy2);
}

std::string
Expand Down
26 changes: 15 additions & 11 deletions src/IO/InputStreamFromROOTFileForECATPET.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ InputStreamFromROOTFileForECATPET(std::string _filename,
std::string _chain_name,
int crystal_repeater_x, int crystal_repeater_y, int crystal_repeater_z,
int block_repeater_y, int block_repeater_z,
bool _exclude_scattered, bool _exclude_randoms,
float _low_energy_window, float _up_energy_window,
int _maximum_order_of_scater, bool _exclude_randoms,
float _low_energy_window_1, float _up_energy_window_1,
float _low_energy_window_2, float _up_energy_window_2,
int _offset_dets):
base_type(),
crystal_repeater_x(crystal_repeater_x), crystal_repeater_y(crystal_repeater_y), crystal_repeater_z(crystal_repeater_z),
Expand All @@ -48,10 +49,12 @@ InputStreamFromROOTFileForECATPET(std::string _filename,

filename = _filename;
chain_name = _chain_name;
exclude_scattered = _exclude_scattered;
maximum_order_of_scatter = _maximum_order_of_scater;
exclude_randoms = _exclude_randoms;
low_energy_window = _low_energy_window;
up_energy_window = _up_energy_window;
low_energy_window_1 = _low_energy_window_1;
up_energy_window_1 = _up_energy_window_1;
low_energy_window_2 = _low_energy_window_2;
up_energy_window_2 = _up_energy_window_2;
offset_dets = _offset_dets;

half_block = crystal_repeater_y / 2 - 1;
Expand All @@ -74,14 +77,14 @@ get_next_record(CListRecordROOT& record)

current_position ++ ;

if ( (comptonphantom1 > 0 || comptonphantom2 > 0) && exclude_scattered )
if (comptonphantom1 + comptonphantom2 > maximum_order_of_scatter)
continue;
if ( eventID1 != eventID2 && exclude_randoms )
continue;
if (energy1 < low_energy_window ||
energy1 > up_energy_window ||
energy2 < low_energy_window ||
energy2 > up_energy_window)
if (this->energy1 < this->low_energy_window_1 ||
this->energy1 > this->up_energy_window_1 ||
this->energy2 < this->low_energy_window_2||
this->energy2 > this->up_energy_window_2)
continue;

break;
Expand Down Expand Up @@ -112,7 +115,8 @@ get_next_record(CListRecordROOT& record)
record.init_from_data(ring1, ring2,
crystal1, crystal2,
time1, time2,
eventID1, eventID2);
eventID1, eventID2,
energy1,energy2);
}

std::string
Expand Down
84 changes: 63 additions & 21 deletions src/IO/InterfileHeader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void MinimalInterfileHeader::set_version_specific_keys()
InterfileHeader::InterfileHeader()
: MinimalInterfileHeader()
{

number_format_values.push_back("bit");
number_format_values.push_back("ascii");
number_format_values.push_back("signed integer");
Expand Down Expand Up @@ -171,6 +172,7 @@ InterfileHeader::InterfileHeader()




add_key("name of data file", &data_file_name);
add_key("originating system", &exam_info_sptr->originating_system);
ignore_key("GENERAL DATA");
Expand Down Expand Up @@ -221,15 +223,16 @@ InterfileHeader::InterfileHeader()
// support for Louvain la Neuve's extension of 3.3
add_key("quantification units", &lln_quantification_units);

add_key("number of energy windows",
KeyArgument::INT, (KeywordProcessor)&InterfileHeader::read_num_energy_windows,&num_energy_windows);
add_key("energy window pair", KeyArgument::LIST_OF_INTS, (KeywordProcessor)&InterfileHeader::en_window_pair_set, &energy_window_pair);
add_key("number of energy windows", KeyArgument::INT, (KeywordProcessor)&InterfileHeader::read_num_energy_windows,&num_energy_windows);
add_vectorised_key("energy window lower level", &lower_en_window_thresholds);
add_vectorised_key("energy window upper level", &upper_en_window_thresholds);

bed_position_horizontal = 0.F;
add_key("start horizontal bed position (mm)", &bed_position_horizontal);
bed_position_vertical = 0.F;
add_key("start vertical bed position (mm)", &bed_position_vertical);

}

void InterfileHeader::set_version_specific_keys()
Expand All @@ -239,16 +242,17 @@ void InterfileHeader::set_version_specific_keys()
{
info("Setting energy window keys as in STIR3.0");
// only a single energy window, and non-vectorised
remove_key("energy window lower level");
/*remove_key("energy window lower level");
remove_key("energy window upper level");
add_key("energy window lower level", &lower_en_window_thresholds[0]);
add_key("energy window upper level", &upper_en_window_thresholds[0]);
add_key("energy window upper level", &upper_en_window_thresholds[0]);*/
}
}

// MJ 17/05/2000 made bool
bool InterfileHeader::post_processing()
{

if(type_of_data_index<0)
{
warning("Interfile Warning: 'type_of_data' keyword required");
Expand Down Expand Up @@ -365,19 +369,45 @@ bool InterfileHeader::post_processing()
lln_quantification_units);
}
} // lln_quantification_units
if (num_energy_windows>0)
{
if (num_energy_windows>1)
warning("Currently only reading the first energy window.");
if (upper_en_window_thresholds[0] > 0 && lower_en_window_thresholds[0] > 0 )
{
exam_info_sptr->set_high_energy_thres(upper_en_window_thresholds[0]);
exam_info_sptr->set_low_energy_thres(lower_en_window_thresholds[0]);
}
}


//set the lower and the higher energy thresholds for all the energy windows available. Default: 1.

//set the number of energy windows

exam_info_sptr->set_num_energy_windows(num_energy_windows);

//set the number of energy window pair
if (energy_window_pair.size() > 0) {

if (energy_window_pair.size() != 2)
error("should have two.");
if (energy_window_pair[0] < 0)
error("first window should be >= 0.");
if (energy_window_pair[1] < 0)
error("second window should be >= 0.");
if (energy_window_pair[0] > num_energy_windows)
error("The selected window %d exceeds the number of energy windows %d.\n",energy_window_pair[0],num_energy_windows);
if (energy_window_pair[1] > num_energy_windows)
error("The selected window %d exceeds the number of energy windows %d.\n",energy_window_pair[1],num_energy_windows);

exam_info_sptr->set_energy_window_pair(energy_window_pair);
}

//set the high and low energy window threshold

for (int i = 0; i < num_energy_windows; ++i)
{

if (upper_en_window_thresholds[i] >0 && lower_en_window_thresholds[i] >0)
{
exam_info_sptr->set_high_energy_thres(upper_en_window_thresholds[i],i);
exam_info_sptr->set_low_energy_thres(lower_en_window_thresholds[i],i);
}
}

exam_info_sptr->time_frame_definitions =
TimeFrameDefinitions(image_relative_start_times, image_durations);
TimeFrameDefinitions(image_relative_start_times, image_durations);

return false;

Expand All @@ -393,6 +423,14 @@ void InterfileHeader::read_matrix_info()

}

void InterfileHeader::en_window_pair_set()
{

energy_window_pair.resize(2);
set_variable();


}
void InterfileHeader::read_num_energy_windows()
{
set_variable();
Expand Down Expand Up @@ -420,7 +458,7 @@ void InterfileHeader::set_type_of_data()
&PET_data_type_values);
ignore_key("process status");
ignore_key("IMAGE DATA DESCRIPTION");
// TODO rename keyword
// TODO rename keyword
add_vectorised_key("data offset in bytes", &data_offset_each_dataset);

}
Expand Down Expand Up @@ -499,6 +537,7 @@ bool InterfileImageHeader::post_processing()
if (InterfileHeader::post_processing() == true)
return true;


if (PET_data_type_values[PET_data_type_index] != "Image")
{ warning("Interfile error: expecting an image\n"); return true; }

Expand Down Expand Up @@ -633,6 +672,9 @@ void InterfilePDFSHeader::resize_segments_and_set()

}




int InterfilePDFSHeader::find_storage_order()
{

Expand Down Expand Up @@ -1312,12 +1354,12 @@ bool InterfilePDFSHeader::post_processing()
scanner_ptr_from_file->parameter_info().c_str());
}


// float azimuthal_angle_sampling =_PI/num_views;




if (is_arccorrected)
{
if (effective_central_bin_size_in_cm <= 0)
Expand Down