From 41a51366326190f1ae0b4d860972f1bcdc4d1c76 Mon Sep 17 00:00:00 2001 From: Robert Twyman Date: Sat, 7 Nov 2020 17:50:31 +0000 Subject: [PATCH 1/4] Root data energy information is converted to keV instead of MeV This is done only in the when reading energy information. --- src/IO/InputStreamFromROOTFileForCylindricalPET.cxx | 10 ++++++---- src/IO/InputStreamFromROOTFileForECATPET.cxx | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx index 514e07656b..ee87ea9c6d 100644 --- a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx +++ b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx @@ -16,6 +16,7 @@ See STIR/LICENSE.txt for details */ #include "stir/IO/InputStreamFromROOTFileForCylindricalPET.h" +#include START_NAMESPACE_STIR @@ -81,10 +82,11 @@ get_next_record(CListRecordROOT& record) 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) + //multiply here by 1000 to convert the list mode energy from MeV to keV + if (this->energy1*1000 < this->low_energy_window || + this->energy1*1000 > this->up_energy_window || + this->energy2*1000 < this->low_energy_window || + this->energy2*1000 > this->up_energy_window) continue; break; diff --git a/src/IO/InputStreamFromROOTFileForECATPET.cxx b/src/IO/InputStreamFromROOTFileForECATPET.cxx index 345aa77cf3..1c2f4369cc 100644 --- a/src/IO/InputStreamFromROOTFileForECATPET.cxx +++ b/src/IO/InputStreamFromROOTFileForECATPET.cxx @@ -17,6 +17,7 @@ */ #include "stir/IO/InputStreamFromROOTFileForECATPET.h" +#include START_NAMESPACE_STIR @@ -77,10 +78,11 @@ get_next_record(CListRecordROOT& record) continue; if ( eventID1 != eventID2 && exclude_randoms ) continue; - if (energy1 < low_energy_window || - energy1 > up_energy_window || - energy2 < low_energy_window || - energy2 > up_energy_window) + //multiply here by 1000 to convert the list mode energy from MeV to keV + if (energy1*1000 < low_energy_window || + energy1*1000 > up_energy_window || + energy2*1000 < low_energy_window || + energy2*1000 > up_energy_window) continue; break; From ffa7fb95ef57bf20116d7679fbc3d44ab2f68593 Mon Sep 17 00:00:00 2001 From: Robert Twyman Date: Sat, 7 Nov 2020 17:56:02 +0000 Subject: [PATCH 2/4] Remove unnecessary #include --- src/IO/InputStreamFromROOTFileForCylindricalPET.cxx | 1 - src/IO/InputStreamFromROOTFileForECATPET.cxx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx index ee87ea9c6d..372650a11b 100644 --- a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx +++ b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx @@ -16,7 +16,6 @@ See STIR/LICENSE.txt for details */ #include "stir/IO/InputStreamFromROOTFileForCylindricalPET.h" -#include START_NAMESPACE_STIR diff --git a/src/IO/InputStreamFromROOTFileForECATPET.cxx b/src/IO/InputStreamFromROOTFileForECATPET.cxx index 1c2f4369cc..c65b29498b 100644 --- a/src/IO/InputStreamFromROOTFileForECATPET.cxx +++ b/src/IO/InputStreamFromROOTFileForECATPET.cxx @@ -17,7 +17,6 @@ */ #include "stir/IO/InputStreamFromROOTFileForECATPET.h" -#include START_NAMESPACE_STIR From 97273695ae069f801ebbbbef0272712bddb664f2 Mon Sep 17 00:00:00 2001 From: Robert Twyman Date: Mon, 9 Nov 2020 15:36:16 +0000 Subject: [PATCH 3/4] get energy information in keV functions. Update ROOT documentation Clean up the conversion of energy information to keV using methods. Updates the documentation regarding ROOT energy units and the conversion --- documentation/STIR-UsersGuide.tex | 4 ++++ src/IO/InputStreamFromROOTFileForCylindricalPET.cxx | 8 ++++---- src/IO/InputStreamFromROOTFileForECATPET.cxx | 8 ++++---- src/include/stir/IO/InputStreamFromROOTFile.h | 6 ++++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/documentation/STIR-UsersGuide.tex b/documentation/STIR-UsersGuide.tex index bc0bb6bd65..9a48b5b446 100644 --- a/documentation/STIR-UsersGuide.tex +++ b/documentation/STIR-UsersGuide.tex @@ -774,6 +774,10 @@ \subsubsection{ROOT files as output by OpenGATE} See \texttt{examples/samples/root\_headerECAT.hroot} for an example using the ECAT system. +OpenGATE energy information is recorded in MeV units into the ROOT file. +For STIR files, e.g. \texttt{.hroot} and \texttt{.hs}, should use keV units. +STIR assumes this convention and will convert this automatically. + There are some unfinished classes available on the \textit{STIR} web-site to read \textit{LMF} format files, in conjunction with the \textit{LMF} library. However, these might be obsolete diff --git a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx index 372650a11b..169818a727 100644 --- a/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx +++ b/src/IO/InputStreamFromROOTFileForCylindricalPET.cxx @@ -82,10 +82,10 @@ get_next_record(CListRecordROOT& record) if ( (this->eventID1 != this->eventID2) && this->exclude_randoms) continue; //multiply here by 1000 to convert the list mode energy from MeV to keV - if (this->energy1*1000 < this->low_energy_window || - this->energy1*1000 > this->up_energy_window || - this->energy2*1000 < this->low_energy_window || - this->energy2*1000 > this->up_energy_window) + if (this->get_energy1_in_keV() < this->low_energy_window || + this->get_energy1_in_keV() > this->up_energy_window || + this->get_energy2_in_keV() < this->low_energy_window || + this->get_energy2_in_keV() > this->up_energy_window) continue; break; diff --git a/src/IO/InputStreamFromROOTFileForECATPET.cxx b/src/IO/InputStreamFromROOTFileForECATPET.cxx index c65b29498b..0321dac1a9 100644 --- a/src/IO/InputStreamFromROOTFileForECATPET.cxx +++ b/src/IO/InputStreamFromROOTFileForECATPET.cxx @@ -78,10 +78,10 @@ get_next_record(CListRecordROOT& record) if ( eventID1 != eventID2 && exclude_randoms ) continue; //multiply here by 1000 to convert the list mode energy from MeV to keV - if (energy1*1000 < low_energy_window || - energy1*1000 > up_energy_window || - energy2*1000 < low_energy_window || - energy2*1000 > up_energy_window) + if (this->get_energy1_in_keV() < low_energy_window || + this->get_energy1_in_keV() > up_energy_window || + this->get_energy2_in_keV() < low_energy_window || + this->get_energy2_in_keV() > up_energy_window) continue; break; diff --git a/src/include/stir/IO/InputStreamFromROOTFile.h b/src/include/stir/IO/InputStreamFromROOTFile.h index 87f082177a..fd4ec1acef 100644 --- a/src/include/stir/IO/InputStreamFromROOTFile.h +++ b/src/include/stir/IO/InputStreamFromROOTFile.h @@ -204,6 +204,12 @@ class InputStreamFromROOTFile : public RegisteredObject< InputStreamFromROOTFile //! (here ) //! > the readout depth depends upon how the electronic readout functions. int singles_readout_depth; + + //! OpenGATE output ROOT energy information is given in MeV, these methods convert to keV + float get_energy1_in_keV() const + { return energy1 * 1e3; }; + float get_energy2_in_keV() const + { return energy2 * 1e3; }; }; END_NAMESPACE_STIR From 17d93d3b15826bb41200939a219141ed3322240a Mon Sep 17 00:00:00 2001 From: Robert Twyman Date: Mon, 9 Nov 2020 15:58:18 +0000 Subject: [PATCH 4/4] Updates release notes [ci skip] --- documentation/release_4.1.htm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/release_4.1.htm b/documentation/release_4.1.htm index d5761fefc6..3b7481c3b4 100644 --- a/documentation/release_4.1.htm +++ b/documentation/release_4.1.htm @@ -117,6 +117,10 @@

Minor bug fixes

Changes to GATE/root cylindrical PET geometry interpretation, see PR 569. +
  • + OpenGATE energy information is MeV. Added a method to convert between MeV to (STIR convention) keV units when + reading root files. +
  • Documentation changes