Skip to content

Commit

Permalink
Root data energy information is converted to keV instead of MeV (#736)
Browse files Browse the repository at this point in the history
* Root data energy information is converted to keV instead of MeV

This is done only in the when reading energy information.

* Remove unnecessary #include

* 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

* Updates release notes [ci skip]
  • Loading branch information
robbietuk authored Nov 9, 2020
1 parent 535a83a commit a828e45
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions documentation/STIR-UsersGuide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions documentation/release_4.1.htm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ <h3>Minor bug fixes</h3>
Changes to GATE/root cylindrical PET geometry interpretation,
see <a href="https://github.com/UCL/STIR/pull/569">PR 569</a>.</li>
</li>
<li>
OpenGATE energy information is MeV. Added a method to convert between MeV to (STIR convention) keV units when
reading root files.
</li>
</ul>

<h3>Documentation changes</h3>
Expand Down
9 changes: 5 additions & 4 deletions src/IO/InputStreamFromROOTFileForCylindricalPET.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,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->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;
Expand Down
9 changes: 5 additions & 4 deletions src/IO/InputStreamFromROOTFileForECATPET.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,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 (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;
Expand Down
6 changes: 6 additions & 0 deletions src/include/stir/IO/InputStreamFromROOTFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ class InputStreamFromROOTFile : public RegisteredObject< InputStreamFromROOTFile
//! (<a href="http://wiki.opengatecollaboration.org/index.php/Users_Guide_V7.2:Digitizer_and_readout_parameters">here</a> )
//! > 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
Expand Down

0 comments on commit a828e45

Please sign in to comment.