Skip to content

Commit

Permalink
Merge pull request #1327 from KrisThielemans/ParsingFixes
Browse files Browse the repository at this point in the history
fix Interfile parsing of isotope_name and %TOF mashing factor for Siemens
  • Loading branch information
KrisThielemans authored Jan 13, 2024
2 parents faa781c + 850bb18 commit e8f2dd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/IO/InterfileHeader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ InterfileHeader::InterfileHeader()

radionuclide_name.resize(1);
radionuclide_half_life.resize(1);
radionuclide_half_life[1] = -1.F;
radionuclide_half_life[0] = -1.F;
radionuclide_branching_ratio.resize(1);
radionuclide_branching_ratio[0] = -1.F;

Expand All @@ -179,7 +179,7 @@ InterfileHeader::InterfileHeader()
ignore_key("GENERAL IMAGE DATA");

add_key("calibration factor", &calibration_factor);
// deprecated
// deprecated, but used by Siemens
add_key("isotope name", &isotope_name);
ignore_key("number of radionuclides"); // just always use 1. TODO should check really
add_vectorised_key("radionuclide name", &radionuclide_name);
Expand Down Expand Up @@ -283,11 +283,11 @@ bool InterfileHeader::post_processing()
// radionuclide
{
RadionuclideDB radionuclide_db;
const std::string rn_name = !this->radionuclide_name.empty()?
const std::string rn_name = !this->radionuclide_name[0].empty()?
this->radionuclide_name[0] : this->isotope_name;
auto radionuclide = radionuclide_db.get_radionuclide(exam_info_sptr->imaging_modality, rn_name);
if (radionuclide.get_half_life(false) < 0)
radionuclide = Radionuclide(rn_name,
radionuclide = Radionuclide(rn_name.empty() ? "Unknown" : rn_name,
is_spect ? -1.F : 511.F, // TODO handle energy for SPECT
radionuclide_branching_ratio[0], radionuclide_half_life[0], this->exam_info_sptr->imaging_modality);
this->exam_info_sptr->set_radionuclide(radionuclide);
Expand Down
3 changes: 1 addition & 2 deletions src/IO/InterfileHeaderSiemens.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void InterfileHeaderSiemens::set_type_of_data()
}
else
{
warning("Interfile parsing of Siemens listmode: unexpected 'type of data:=" + type_of_data + "' (expected PET). Continuing");
warning("Interfile parsing of Siemens header: unexpected 'type of data:=" + type_of_data + "' (expected PET). Continuing");
}
}

Expand Down Expand Up @@ -544,7 +544,6 @@ InterfileListmodeHeaderSiemens::InterfileListmodeHeaderSiemens()
ignore_key("gantry crystal radius (cm)");
ignore_key("bin size (cm)");
ignore_key("septa state");
ignore_key("%tof mashing factor");
ignore_key("%preset type");
ignore_key("%preset value");
ignore_key("%preset unit");
Expand Down

0 comments on commit e8f2dd8

Please sign in to comment.