UCL / STIR

Software for Tomographic Image Reconstruction
http://stir.sourceforge.net/
Other
113 stars 95 forks source link

SPECTUB matrix unitialised values #1232

Closed KrisThielemans closed 1 year ago

KrisThielemans commented 1 year ago

@varzakis got some problems running the simplest forward projection of SPECT images with SIRF (python kernel crash). Skipping SIRF, we got an occasional crash with STIR directly. Trying to diagnose this by running the following

cd recon_test_pack/SPECT/SPECTUB
valgrind OSMAPOSL OSEM_2DPSF.par 

gives a lot of output on uninitialised values. Relevant lines seem to be https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L480 https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L556 https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L568 https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L585 https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L652

full output:

INFO: (subset)sensitivity filename(s) not set so I will compute the (subset)sensitivities

INFO: Using distributable_computation with 5 threads on 6 processors.

WARNING: SPECTUB matrix can currently only use single-threaded code unless all views are kept. Setting num_threads to 1

WARNING: Using OpenMP with number of threads=1 produces parallel overhead. You should compile without OPENMP support
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x984EB2A: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EDCF: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, bool) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x985B4B7: std::ostream& std::ostream::_M_insert<bool>(bool) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x858290: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:480)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465== 
==2465== Use of uninitialised value of size 8
==2465==    at 0x984E62E: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EB53: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EDCF: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, bool) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x985B4B7: std::ostream& std::ostream::_M_insert<bool>(bool) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x858290: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:480)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x984E63B: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EB53: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EDCF: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, bool) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x985B4B7: std::ostream& std::ostream::_M_insert<bool>(bool) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x858290: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:480)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x984EB86: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x984EDCF: std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, bool) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x985B4B7: std::ostream& std::ostream::_M_insert<bool>(bool) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==2465==    by 0x858290: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:480)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465== 

INFO: 2D PSF Correction. Parallel geometry
MASK filename = mask.hv

Parameters of SPECT UB matrix: (in cm)
Image grid side row: 128    col: 128    transverse voxel_size: 0.331995
Number of slices: 64    slice_thickness: 0.332
Number of bins: 128 bin size: 0.332 axial size: 0.332
Number of angles: 120   Angle increment: -3 First angle: 180
Number of subsets: 120
Correction for attenuation:         do_msk_att: 0
Attenuation map: 
Rotation radii: {15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}
Minimum weight: 0

==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x858A55: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:556)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465==    by 0x634A4C: main (OSMAPOSL.cxx:52)
==2465== 

WARNING: RadioNuclideDB::get_radionuclide: unknown modality. Returning "unknown" radionuclide.

WARNING: DiscretisedDensity does not contain any time frames. This might cause an error.
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x85EA66: SPECTUB::generate_msk(bool*, bool*, float*, SPECTUB::volume_type*, SPECTUB::wmh_type&) (SPECTUB_Tools.cxx:689)
==2465==    by 0x858C2C: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:568)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465==    by 0x634A4C: main (OSMAPOSL.cxx:52)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x85F10B: SPECTUB::max_psf_szb(SPECTUB::angle_type*, SPECTUB::wmh_type&) (SPECTUB_Tools.cxx:788)
==2465==    by 0x858D35: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:585)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465==    by 0x634A4C: main (OSMAPOSL.cxx:52)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x85F3F0: SPECTUB::calc_sigma_h(SPECTUB::voxel_type, SPECTUB::collim_type) (SPECTUB_Tools.cxx:815)
==2465==    by 0x85F255: SPECTUB::max_psf_szb(SPECTUB::angle_type*, SPECTUB::wmh_type&) (SPECTUB_Tools.cxx:794)
==2465==    by 0x858D35: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:585)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465==    by 0x634A4C: main (OSMAPOSL.cxx:52)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x861AB2: SPECTUB::voxel_projection(SPECTUB::voxel_type*, float*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:534)
==2465==    by 0x86120C: SPECTUB::wm_size_estimation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, bool const*, bool const*, int, SPECTUB::discrf_type const*, int*, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:385)
==2465==    by 0x859473: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:652)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465==    by 0x634A4C: main (OSMAPOSL.cxx:52)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x85F3F0: SPECTUB::calc_sigma_h(SPECTUB::voxel_type, SPECTUB::collim_type) (SPECTUB_Tools.cxx:815)
==2465==    by 0x861F14: SPECTUB::fill_psf_2d(SPECTUB::psf2da_type*, SPECTUB::psf1d_type*, SPECTUB::voxel_type const&, SPECTUB::discrf_type const*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:599)
==2465==    by 0x8612EB: SPECTUB::wm_size_estimation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, bool const*, bool const*, int, SPECTUB::discrf_type const*, int*, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:402)
==2465==    by 0x859473: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:652)
==2465==    by 0x874468: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:102)
==2465==    by 0x8DE01C: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:48)
==2465==    by 0x878919: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:89)
==2465==    by 0x8A9F49: stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData<stir::DiscretisedDensity<3, float> >::set_up_before_sensitivity(std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:576)
==2465==    by 0x8A3014: stir::PoissonLogLikelihoodWithLinearModelForMean<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (PoissonLogLikelihoodWithLinearModelForMean.cxx:291)
==2465==    by 0x829126: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (IterativeReconstruction.cxx:477)
==2465==    by 0x79434A: stir::OSMAPOSLReconstruction<stir::DiscretisedDensity<3, float> >::set_up(std::shared_ptr<stir::DiscretisedDensity<3, float> > const&) (OSMAPOSLReconstruction.cxx:319)
==2465==    by 0x8287DF: stir::IterativeReconstruction<stir::DiscretisedDensity<3, float> >::reconstruct() (IterativeReconstruction.cxx:407)
==2465== 

