STIR  6.2.0
ProjMatrixByBinSPECTUB.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013, Institute for Bioengineering of Catalonia
3  Copyright (C) 2013, University College London
4  This file is part of STIR.
5 
6  SPDX-License-Identifier: Apache-2.0
7 
8  See STIR/LICENSE.txt for details
9 */
19 #ifndef __stir_recon_buildblock_ProjMatrixByBinSPECTUB__
20 #define __stir_recon_buildblock_ProjMatrixByBinSPECTUB__
21 
24 #include "stir/ProjDataInfo.h"
26 #include "stir/IndexRange.h"
27 #include "stir/shared_ptr.h"
28 #include <iostream>
29 
30 #include "stir/recon_buildblock/SPECTUB_Tools.h"
31 
32 START_NAMESPACE_STIR
33 
34 template <int num_dimensions, typename elemT>
35 class DiscretisedDensity;
36 class Bin;
78 // using namespace SPECTUB;
79 class ProjMatrixByBinSPECTUB : public RegisteredParsingObject<ProjMatrixByBinSPECTUB, ProjMatrixByBin, ProjMatrixByBin>
80 {
81 public:
83  static const char* const registered_name;
84 
87 
88  // disable copy-constructor as currently unsafe to copy due to bare pointers
90 
92  ~ProjMatrixByBinSPECTUB() override;
93 
95  void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
96  const shared_ptr<const DiscretisedDensity<3, float>>& density_info_ptr // TODO should be Info only
97  ) override;
98 
99  bool get_keep_all_views_in_cache() const;
101 
106  void set_keep_all_views_in_cache(bool value = true);
107  std::string get_attenuation_type() const;
109 
113  void set_attenuation_type(const std::string& value);
114  shared_ptr<const DiscretisedDensity<3, float>> get_attenuation_image_sptr() const;
116 
123  void set_attenuation_image_sptr(const shared_ptr<const DiscretisedDensity<3, float>> value);
124  void set_attenuation_image_sptr(const std::string& value);
126 
141  void set_resolution_model(const float collimator_sigma_0_in_mm, const float collimator_slope_in_mm, const bool full_3D = true);
142 
143  // Alex
144  // Fix to compile, missing function definition in header
145  ProjMatrixByBinSPECTUB* clone() const override;
146 
147 private:
148  // parameters that will be parsed
149 
150  float minimum_weight;
151  float maximum_number_of_sigmas;
152  float spatial_resolution_PSF;
153  std::string psf_type;
154  float collimator_sigma_0;
155  float collimator_slope;
156  std::string attenuation_type;
157  std::string attenuation_map;
158  std::string mask_type;
159  std::string mask_file;
160  bool keep_all_views_in_cache;
161 
162  // explicitly list necessary members for image details (should use an Info object instead)
163  CartesianCoordinate3D<float> voxel_size;
165  IndexRange<3> densel_range;
166 
167  shared_ptr<const ProjDataInfo> proj_data_info_ptr;
168 
169  bool already_setup;
170 
171  mutable SPECTUB::wm_da_type wm;
172  mutable SPECTUB::wmh_type wmh; // this could be an arry of wmh_type for each index
173  float* Rrad;
174 
175  void calculate_proj_matrix_elems_for_one_bin(ProjMatrixElemsForOneBin&) const override;
176 
177  void set_defaults() override;
178  void initialise_keymap() override;
179  bool post_processing() override;
180 
181  shared_ptr<const DiscretisedDensity<3, float>> attenuation_image_sptr;
182 
183  // wm_SPECT starts here ---------------------------------------------------------------------------------------------
184  bool* msk_3d;
185  bool* msk_2d;
186 
187  //... variables for estimated sizes of arrays to allocate ................................
188  int** NITEMS;
189 
190  //... user defined structures (types defined in SPECTUB_Tools.h) .....................................
191 
193  SPECTUB::proj_type prj;
194 
195  SPECTUB::voxel_type vox;
196  SPECTUB::bin_type bin;
197 
198  SPECTUB::angle_type* ang;
199  float* attmap;
200 
201  SPECTUB::discrf_type gaussdens;
202 
203  int maxszb;
204 
205  void compute_one_subset(const int kOS, const float* Rrad) const;
206  void delete_UB_SPECT_arrays();
207  mutable std::vector<bool> subset_already_processed;
208 };
209 
210 END_NAMESPACE_STIR
211 
212 #endif
structure for voxel information
Definition: SPECTUB_Tools.h:265
Declaration of class stir::ProjDataInfo.
complementary information (matrix header)
Definition: SPECTUB_Tools.h:109
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
static const char *const registered_name
Name which will be used when parsing a ProjMatrixByBin object.
Definition: ProjMatrixByBinSPECTUB.h:83
structure for projection information
Definition: SPECTUB_Tools.h:81
declaration of stir::ProjMatrixByBin and its helpers classes
structure for bin information
Definition: SPECTUB_Tools.h:50
structure to store angles values, indices and ratios
Definition: SPECTUB_Tools.h:233
generates projection matrix for SPECT studies
Definition: ProjMatrixByBinSPECTUB.h:79
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
weight_mat_da structure definition. Structure for generating weight matrix
Definition: SPECTUB_Tools.h:162
This file defines the stir::IndexRange class.
This stores the non-zero projection matrix elements for every &#39;densel&#39; that contributes to a given bi...
Definition: ProjMatrixElemsForOneBin.h:68
defines the stir::CartesianCoordinate3D<coordT> class
Declaration of class stir::RegisteredParsingObject.
structure for distribution function information
Definition: SPECTUB_Tools.h:190
structure for bin information
Definition: SPECTUB_Tools.h:290