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

fix Interfile parsing of isotope_name #1327

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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