INFO: Done estimating size of matrix. Execution (CPU) time 82.13 s 

WARNING: SPECTUB matrix can currently only use single-threaded code unless all views are kept. Setting num_threads to 1

WARNING: Using OpenMP with number of threads=1 produces parallel overhead. You should compile without OPENMP support

INFO: Computing sensitivity

INFO: Starting loop with 1 threads

INFO: Thread 0/1 calculating segment_num: 0, view_num: 0

INFO: Computing matrix elements for view 0

INFO: total number of non-zero weights in this view: 1448143, estimated size: 14.5918 MB
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x861AB2: SPECTUB::voxel_projection(SPECTUB::voxel_type*, float*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:534)
==2465==    by 0x8602F0: SPECTUB::wm_calculation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, float const*, bool const*, bool const*, int, SPECTUB::discrf_type const*, int const*, SPECTUB::wm_da_type&, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:177)
==2465==    by 0x85A2F2: stir::ProjMatrixByBinSPECTUB::compute_one_subset(int, float const*) const (ProjMatrixByBinSPECTUB.cxx:801)
==2465==    by 0x85AA5C: stir::ProjMatrixByBinSPECTUB::calculate_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&) const (ProjMatrixByBinSPECTUB.cxx:864)
==2465==    by 0x850A50: stir::ProjMatrixByBin::get_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&, stir::Bin const&) const (ProjMatrixByBin.inl:65)
==2465==    by 0x8763C9: stir::BackProjectorByBinUsingProjMatrixByBin::actual_back_project(stir::DiscretisedDensity<3, float>&, stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBinUsingProjMatrixByBin.cxx:148)
==2465==    by 0x80339D: stir::BackProjectorByBin::actual_back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:390)
==2465==    by 0x802E75: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:300)
==2465==    by 0x802B4C: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&) (BackProjectorByBin.cxx:240)
==2465==    by 0x8A8987: stir::RPC_process_related_viewgrams_sensitivity_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:1333)
==2465==    by 0x8D7463: stir::distributable_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, std::shared_ptr<stir::DataSymmetriesForViewSegmentNumbers> const&, stir::DiscretisedDensity<3, float>*, stir::DiscretisedDensity<3, float> const*, std::shared_ptr<stir::ProjData> const&, bool, int, int, int, int, bool, double*, std::shared_ptr<stir::ProjData> const&, std::shared_ptr<stir::BinNormalisation>, double, double, void (*)(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*), stir::DistributedCachingInformation*) [clone ._omp_fn.0] (distributable.cxx:489)
==2465==    by 0x9525EDE: GOMP_parallel (in /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0)
==2465== 
==2465== Conditional jump or move depends on uninitialised value(s)
==2465==    at 0x85F3F0: SPECTUB::calc_sigma_h(SPECTUB::voxel_type, SPECTUB::collim_type) (SPECTUB_Tools.cxx:815)
==2465==    by 0x861F14: SPECTUB::fill_psf_2d(SPECTUB::psf2da_type*, SPECTUB::psf1d_type*, SPECTUB::voxel_type const&, SPECTUB::discrf_type const*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:599)
==2465==    by 0x8603D5: SPECTUB::wm_calculation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, float const*, bool const*, bool const*, int, SPECTUB::discrf_type const*, int const*, SPECTUB::wm_da_type&, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:195)
==2465==    by 0x85A2F2: stir::ProjMatrixByBinSPECTUB::compute_one_subset(int, float const*) const (ProjMatrixByBinSPECTUB.cxx:801)
==2465==    by 0x85AA5C: stir::ProjMatrixByBinSPECTUB::calculate_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&) const (ProjMatrixByBinSPECTUB.cxx:864)
==2465==    by 0x850A50: stir::ProjMatrixByBin::get_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&, stir::Bin const&) const (ProjMatrixByBin.inl:65)
==2465==    by 0x8763C9: stir::BackProjectorByBinUsingProjMatrixByBin::actual_back_project(stir::DiscretisedDensity<3, float>&, stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBinUsingProjMatrixByBin.cxx:148)
==2465==    by 0x80339D: stir::BackProjectorByBin::actual_back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:390)
==2465==    by 0x802E75: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:300)
==2465==    by 0x802B4C: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&) (BackProjectorByBin.cxx:240)
==2465==    by 0x8A8987: stir::RPC_process_related_viewgrams_sensitivity_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:1333)
==2465==    by 0x8D7463: stir::distributable_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, std::shared_ptr<stir::DataSymmetriesForViewSegmentNumbers> const&, stir::DiscretisedDensity<3, float>*, stir::DiscretisedDensity<3, float> const*, std::shared_ptr<stir::ProjData> const&, bool, int, int, int, int, bool, double*, std::shared_ptr<stir::ProjData> const&, std::shared_ptr<stir::BinNormalisation>, double, double, void (*)(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*), stir::DistributedCachingInformation*) [clone ._omp_fn.0] (distributable.cxx:489)
==2465== 

