diff --git a/src/include/stir/recon_buildblock/ProjMatrixByBinSPECTUB.h b/src/include/stir/recon_buildblock/ProjMatrixByBinSPECTUB.h index eae1ecd495..51022e6ada 100644 --- a/src/include/stir/recon_buildblock/ProjMatrixByBinSPECTUB.h +++ b/src/include/stir/recon_buildblock/ProjMatrixByBinSPECTUB.h @@ -75,7 +75,7 @@ class Bin; End Projection Matrix By Bin SPECT UB Parameters:= \endverbatim */ - +using namespace SPECTUB; class ProjMatrixByBinSPECTUB : public RegisteredParsingObject< ProjMatrixByBinSPECTUB, @@ -97,7 +97,7 @@ class ProjMatrixByBinSPECTUB : virtual void set_up( const shared_ptr& proj_data_info_ptr, const shared_ptr >& density_info_ptr // TODO should be Info only - ); +); bool get_keep_all_views_in_cache() const; //! Enable keeping the matrix in memory @@ -146,7 +146,6 @@ class ProjMatrixByBinSPECTUB : void set_resolution_model(const float collimator_sigma_0_in_mm, const float collimator_slope_in_mm, const bool full_3D = true); - private: // parameters that will be parsed @@ -172,6 +171,9 @@ class ProjMatrixByBinSPECTUB : bool already_setup; + static wm_da_type wm; + static wmh_type wmh; // this could be an arry of wmh_type for each index + float * Rrad; virtual void calculate_proj_matrix_elems_for_one_bin( @@ -206,7 +208,10 @@ class ProjMatrixByBinSPECTUB : int maxszb; - void compute_one_subset(const int kOS) const; + void compute_one_subset(const int kOS, + wm_da_type& wm, + wmh_type& wmh, + float * Rrad) const; void delete_UB_SPECT_arrays(); mutable std::vector subset_already_processed; }; diff --git a/src/include/stir/recon_buildblock/SPECTUB_Weight3d.h b/src/include/stir/recon_buildblock/SPECTUB_Weight3d.h index 5b5f28d88d..bdc0848a49 100644 --- a/src/include/stir/recon_buildblock/SPECTUB_Weight3d.h +++ b/src/include/stir/recon_buildblock/SPECTUB_Weight3d.h @@ -51,20 +51,25 @@ void wm_calculation( const int kOS, const bool *msk_2d, const int maxszb, const discrf_type *const gaussdens, - const int *const NITEMS + const int *const NITEMS, + wm_da_type& wm, + wmh_type& wmh, + float * Rrad ); void wm_size_estimation (int kOS, - const angle_type * const ang, - voxel_type vox, - bin_type bin, - const volume_type& vol, - const proj_type& prj, - const bool * const msk_3d, - const bool *const msk_2d, - const int maxszb, - const discrf_type * const gaussdens, - int *NITEMS); + const angle_type * const ang, + voxel_type vox, + bin_type bin, + const volume_type& vol, + const proj_type& prj, + const bool * const msk_3d, + const bool *const msk_2d, + const int maxszb, + const discrf_type * const gaussdens, + int *NITEMS, + wmh_type &wmh, + float *Rrad); //... geometric component ............................................ @@ -96,7 +101,7 @@ void calc_psf_bin ( float center_psf, float binszcm, discrf_type const * const v void calc_att_path ( const bin_type& bin, const voxel_type& vox, const volume_type& vol, attpth_type *attpth ); -float calc_att ( const attpth_type *const attpth, const float *const attmap, int islc ); +float calc_att (const attpth_type *const attpth, const float *const attmap, int islc , wmh_type &wmh); int comp_dist ( float dx, float dy, float dz, float dlast ); diff --git a/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx b/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx index c6ae155aa2..0164629f17 100644 --- a/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx +++ b/src/recon_buildblock/ProjMatrixByBinSPECTUB.cxx @@ -2,6 +2,7 @@ Copyright (C) 2013, Institute for Bioengineering of Catalonia Copyright (C) Biomedical Image Group (GIB), Universitat de Barcelona, Barcelona, Spain. Copyright (C) 2013-2014, 2019, 2020 University College London + Copyright (C) 2023 National Physical Laboratory This file is part of STIR. SPDX-License-Identifier: Apache-2.0 @@ -17,6 +18,7 @@ \author Berta Marti Fuster \author Carles Falcon \author Kris Thielemans + \author Daniel Deidda */ //#include "stir/ProjDataInterfile.h" @@ -60,14 +62,14 @@ #include "stir/recon_buildblock/SPECTUB_Weight3d.h" /* UB-SPECT global variables */ -namespace SPECTUB { - wm_da_type wm; - wmh_type wmh; - float * Rrad; -} +//namespace SPECTUB { +// wm_da_type wm; +// wmh_type wmh; +// float * Rrad; +//} START_NAMESPACE_STIR - +using namespace SPECTUB; const char * const ProjMatrixByBinSPECTUB::registered_name = @@ -658,7 +660,8 @@ set_up( //... size estimations ........................................................ - wm_size_estimation ( kOS, ang, vox, bin, vol, prj, msk_3d, msk_2d, maxszb, &gaussdens, NITEMS[kOS] ); + wm_size_estimation ( kOS, ang, vox, bin, vol, prj, msk_3d, msk_2d, maxszb, &gaussdens, NITEMS[kOS], + wmh,Rrad ); //cout << "\nwm_SPECT. Size estimation done. time (s): " << double( clock()-ini )/CLOCKS_PER_SEC <