STIR 6.4.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*/
19
20#ifndef __RelatedViewgrams_h__
21#define __RelatedViewgrams_h__
22
23#include "stir/Viewgram.h"
25#include <vector>
26
27#include <iterator>
28
29START_NAMESPACE_STIR
30
31// forward declarations for 'friend'
32class ProjData;
33class ProjDataInfo;
34
39template <typename elemT>
41{
42#ifdef STIR_COMPILING_SWIG_WRAPPER
43public: // SWIG needs this typedef to be public
44#endif
45 typedef RelatedViewgrams<elemT> self_type;
46
47public:
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
89
91
93 inline int get_num_viewgrams() const;
94 inline int get_num_axial_poss() const;
95 inline int get_min_axial_pos_num() const;
96 inline int get_max_axial_pos_num() const;
97
101
102 inline shared_ptr<DataSymmetriesForViewSegmentNumbers> get_symmetries_sptr() const;
103 // -- members which modify the structure ---
104
106 void grow(const IndexRange<2>& range);
107
108 // TODOvoid zoom(const float zoom, const float Xoffp, const float Yoffp,
109 // const int size, const float itophi);
110
111 // -- basic iterator support --
112
114 inline iterator begin();
116 inline iterator end();
118 inline const_iterator begin() const;
120 inline const_iterator end() const;
121
122 // numeric operators
123
125 RelatedViewgrams& operator*=(const elemT);
127 RelatedViewgrams& operator/=(const elemT);
129 RelatedViewgrams& operator+=(const elemT);
131 RelatedViewgrams& operator-=(const elemT);
132
141
142 // numeric functions
143
145 elemT find_max() const;
147 elemT find_min() const;
149 void fill(const elemT& n);
150
151 // other
152
155
157
158
162 bool has_same_characteristics(self_type const&, std::string& explanation) const;
163
165
167 bool has_same_characteristics(self_type const&) const;
168
170
174 bool operator==(const self_type&) const;
175
177 bool operator!=(const self_type&) const;
179
180private:
181 friend class ProjData;
182 friend class ProjDataInfo;
183
184 // members
185 std::vector<Viewgram<elemT>> viewgrams;
186 shared_ptr<DataSymmetriesForViewSegmentNumbers> symmetries_used;
187
189
190 inline void check_state() const;
191
193 void debug_check_state() const;
194};
195
196END_NAMESPACE_STIR
197
199
200#endif // __RelatedViewgrams_h__
Declaration of class stir::DataSymmetriesForViewSegmentNumbers.
inline implementations for class stir::RelatedViewgrams
Declaration of class stir::Viewgram.
A class for encoding/finding symmetries. Works only on ViewSegmentNumbers (instead of Bin).
Definition DataSymmetriesForViewSegmentNumbers.h:50
DataWithProjDataInfo()
Default constructor sets internal member to 0.
Definition DataWithProjDataInfo.cxx:20
This class defines ranges which can be 'irregular'.
Definition IndexRange.h:69
iterator end()
iterator 'past' the last element of the vector
Definition RelatedViewgrams.inl:154
RelatedViewgrams()
default constructor (sets everything empty)
Definition RelatedViewgrams.inl:28
void fill(const elemT &n)
Set all data elements to n.
Definition RelatedViewgrams.cxx:266
int get_num_viewgrams() const
returns the number of viewgrams in this object
Definition RelatedViewgrams.inl:55
int get_basic_segment_num() const
get 'basic' segment_num
Definition RelatedViewgrams.inl:72
RelatedViewgrams & operator*=(const elemT)
Multiplication of all data elements with a constant.
Definition RelatedViewgrams.cxx:141
iterator begin()
use to initialise an iterator to the first element of the vector
Definition RelatedViewgrams.inl:147
int get_basic_timing_pos_num() const
get 'basic' timing_pos_num
Definition RelatedViewgrams.inl:81
elemT find_max() const
Find the maximum of all data elements.
Definition RelatedViewgrams.cxx:234
bool operator==(const self_type &) const
check equality (data has to be identical)
Definition RelatedViewgrams.cxx:126
int get_basic_view_num() const
get 'basic' view_num
Definition RelatedViewgrams.inl:63
RelatedViewgrams & operator+=(const elemT)
Addition of all data elements by a constant.
Definition RelatedViewgrams.cxx:163
elemT find_min() const
Find the maximum of all data elements.
Definition RelatedViewgrams.cxx:250
RelatedViewgrams get_empty_copy() const
Return a new object with ProjDataInfo etc., but all data elements set to 0.
Definition RelatedViewgrams.cxx:67
bool operator!=(const self_type &) const
negation of operator==
Definition RelatedViewgrams.cxx:133
ViewgramIndices get_basic_view_segment_num() const
get 'basic' view_segment_num
Definition RelatedViewgrams.inl:99
const DataSymmetriesForViewSegmentNumbers * get_symmetries_ptr() const
Get a pointer to the symmetries used in constructing this object.
Definition RelatedViewgrams.inl:133
RelatedViewgrams & operator-=(const elemT)
Subtraction of all data elements by a constant.
Definition RelatedViewgrams.cxx:173
ViewgramIndices get_basic_viewgram_indices() const
get 'basic' viewgram indices
Definition RelatedViewgrams.inl:90
shared_ptr< DataSymmetriesForViewSegmentNumbers > get_symmetries_sptr() const
Get a shared pointer to the symmetries used in constructing this object.
Definition RelatedViewgrams.inl:140
bool has_same_characteristics(self_type const &, std::string &explanation) const
Checks if the 2 objects have the proj_data_info, segment_num etc.
Definition RelatedViewgrams.cxx:82
void grow(const IndexRange< 2 > &range)
Grow each viewgram.
Definition RelatedViewgrams.cxx:280
RelatedViewgrams & operator/=(const elemT)
Division of all data elements by a constant.
Definition RelatedViewgrams.cxx:151
A very simple class to store all dincies to get a (2D) Viewgram.
Definition ViewgramIndices.h:33
A class for 2d projection data.
Definition Viewgram.h:49