INFO: Weight matrix calculation done. time 4.44 (s)

INFO: Total time after transfering to ProjMatrixElemsForOneBin. time 10.43 (s)

INFO: Thread 0/1 calculating segment_num: 0, view_num: 8

INFO: Computing matrix elements for view 8

INFO: total number of non-zero weights in this view: 1452590, estimated size: 14.6342 MB

INFO: Weight matrix calculation done. time 5.26 (s)
emacs&
^C==2465== 
==2465== Process terminating with default action of signal 2 (SIGINT)
==2465==    at 0x67ECC4: stir::BasicCoordinate<3, int>::operator[](int) const (BasicCoordinate.inl:85)
==2465==    by 0x835904: stir::ProjMatrixElemsForOneBinValue::ProjMatrixElemsForOneBinValue(stir::BasicCoordinate<3, int> const&, float) (ProjMatrixElemsForOneBinValue.inl:46)
==2465==    by 0x85A684: stir::ProjMatrixByBinSPECTUB::compute_one_subset(int, float const*) const (ProjMatrixByBinSPECTUB.cxx:822)
==2465==    by 0x85AA5C: stir::ProjMatrixByBinSPECTUB::calculate_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&) const (ProjMatrixByBinSPECTUB.cxx:864)
==2465==    by 0x850A50: stir::ProjMatrixByBin::get_proj_matrix_elems_for_one_bin(stir::ProjMatrixElemsForOneBin&, stir::Bin const&) const (ProjMatrixByBin.inl:65)
==2465==    by 0x8763C9: stir::BackProjectorByBinUsingProjMatrixByBin::actual_back_project(stir::DiscretisedDensity<3, float>&, stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBinUsingProjMatrixByBin.cxx:148)
==2465==    by 0x80339D: stir::BackProjectorByBin::actual_back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:390)
==2465==    by 0x802E75: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&, int, int, int, int) (BackProjectorByBin.cxx:300)
==2465==    by 0x802B4C: stir::BackProjectorByBin::back_project(stir::RelatedViewgrams<float> const&) (BackProjectorByBin.cxx:240)
==2465==    by 0x8A8987: stir::RPC_process_related_viewgrams_sensitivity_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*) (PoissonLogLikelihoodWithLinearModelForMeanAndProjData.cxx:1333)
==2465==    by 0x8D7463: stir::distributable_computation(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, std::shared_ptr<stir::DataSymmetriesForViewSegmentNumbers> const&, stir::DiscretisedDensity<3, float>*, stir::DiscretisedDensity<3, float> const*, std::shared_ptr<stir::ProjData> const&, bool, int, int, int, int, bool, double*, std::shared_ptr<stir::ProjData> const&, std::shared_ptr<stir::BinNormalisation>, double, double, void (*)(std::shared_ptr<stir::ForwardProjectorByBin> const&, std::shared_ptr<stir::BackProjectorByBin> const&, stir::RelatedViewgrams<float>*, int&, int&, double*, stir::RelatedViewgrams<float> const*, stir::RelatedViewgrams<float> const*), stir::DistributedCachingInformation*) [clone ._omp_fn.0] (distributable.cxx:489)
==2465==    by 0x9525EDE: GOMP_parallel (in /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0)
==2465== 
==2465== HEAP SUMMARY:
==2465==     in use at exit: 77,739,232 bytes in 132,817 blocks
==2465==   total heap usage: 267,288 allocs, 134,471 frees, 179,561,506 bytes allocated
==2465== 
==2465== LEAK SUMMARY:
==2465==    definitely lost: 0 bytes in 0 blocks
==2465==    indirectly lost: 0 bytes in 0 blocks
==2465==      possibly lost: 0 bytes in 0 blocks
==2465==    still reachable: 77,739,232 bytes in 132,817 blocks
==2465==                       of which reachable via heuristic:
==2465==                         newarray           : 2,810,216 bytes in 601 blocks
==2465==         suppressed: 0 bytes in 0 blocks
danieldeidda commented 1 year ago

