STIR  6.2.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 private:
43 #ifdef SWIG
44 public:
45 #endif
46  typedef RelatedViewgrams<elemT> self_type;
47 
48 public:
50 
51  typedef std::random_access_iterator_tag iterator_category;
52  typedef Viewgram<elemT> value_type;
53  typedef value_type& reference;
54  typedef const value_type& const_reference;
55  typedef std::ptrdiff_t difference_type;
56  typedef std::size_t size_type;
57 
58  typedef typename std::vector<Viewgram<elemT>>::iterator iterator;
59  typedef typename std::vector<Viewgram<elemT>>::const_iterator const_iterator;
61 
62  // --- constructors ---
63 
65  inline RelatedViewgrams();
66 
67  // implicit copy constructor (just element-by-element copy)
68  // RelatedViewgrams(const RelatedViewgrams&);
69 
71 
72  inline RelatedViewgrams(const std::vector<Viewgram<elemT>>& viewgrams,
73  const shared_ptr<DataSymmetriesForViewSegmentNumbers>& symmetries_used);
74 
75  // --- const members returning info ---
76 
78 
79  inline int get_basic_view_num() const;
81 
82  inline int get_basic_segment_num() const;
84 
85  inline int get_basic_timing_pos_num() const;
87 
88  inline ViewgramIndices get_basic_view_segment_num() const;
90 
91  inline ViewgramIndices get_basic_viewgram_indices() const;
92 
94  inline int get_num_viewgrams() const;
95  inline int get_num_axial_poss() const;
96  inline int get_num_tangential_poss() const;
97  inline int get_min_axial_pos_num() const;
98  inline int get_max_axial_pos_num() const;
99  inline int get_min_tangential_pos_num() const;
100  inline int get_max_tangential_pos_num() const;
101 
103  inline shared_ptr<const ProjDataInfo> get_proj_data_info_sptr() const;
105  inline const DataSymmetriesForViewSegmentNumbers* get_symmetries_ptr() const;
107 
108  inline shared_ptr<DataSymmetriesForViewSegmentNumbers> get_symmetries_sptr() const;
109  // -- members which modify the structure ---
110 
112  void grow(const IndexRange<2>& range);
113 
114  // TODOvoid zoom(const float zoom, const float Xoffp, const float Yoffp,
115  // const int size, const float itophi);
116 
117  // -- basic iterator support --
118 
120  inline iterator begin();
122  inline iterator end();
124  inline const_iterator begin() const;
126  inline const_iterator end() const;
127 
128  // numeric operators
129 
131  RelatedViewgrams& operator*=(const elemT);
133  RelatedViewgrams& operator/=(const elemT);
135  RelatedViewgrams& operator+=(const elemT);
137  RelatedViewgrams& operator-=(const elemT);
138 
140  RelatedViewgrams& operator*=(const RelatedViewgrams<elemT>&);
142  RelatedViewgrams& operator/=(const RelatedViewgrams<elemT>&);
144  RelatedViewgrams& operator+=(const RelatedViewgrams<elemT>&);
146  RelatedViewgrams& operator-=(const RelatedViewgrams<elemT>&);
147 
148  // numeric functions
149 
151  elemT find_max() const;
153  elemT find_min() const;
155  void fill(const elemT& n);
156 
157  // other
158 
160  RelatedViewgrams get_empty_copy() const;
161 
163 
164 
168  bool has_same_characteristics(self_type const&, std::string& explanation) const;
169 
171 
173  bool has_same_characteristics(self_type const&) const;
174 
176 
180  bool operator==(const self_type&) const;
181 
183  bool operator!=(const self_type&) const;
185 
186 private:
187  friend class ProjData;
188  friend class ProjDataInfo;
189 
190  // members
191  std::vector<Viewgram<elemT>> viewgrams;
192  shared_ptr<DataSymmetriesForViewSegmentNumbers> symmetries_used;
193 
195 
196  inline void check_state() const;
197 
199  void debug_check_state() const;
200 };
201 
202 END_NAMESPACE_STIR
203 
204 #include "stir/RelatedViewgrams.inl"
205 
206 #endif // __RelatedViewgrams_h__
Declaration of class stir::DataSymmetriesForViewSegmentNumbers.
Declaration of class stir::Viewgram.
inline implementations for class stir::RelatedViewgrams