STIR  6.2.0
ProjMatrixByDensel.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef __stir_recon_buildblock_ProjMatrixByDensel_H__
5 #define __stir_recon_buildblock_ProjMatrixByDensel_H__
6 
16 /*
17  Copyright (C) 2000- 2011, Hammersmith Imanet Ltd
18  See STIR/LICENSE.txt for details
19 */
20 
21 #include "stir/RegisteredObject.h"
24 #include "stir/Densel.h"
25 #include "stir/ProjDataInfo.h" // todo replace by forward declaration
26 #include <map>
27 #include "stir/shared_ptr.h"
28 
29 START_NAMESPACE_STIR
30 
31 // template <typename elemT> class RelatedViewgrams;
32 // class Densel;
33 template <int num_dimensions, typename elemT>
34 class DiscretisedDensity;
48 class ProjMatrixByDensel : public RegisteredObject<ProjMatrixByDensel>
49 {
50 public:
51  ~ProjMatrixByDensel() override {}
52 
54 
57  virtual void set_up(const shared_ptr<const ProjDataInfo>& proj_data_info_ptr,
58  const shared_ptr<const DiscretisedDensity<3, float>>& density_info_ptr // TODO should be Info only
59  )
60  = 0;
61 
63  virtual const DataSymmetriesForDensels* get_symmetries_ptr() const = 0;
64 
66 
73  inline void get_proj_matrix_elems_for_one_densel(ProjMatrixElemsForOneDensel&, const Densel&) const;
74 
75 #if 0
76  // TODO
82  virtual void write_to_file_by_densel(
83  const char * const file_name_without_extension) const;
84 #endif
85  // TODO implement this one at some point ?
86  /*
87  virtual void write_to_file_by_bin(
88  const char * const file_name_without_extension);
89  */
90 
91  // void set_maximum_cache_size(const unsigned long size){;}
92  void enable_cache(bool v)
93  {
94  cache_disabled = !v;
95  }
96  /* TODO
97  void set_subset_usage(const SubsetInfo&, const int num_access_times);
98  */
99 
100 protected:
103 
110  virtual void calculate_proj_matrix_elems_for_one_densel(ProjMatrixElemsForOneDensel&) const = 0;
111 
113 
114  bool cache_disabled;
115 
122  Succeeded get_cached_proj_matrix_elems_for_one_densel(ProjMatrixElemsForOneDensel&) const;
123 
125  inline void cache_proj_matrix_elems_for_one_densel(const ProjMatrixElemsForOneDensel&) const;
126 
127 private:
128  typedef unsigned int CacheKey;
129 
130  typedef std::map<CacheKey, ProjMatrixElemsForOneDensel> MapProjMatrixElemsForOneDensel;
131  typedef MapProjMatrixElemsForOneDensel::iterator MapProjMatrixElemsForOneDenselIterator;
132  typedef MapProjMatrixElemsForOneDensel::const_iterator const_MapProjMatrixElemsForOneDenselIterator;
133 
135  mutable MapProjMatrixElemsForOneDensel cache_collection;
136 
138  inline static CacheKey cache_key(const Densel& Densel);
139 };
140 
141 END_NAMESPACE_STIR
142 
144 
145 #endif // __ProjMatrixByDensel_H__
This stores the non-zero projection matrix elements for every &#39;voxel&#39;.
Definition: ProjMatrixElemsForOneDensel.h:59
Declaration of class stir::DataSymmetriesForDensels.
Implementations of inline functions for class ProjMatrixByDensel.
Declaration of class stir::ProjDataInfo.
This is the (abstract) base class for all projection matrices which are organised by &#39;Densel&#39;...
Definition: ProjMatrixByDensel.h:48
Declaration of typedef stir::Densel.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
A class for encoding/finding symmetries common to the geometry of the projection data and the discret...
Definition: DataSymmetriesForDensels.h:50
Declaration of class stiir::RegisteredObject.
Helper class to provide registry mechanisms to a Base classSuppose you have a hierarchy of classes wi...
Definition: RegisteredObject.h:95
Declaration of class stir::ProjMatrixElemsForOneDensel.
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43