so it seem wmh needs to be intialised, I will have a look

samdporter commented 1 year ago

I think this is relevant to this issue. Let me know if it needs its own:

I'm having issues with improperly initialised values when setting up the projector after setting a resolution model

acq_model_matrix = ProjMatrixByBinSPECTUB() 
acq_model_matrix.set_resolution_model(0.93, 0.03, False) 
projector = ProjectorByBinPairUsingProjMatrixByBin(acq_model_matrix)
projector.set_up(templ_sino.get_proj_data_info(), target) # error occurs here

Failing scripts for sirf and stir are available at https://github.com/samdporter/SPECTissues, along with valgrind outputs.

This error does not occur if no resolution model is set.

samdporter commented 1 year ago

Relevant (I think) part of the valgrind output

==1156376== Conditional jump or move depends on uninitialised value(s)
==1156376==    at 0x64C3CB2: SPECTUB::max_psf_szb(SPECTUB::angle_type*, SPECTUB::wmh_type&) (SPECTUB_Tools.cxx:788)
==1156376==    by 0x64C099F: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:583)
==1156376==    by 0x64DA33E: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:100)
==1156376==    by 0x64DDD07: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:47)
==1156376==    by 0x64DE10C: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:88)
==1156376==    by 0x6242DA7: _wrap_ProjectorByBinPairUsingProjMatrixByBin_set_up (stirPYTHON_wrap.cxx:128250)
==1156376==    by 0x24C9DF: ??? (in /usr/bin/python3.10)
==1156376==    by 0x250F51: _PyEval_EvalFrameDefault (in /usr/bin/python3.10)
==1156376==    by 0x341E55: ??? (in /usr/bin/python3.10)
==1156376==    by 0x341CF5: PyEval_EvalCode (in /usr/bin/python3.10)
==1156376==    by 0x36C7D7: ??? (in /usr/bin/python3.10)
==1156376==    by 0x3660BA: ??? (in /usr/bin/python3.10)
==1156376== 
==1156376== Conditional jump or move depends on uninitialised value(s)
==1156376==    at 0x64C3713: SPECTUB::calc_sigma_h(SPECTUB::voxel_type, SPECTUB::collim_type) (SPECTUB_Tools.cxx:815)
==1156376==    by 0x64C3D47: SPECTUB::max_psf_szb(SPECTUB::angle_type*, SPECTUB::wmh_type&) (SPECTUB_Tools.cxx:794)
==1156376==    by 0x64C099F: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:583)
==1156376==    by 0x64DA33E: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:100)
==1156376==    by 0x64DDD07: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:47)
==1156376==    by 0x64DE10C: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:88)
==1156376==    by 0x6242DA7: _wrap_ProjectorByBinPairUsingProjMatrixByBin_set_up (stirPYTHON_wrap.cxx:128250)
==1156376==    by 0x24C9DF: ??? (in /usr/bin/python3.10)
==1156376==    by 0x250F51: _PyEval_EvalFrameDefault (in /usr/bin/python3.10)
==1156376==    by 0x341E55: ??? (in /usr/bin/python3.10)
==1156376==    by 0x341CF5: PyEval_EvalCode (in /usr/bin/python3.10)
==1156376==    by 0x36C7D7: ??? (in /usr/bin/python3.10)
==1156376== 
==1156376== Conditional jump or move depends on uninitialised value(s)
==1156376==    at 0x64C6B81: SPECTUB::voxel_projection(SPECTUB::voxel_type*, float*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:534)
==1156376==    by 0x64C7AEE: SPECTUB::wm_size_estimation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, bool const*, bool const*, int, SPECTUB::discrf_type const*, int*, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:385)
==1156376==    by 0x64C0DD9: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:650)
==1156376==    by 0x64DA33E: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:100)
==1156376==    by 0x64DDD07: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:47)
==1156376==    by 0x64DE10C: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:88)
==1156376==    by 0x6242DA7: _wrap_ProjectorByBinPairUsingProjMatrixByBin_set_up (stirPYTHON_wrap.cxx:128250)
==1156376==    by 0x24C9DF: ??? (in /usr/bin/python3.10)
==1156376==    by 0x250F51: _PyEval_EvalFrameDefault (in /usr/bin/python3.10)
==1156376==    by 0x341E55: ??? (in /usr/bin/python3.10)
==1156376==    by 0x341CF5: PyEval_EvalCode (in /usr/bin/python3.10)
==1156376==    by 0x36C7D7: ??? (in /usr/bin/python3.10)
==1156376== 
==1156376== Conditional jump or move depends on uninitialised value(s)
==1156376==    at 0x64C3713: SPECTUB::calc_sigma_h(SPECTUB::voxel_type, SPECTUB::collim_type) (SPECTUB_Tools.cxx:815)
==1156376==    by 0x64C72FD: SPECTUB::fill_psf_2d(SPECTUB::psf2da_type*, SPECTUB::psf1d_type*, SPECTUB::voxel_type const&, SPECTUB::discrf_type const*, float, SPECTUB::wmh_type&) (SPECTUB_Weight3d.cxx:599)
==1156376==    by 0x64C7C7B: SPECTUB::wm_size_estimation(int, SPECTUB::angle_type const*, SPECTUB::voxel_type, SPECTUB::bin_type, SPECTUB::volume_type const&, SPECTUB::proj_type const&, bool const*, bool const*, int, SPECTUB::discrf_type const*, int*, SPECTUB::wmh_type&, float const*) (SPECTUB_Weight3d.cxx:402)
==1156376==    by 0x64C0DD9: stir::ProjMatrixByBinSPECTUB::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjMatrixByBinSPECTUB.cxx:650)
==1156376==    by 0x64DA33E: stir::ForwardProjectorByBinUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ForwardProjectorByBinUsingProjMatrixByBin.cxx:100)
==1156376==    by 0x64DDD07: stir::ProjectorByBinPair::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPair.cxx:47)
==1156376==    by 0x64DE10C: stir::ProjectorByBinPairUsingProjMatrixByBin::set_up(std::shared_ptr<stir::ProjDataInfo const> const&, std::shared_ptr<stir::DiscretisedDensity<3, float> const> const&) (ProjectorByBinPairUsingProjMatrixByBin.cxx:88)
==1156376==    by 0x6242DA7: _wrap_ProjectorByBinPairUsingProjMatrixByBin_set_up (stirPYTHON_wrap.cxx:128250)
==1156376==    by 0x24C9DF: ??? (in /usr/bin/python3.10)
==1156376==    by 0x250F51: _PyEval_EvalFrameDefault (in /usr/bin/python3.10)
==1156376==    by 0x341E55: ??? (in /usr/bin/python3.10)
==1156376==    by 0x341CF5: PyEval_EvalCode (in /usr/bin/python3.10)
danieldeidda commented 1 year ago

