Skip to content

Commit

Permalink
cope better with Siemens Interfile date/time keywords
Browse files Browse the repository at this point in the history
make a function that ignores keyword for all (?) time zones
  • Loading branch information
KrisThielemans committed Sep 30, 2023
1 parent 1eac3fb commit 9fd6729
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 17 deletions.
53 changes: 36 additions & 17 deletions src/IO/InterfileHeaderSiemens.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/*!
\file
\ingroup InterfileIO
\brief implementations for the stir::InterfileHeaderSiemens class
\brief implementations for the stir::InterfileHeaderSiemens classes
\author Kris Thielemans
\author PARAPET project
Expand Down Expand Up @@ -163,6 +163,36 @@ void InterfileHeaderSiemens::set_type_of_data()
}


void
InterfileHeaderSiemens::ignore_Siemens_date_and_time_keys(const std::string& keyword)
{
ignore_key(keyword + " date (yyyy:mm:dd)");
ignore_key(keyword + " time (hh:mm:ss GMT+00:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+01:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+02:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+03:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+04:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+05:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+06:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+07:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+08:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+09:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+10:00)");
ignore_key(keyword + " time (hh:mm:ss GMT+11:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-01:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-02:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-03:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-04:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-05:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-06:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-07:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-08:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-09:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-10:00)");
ignore_key(keyword + " time (hh:mm:ss GMT-11:00)");
}


/**********************************************************************/

InterfileRawDataHeaderSiemens::InterfileRawDataHeaderSiemens()
Expand Down Expand Up @@ -205,13 +235,11 @@ InterfileRawDataHeaderSiemens::InterfileRawDataHeaderSiemens()
ignore_key("%listmode header file");
ignore_key("%listmode data file");
ignore_key("%compressor version");
ignore_key("%study date (yyyy");
ignore_key("%study time (hh");
ignore_Siemens_date_and_time_keys("%study");
ignore_key("isotope gamma halflife (sec)");
ignore_key("isotope branching factor");
ignore_key("radiopharmaceutical");
ignore_key("%tracer injection date (yyyy");
ignore_key("%tracer injection time (hh");
ignore_Siemens_date_and_time_keys("%tracer injection");
ignore_key("relative time of tracer injection (sec)");
ignore_key("tracer activity at time of injection (bq)");
ignore_key("injected volume (ml)");
Expand All @@ -223,8 +251,7 @@ InterfileRawDataHeaderSiemens::InterfileRawDataHeaderSiemens()
ignore_key("method of scatter correction");
ignore_key("%method of random correction");
ignore_key("%decay correction");
ignore_key("%decay correction reference date (yyyy");
ignore_key("%decay correction reference time (hh");
ignore_Siemens_date_and_time_keys("%decay correction reference");
ignore_key("decay correction factor");
ignore_key("scatter fraction (%)");
ignore_key("scan data type description");
Expand Down Expand Up @@ -542,11 +569,7 @@ InterfileNormHeaderSiemens::InterfileNormHeaderSiemens()
is_arccorrected = false; // norm data is never arc-corrected

ignore_key("data description");
ignore_key("%expiration date (yyyy:mm:dd)");
ignore_key("%expiration time (hh:mm:ss GMT-05:00)");
// currently keywords are truncated at :
ignore_key("%expiration time (hh");
ignore_key("%expiration date (yyyy");
ignore_Siemens_date_and_time_keys("%expiration");
ignore_key("%raw normalization scans description");

// remove some standard keys, which Siemens has replaced with similar names
Expand All @@ -573,11 +596,7 @@ InterfileNormHeaderSiemens::InterfileNormHeaderSiemens()
ignore_key("%global scanner calibration factor");
add_key("%scanner quantification factor (Bq*s/ECAT counts)",& calib_factor);
add_key("%cross calibration factor",& cross_calib_factor);
ignore_key("%calibration date (yyyy:mm:dd)");
ignore_key("%calibration time (hh:mm:ss GMT+00:00)");
// currently keywords are truncated at :
ignore_key("%calibration time (hh");
ignore_key("%calibration date (yyyy");
ignore_Siemens_date_and_time_keys("%calibration");

// isotope things are vectorised in norm files and not in other raw data, so we could
// fix that, but as we are not interested in it anyway (tends to be Ge-68), let's just ignore it.
Expand Down
13 changes: 13 additions & 0 deletions src/include/stir/IO/InterfileHeaderSiemens.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ class InterfileHeaderSiemens : public InterfileHeader
protected:
// Returns false if OK, true if not.
virtual bool post_processing();
//! ignore multiple GMT times
/*!
Siemens uses keywords like
\verbatim
%study date (yyyy:mm:dd") := ...
%study time (hh:mm:ss GMT+00:00) := ...
\endvarbatim
You can ignore this for all (?) time zones by using
\code
ignore_Siemens_date_and_time_keys("%study");
\endcode
*/
void ignore_Siemens_date_and_time_keys(const std::string& keyword);

private:

Expand Down

0 comments on commit 9fd6729

Please sign in to comment.