diff --git a/documentation/release_5.1.htm b/documentation/release_5.1.htm index a6fe2ff93a..c84bf7ce5a 100644 --- a/documentation/release_5.1.htm +++ b/documentation/release_5.1.htm @@ -122,6 +122,10 @@

Changed functionality

  • (private) bitfields random or isRandom have been renamed to delayed to avoid confusion. Affected listmode file formats are SAFIR, ECAT962 and ECAT966.
  • +
  • DiscretisedDensityDensity::has_same_characteristics now adds actual origins and grid spacing to the explanation if they are different. +
  • +
  • ProjMatrixByBinSPECTUB prints an explanation when the attenuation image has different characteristics. +
  • Build system and dependencies

    diff --git a/src/include/stir/DiscretisedDensity.inl b/src/include/stir/DiscretisedDensity.inl index 2798d865c7..e4aa5646af 100644 --- a/src/include/stir/DiscretisedDensity.inl +++ b/src/include/stir/DiscretisedDensity.inl @@ -81,8 +81,16 @@ actual_has_same_characteristics(DiscretisedDensity const& } if (norm(other.get_origin() - this->get_origin()) > 1.E-2) - { - explanation = "Not the same origin."; + { + char tmp[2000]; + snprintf(tmp, 2000, "Not the same origin: (%g,%g,%g) and (%g,%g,%g)", + other.get_origin()[1], + other.get_origin()[2], + other.get_origin()[3], + this->get_origin()[1], + this->get_origin()[2], + this->get_origin()[3]); + explanation = tmp; return false; } if (other.get_index_range() != this->get_index_range()) diff --git a/src/include/stir/DiscretisedDensityOnCartesianGrid.inl b/src/include/stir/DiscretisedDensityOnCartesianGrid.inl index 3acaa5d4ae..821676b7ee 100644 --- a/src/include/stir/DiscretisedDensityOnCartesianGrid.inl +++ b/src/include/stir/DiscretisedDensityOnCartesianGrid.inl @@ -92,13 +92,14 @@ actual_has_same_characteristics(DiscretisedDensity const& if (norm(other.get_grid_spacing() - this->get_grid_spacing()) > 1.E-4F*norm(this->get_grid_spacing())) { char tmp[2000]; - sprintf(tmp, "Not the same grid spacing: (%g,%g,%g) and (%g,%g,%g)", + snprintf(tmp, 2000, "Not the same grid spacing: (%g,%g,%g) and (%g,%g,%g)", other.get_grid_spacing()[1], num_dimensions>1?other.get_grid_spacing()[2]:0., num_dimensions>2?other.get_grid_spacing()[3]:0., this->get_grid_spacing()[1], num_dimensions>1?this->get_grid_spacing()[2]:0., num_dimensions>2?this->get_grid_spacing()[3]:0.); + explanation = tmp; return false; } diff --git a/src/recon_buildblock/ProjMatrixByBinPinholeSPECTUB.cxx b/src/recon_buildblock/ProjMatrixByBinPinholeSPECTUB.cxx index de65ca7c7c..411c195947 100644 --- a/src/recon_buildblock/ProjMatrixByBinPinholeSPECTUB.cxx +++ b/src/recon_buildblock/ProjMatrixByBinPinholeSPECTUB.cxx @@ -710,9 +710,9 @@ set_up( if ( wmh.do_att ){ if (is_null_ptr(attenuation_image_sptr)) error("Attenuation image not set."); - - if (!density_info_ptr->has_same_characteristics(*attenuation_image_sptr)) - error("Currently the attenuation map and emission image must have the same dimension, orientation, and voxel size."); + std::string explanation; + if (!density_info_ptr->has_same_characteristics(*attenuation_image_sptr, explanation)) + error("Currently the attenuation map and emission image must have the same dimension, orientation, and voxel size:\n" + explanation); if ( ( attmap = new (nothrow) float [ wmh.vol.Nvox ] ) == nullptr ) error("Error allocating space to store values for attenuation map."); diff --git a/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx b/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx index a7c293fcd9..c6ae155aa2 100644 --- a/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx +++ b/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx @@ -541,8 +541,9 @@ set_up( if ( wmh.do_att || wmh.do_msk_att ){ if (is_null_ptr(attenuation_image_sptr)) error("Attenation image not set"); - if (!density_info_ptr->has_same_characteristics(*attenuation_image_sptr)) - error("Currently the attenuation map and emission image must have the same dimension, orientation and voxel size"); + std::string explanation; + if (!density_info_ptr->has_same_characteristics(*attenuation_image_sptr, explanation)) + error("Currently the attenuation map and emission image must have the same dimension, orientation and voxel size:\n" + explanation); attmap = new float [ vol.Nvox ]; std::copy(attenuation_image_sptr->begin_all(), attenuation_image_sptr->end_all(),attmap);