One of the possible reasons could be here:

https://github.com/UCL/STIR/blob/6124652f44b2599e6d5262640800495534cee60e/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx#L440-L460

in each condition for mask type the relative do_msk is set to true but the others should also be set to false. @KrisThielemans @samdporter do you agree? I suspect more similar stuff is below

KrisThielemans commented 1 year ago

in each condition for mask type the relative do_msk is set to true but the others should also be set to false.

looks like it. do_mask_att isn't always set for instance.

A few others

I think some of these don't matter too much, as in many places the logic will generally not use the variables that aren't set. (For instance, some of the valgridn messages occur only in the printing of information). But there have to be a few that do matter, so we'll have to work by elimination. Luckily valgrind will tell us as we shouldn't have any uninitalized warnings.

It's a bit weird that we get this now, but possible when wmh was a global variable, the compiler initialised it somehow anyway (I'd need to brush up on my C++...).

danieldeidda commented 1 year ago
  • wmh.COL.do_fb is only initialised in an else statement, which causes @samdporter problem. Looks like the collimator parameters need to be always set, even if do_psf (which makes sense of course), so most of the lines in that else statement need to be moved before the if(do_psf).

I guess we don't need this if statement then we can just print "No correction for PSF. Parallel geometry" if (!wmh.do_psf)

danieldeidda commented 1 year ago

also COL.num seem to be always zero when I debug but it's not intialised

danieldeidda commented 1 year ago

similar to att_fn:

image these are also not initalised though my debugger shows them as ""