STIR  6.2.0
ProjMatrixElemsForOneBin.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef __stir_recon_buildblock_ProjMatrixElemsForOneBin__
5 #define __stir_recon_buildblock_ProjMatrixElemsForOneBin__
6 
20 /*
21  Copyright (C) 2000 PARAPET partners
22  Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
23  Copyright (C) 2016, University of Hull
24  This file is part of STIR.
25 
26  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
27 
28  See STIR/LICENSE.txt for details
29 */
30 
32 #include "stir/Bin.h"
33 #include <vector>
34 
35 START_NAMESPACE_STIR
36 
37 class Succeeded;
38 class RelatedBins;
39 template <int num_dimensions, typename elemT>
40 class DiscretisedDensity;
41 
62 /*
63  it might be a bit faster to derive this (privately) from
64  std::vector<value_type> as opposed to having a member of
65  that type.
66  TODO: check
67 */
69 {
70 public:
79 
80 private:
82  typedef std::vector<value_type> Element_vector;
83 
84 public:
86  typedef Element_vector::iterator iterator;
87  typedef Element_vector::const_iterator const_iterator;
88  typedef Element_vector::size_type size_type;
89  typedef Element_vector::difference_type difference_type;
90  typedef std::random_access_iterator_tag iterator_category;
91 
92  typedef value_type& reference;
93  typedef const value_type& const_reference;
94 
96 
100  explicit ProjMatrixElemsForOneBin(const Bin& bin = Bin(), const int default_capacity = 0);
101 
102  /* rely on compiler-generated versions
103  ProjMatrixElemsForOneBin( const ProjMatrixElemsForOneBin&);
104  ProjMatrixElemsForOneBin& operator=(const ProjMatrixElemsForOneBin&) ;
105  */
106 
108  Succeeded check_state() const;
109 
111  inline const Bin& get_bin() const;
113  inline void set_bin(const Bin&);
114 
116  inline iterator begin();
117  inline const_iterator begin() const;
118  inline iterator end();
119  inline const_iterator end() const;
120 
122  void erase();
124  inline iterator erase(iterator it);
126 
134  inline void push_back(const value_type&);
136  void reserve(size_type max_number);
138  inline size_type size() const;
140  size_type capacity() const;
142  ProjMatrixElemsForOneBin& operator*=(const float d);
144  ProjMatrixElemsForOneBin& operator/=(const float d);
145 
147 
149  void sort();
150 
152 
155  // TODO make sure we can have a const argument
156  void merge(ProjMatrixElemsForOneBin& lor);
157 
159 
164  bool operator==(const ProjMatrixElemsForOneBin&) const;
166  bool operator!=(const ProjMatrixElemsForOneBin&) const;
167 
168 #if 0
169  void write(std::fstream&fst) const;
170  void read(std::fstream&fst );
171 #endif
172 
174 
177  float square_sum() const;
178 
179  //******************** projection operations ********************//
180 
182  void back_project(DiscretisedDensity<3, float>&, const Bin&) const;
183 
185  void forward_project(Bin&, const DiscretisedDensity<3, float>&) const;
187  void back_project(DiscretisedDensity<3, float>&, const RelatedBins&) const;
189  void forward_project(RelatedBins&, const DiscretisedDensity<3, float>&) const;
190 
191 private:
192  std::vector<value_type> elements;
193  Bin bin;
194 };
195 
196 END_NAMESPACE_STIR
197 
199 
200 #endif
This class contains all information about a set of bins related by symmetry.
Definition: RelatedBins.h:39
Inline implementations for class stir::ProjMatrixelemesForOneBin.
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
Declaration of class stir::Bin.
Stores voxel coordinates and the value of the matrix element.
Definition: ProjMatrixElemsForOneBinValue.h:46
Declaration of class stir::ProjMatrixElemsForOneBinValue.
This stores the non-zero projection matrix elements for every &#39;densel&#39; that contributes to a given bi...
Definition: ProjMatrixElemsForOneBin.h:68
Element_vector::iterator iterator
typedefs for iterator support
Definition: ProjMatrixElemsForOneBin.h:86
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
ProjMatrixElemsForOneBinValue value_type
Recommended way to call the type of the elements, instead of referring to the actual classname...
Definition: ProjMatrixElemsForOneBin.h:78