STIR  6.3.0
RelatedViewgrams.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000 PARAPET partners
3  Copyright (C) 2000-2012, Hammersmith Imanet Ltd
4  This file is part of STIR.
5 
6  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
7 
8  See STIR/LICENSE.txt for details
9 */
20 #ifndef __RelatedViewgrams_h__
21 #define __RelatedViewgrams_h__
22 
23 #include "stir/Viewgram.h"
25 #include <vector>
26 
27 #include <iterator>
28 
29 START_NAMESPACE_STIR
30 
31 // forward declarations for 'friend'
32 class ProjData;
33 class ProjDataInfo;
34 
39 template <typename elemT>
40 class RelatedViewgrams
41 {
42 #ifdef STIR_COMPILING_SWIG_WRAPPER
43 public: // SWIG needs this typedef to be public
44 #endif
45  typedef RelatedViewgrams<elemT> self_type;
46 
47 public:
49 
50  typedef std::random_access_iterator_tag iterator_category;
51  typedef Viewgram<elemT> value_type;
52  typedef value_type& reference;
53  typedef const value_type& const_reference;
54  typedef std::ptrdiff_t difference_type;
55  typedef std::size_t size_type;
56 
57  typedef typename std::vector<Viewgram<elemT>>::iterator iterator;
58  typedef typename std::vector<Viewgram<elemT>>::const_iterator const_iterator;
60 
61  // --- constructors ---
62 
64  inline RelatedViewgrams();
65 
66  // implicit copy constructor (just element-by-element copy)
67  // RelatedViewgrams(const RelatedViewgrams&);
68 
70 
71  inline RelatedViewgrams(const std::vector<Viewgram<elemT>>& viewgrams,
72  const shared_ptr<DataSymmetriesForViewSegmentNumbers>& symmetries_used);
73 
74  // --- const members returning info ---
75 
77 
78  inline int get_basic_view_num() const;
80 
81  inline int get_basic_segment_num() const;
83 
84  inline int get_basic_timing_pos_num() const;
86 
87  inline ViewgramIndices get_basic_view_segment_num() const;
89 
90  inline ViewgramIndices get_basic_viewgram_indices() const;
91 
93  inline int get_num_viewgrams() const;
94  inline int get_num_axial_poss() const;
95  inline int get_num_tangential_poss() const;
96  inline int get_min_axial_pos_num() const;
97  inline int get_max_axial_pos_num() const;
98  inline int get_min_tangential_pos_num() const;
99  inline int get_max_tangential_pos_num() const;
100 
102  inline shared_ptr<const ProjDataInfo> get_proj_data_info_sptr() const;
104  inline const DataSymmetriesForViewSegmentNumbers* get_symmetries_ptr() const;
106 
107  inline shared_ptr<DataSymmetriesForViewSegmentNumbers> get_symmetries_sptr() const;
108  // -- members which modify the structure ---
109 
111  void grow(const IndexRange<2>& range);
112 
113  // TODOvoid zoom(const float zoom, const float Xoffp, const float Yoffp,
114  // const int size, const float itophi);
115 
116  // -- basic iterator support --
117 
119  inline iterator begin();
121  inline iterator end();
123  inline const_iterator begin() const;
125  inline const_iterator end() const;
126 
127  // numeric operators
128 
130  RelatedViewgrams& operator*=(const elemT);
132  RelatedViewgrams& operator/=(const elemT);
134  RelatedViewgrams& operator+=(const elemT);
136  RelatedViewgrams& operator-=(const elemT);
137 
139  RelatedViewgrams& operator*=(const RelatedViewgrams<elemT>&);
141  RelatedViewgrams& operator/=(const RelatedViewgrams<elemT>&);
143  RelatedViewgrams& operator+=(const RelatedViewgrams<elemT>&);
145  RelatedViewgrams& operator-=(const RelatedViewgrams<elemT>&);
146 
147  // numeric functions
148 
150  elemT find_max() const;
152  elemT find_min() const;
154  void fill(const elemT& n);
155 
156  // other
157 
159  RelatedViewgrams get_empty_copy() const;
160 
162 
163 
167  bool has_same_characteristics(self_type const&, std::string& explanation) const;
168 
170 
172  bool has_same_characteristics(self_type const&) const;
173 
175 
179  bool operator==(const self_type&) const;
180 
182  bool operator!=(const self_type&) const;
184 
185 private:
186  friend class ProjData;
187  friend class ProjDataInfo;
188 
189  // members
190  std::vector<Viewgram<elemT>> viewgrams;
191  shared_ptr<DataSymmetriesForViewSegmentNumbers> symmetries_used;
192 
194 
195  inline void check_state() const;
196 
198  void debug_check_state() const;
199 };
200 
201 END_NAMESPACE_STIR
202 
203 #include "stir/RelatedViewgrams.inl"
204 
205 #endif // __RelatedViewgrams_h__
Declaration of class stir::DataSymmetriesForViewSegmentNumbers.
Declaration of class stir::Viewgram.
inline implementations for class stir::RelatedViewgrams