Skip to content

Commit

Permalink
Interfile: mostly ignore "effective central bin size" keyword
Browse files Browse the repository at this point in the history
This keyword only makes sense for arc-corrected data. Therefore, we now
only read/write it in that case.

Fixes #1034
  • Loading branch information
KrisThielemans committed Feb 7, 2024
1 parent 4a4a245 commit fa06c2c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
14 changes: 12 additions & 2 deletions documentation/release_6.0.htm
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,19 @@ <h3>Changed functionality</h3>
of non arc-corrected bins set for the scanner. If it is, an error is raised. You might therefore have to adapt your interfile header.
</li>
<li>
Write <tt>STIR6.0</tt> as Interfile key <tt>version</tt> to denote TOF changes.
This is currently ignored for parsing though.
Interfile header changes:
<ul>
<li>
Write <tt>STIR6.0</tt> as Interfile key <tt>version</tt> to denote TOF changes.
This is currently ignored for parsing though.
</li>
<li>
(PET) The <tt>effective central bin size (cm)</tt> keyword for projection data is now only used for arc-corrected data.
It is no longer written to the header for non-arccorrected data.
</li>
</ul>
</li>
<li>
</ul>

<h3>Build system</h3>
Expand Down
24 changes: 0 additions & 24 deletions src/IO/InterfileHeader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1406,41 +1406,17 @@ InterfilePDFSHeader::post_processing()
num_views,
num_bins,
tof_mash_factor));
if (effective_central_bin_size_in_cm > 0
&& fabs(effective_central_bin_size_in_cm - data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.) > .01)
{
warning(boost::format("Interfile warning: inconsistent effective_central_bin_size_in_cm\n"
"Value in header is %g while I expect %g from the inner ring radius etc\n"
"Ignoring value in header")
% effective_central_bin_size_in_cm % (data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.));
}
}
}
else if (scanner_geometry == "BlocksOnCylindrical") // if block geometry
{
data_info_sptr.reset(new ProjDataInfoBlocksOnCylindricalNoArcCorr(
scanner_sptr_from_file, sorted_num_rings_per_segment, sorted_min_ring_diff, sorted_max_ring_diff, num_views, num_bins));
if (effective_central_bin_size_in_cm > 0
&& fabs(effective_central_bin_size_in_cm - data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.) > .01)
{
warning(boost::format("Interfile warning: inconsistent effective_central_bin_size_in_cm\n"
"Value in header is %g while I expect %g from the inner ring radius etc\n"
"Ignoring value in header")
% effective_central_bin_size_in_cm % (data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.));
}
}
else // if generic geometry
{
data_info_sptr.reset(new ProjDataInfoGenericNoArcCorr(
scanner_sptr_from_file, sorted_num_rings_per_segment, sorted_min_ring_diff, sorted_max_ring_diff, num_views, num_bins));
if (effective_central_bin_size_in_cm > 0
&& fabs(effective_central_bin_size_in_cm - data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.) > .01)
{
warning(boost::format("Interfile warning: inconsistent effective_central_bin_size_in_cm\n"
"Value in header is %g while I expect %g from the inner ring radius etc\n"
"Ignoring value in header")
% effective_central_bin_size_in_cm % (data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.));
}
}
if (data_info_sptr->get_num_tof_poss() != num_timing_poss)
error(boost::format("Interfile header parsing with TOF: inconsistency between number of TOF bins in data (%d), "
Expand Down
14 changes: 5 additions & 9 deletions src/IO/interfile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1325,9 +1325,11 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&

output_header << scanner.parameter_info();

output_header << "effective central bin size (cm) := " << proj_data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.
<< endl;

if (dynamic_pointer_cast<const ProjDataInfoCylindricalArcCorr>(pdfs.get_proj_data_info_sptr()))
{
output_header << "effective central bin size (cm) := " << proj_data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.
<< "\n";
}
} // end of cylindrical scanner
else
{
Expand Down Expand Up @@ -1377,9 +1379,6 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&

output_header << scanner.parameter_info();

output_header << "effective central bin size (cm) := " << proj_data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10.
<< endl;

} // end of BlocksOnCylindrical scanner
else // generic scanner
{
Expand Down Expand Up @@ -1410,9 +1409,6 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&

output_header << scanner.parameter_info();

output_header << "effective central bin size (cm) := "
<< proj_data_info_sptr->get_sampling_in_s(Bin(0, 0, 0, 0)) / 10. << endl;

} // end generic scanner
else if (!dynamic_pointer_cast<const ProjDataInfoSubsetByView>(pdfs.get_proj_data_info_sptr()))
{
Expand Down

0 comments on commit fa06c2c

Please sign in to comment.