STIR 6.4.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
35START_NAMESPACE_STIR
36
37class Succeeded;
38class RelatedBins;
39template <int num_dimensions, typename elemT>
40class DiscretisedDensity;
41
61
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{
70public:
79
80private:
82 typedef std::vector<value_type> Element_vector;
83
84public:
86 typedef Element_vector::iterator iterator;
87 typedef Element_vector::const_iterator const_iterator;
88 typedef Element_vector::reverse_iterator reverse_iterator;
89 typedef Element_vector::const_reverse_iterator const_reverse_iterator;
90 typedef Element_vector::size_type size_type;
91 typedef Element_vector::difference_type difference_type;
92 typedef std::random_access_iterator_tag iterator_category;
93
94 typedef value_type& reference;
95 typedef const value_type& const_reference;
96
98
102 explicit ProjMatrixElemsForOneBin(const Bin& bin = Bin(), const int default_capacity = 0);
103
104 /* rely on compiler-generated versions
105 ProjMatrixElemsForOneBin( const ProjMatrixElemsForOneBin&);
106 ProjMatrixElemsForOneBin& operator=(const ProjMatrixElemsForOneBin&) ;
107 */
108
110 Succeeded check_state() const;
111
113 inline const Bin& get_bin() const;
115 inline void set_bin(const Bin&);
116
118 inline iterator begin();
119 inline const_iterator begin() const;
120 inline iterator end();
121 inline const_iterator end() const;
122 inline reverse_iterator rbegin();
123 inline const_reverse_iterator rbegin() const;
124 inline reverse_iterator rend();
125 inline const_reverse_iterator rend() const;
126
128 void erase();
130 inline iterator erase(iterator it);
132
140 inline void push_back(const value_type&);
142 void reserve(size_type max_number);
144 inline size_type size() const;
146 size_type capacity() const;
148 ProjMatrixElemsForOneBin& operator*=(const float d);
150 ProjMatrixElemsForOneBin& operator/=(const float d);
151
153
155 void sort();
156
158
161 // TODO make sure we can have a const argument
163
165
170 bool operator==(const ProjMatrixElemsForOneBin&) const;
172 bool operator!=(const ProjMatrixElemsForOneBin&) const;
173
174#if 0
175 void write(std::fstream&fst) const;
176 void read(std::fstream&fst );
177#endif
178
180
183 float square_sum() const;
184
185 //******************** projection operations ********************//
186
188 void back_project(DiscretisedDensity<3, float>&, const Bin&) const;
189
196
197private:
198 std::vector<value_type> elements;
199 Bin bin;
200};
201
202END_NAMESPACE_STIR
203
205
206#endif
Declaration of class stir::Bin.
Declaration of class stir::ProjMatrixElemsForOneBinValue.
Inline implementations for class stir::ProjMatrixelemesForOneBin.
A class for storing coordinates and value of a single projection bin.
Definition Bin.h:49
This abstract class is the basis for all image representations.
Definition DiscretisedDensity.h:99
Stores voxel coordinates and the value of the matrix element.
Definition ProjMatrixElemsForOneBinValue.h:47
ProjMatrixElemsForOneBin & operator*=(const float d)
Multiplies all values with a constant.
Definition ProjMatrixElemsForOneBin.cxx:69
bool operator!=(const ProjMatrixElemsForOneBin &) const
Compare 2 lors.
Definition ProjMatrixElemsForOneBin.cxx:477
size_type size() const
number of non-zero elements
Definition ProjMatrixElemsForOneBin.inl:47
void sort()
Sort the elements on coordinates of the voxels.
Definition ProjMatrixElemsForOneBin.cxx:143
Element_vector::iterator iterator
typedefs for iterator support
Definition ProjMatrixElemsForOneBin.h:86
const Bin & get_bin() const
get the bin coordinates corresponding to this row
Definition ProjMatrixElemsForOneBin.inl:29
void push_back(const value_type &)
add a new value_type object at the end
Definition ProjMatrixElemsForOneBin.inl:41
float square_sum() const
Return sum of squares of all values.
Definition ProjMatrixElemsForOneBin.cxx:149
bool operator==(const ProjMatrixElemsForOneBin &) const
Compare 2 lors to see if they are equal.
Definition ProjMatrixElemsForOneBin.cxx:415
void set_bin(const Bin &)
and set the bin coordinates
Definition ProjMatrixElemsForOneBin.inl:35
iterator begin()
functions for allowing iterator access
Definition ProjMatrixElemsForOneBin.inl:53
ProjMatrixElemsForOneBinValue value_type
Recommended way to call the type of the elements, instead of referring to the actual classname.
Definition ProjMatrixElemsForOneBin.h:78
void reserve(size_type max_number)
reserve enough space for max_number elements (but don't fill them in)
Definition ProjMatrixElemsForOneBin.cxx:51
void back_project(DiscretisedDensity< 3, float > &, const Bin &) const
back project a single bin (accumulates)
Definition ProjMatrixElemsForOneBin.cxx:334
Succeeded check_state() const
check if each voxel occurs only once
Definition ProjMatrixElemsForOneBin.cxx:102
ProjMatrixElemsForOneBin(const Bin &bin=Bin(), const int default_capacity=0)
constructor
Definition ProjMatrixElemsForOneBin.cxx:44
ProjMatrixElemsForOneBin & operator/=(const float d)
Divides all values with a constant.
Definition ProjMatrixElemsForOneBin.cxx:85
void forward_project(Bin &, const DiscretisedDensity< 3, float > &) const
forward project into a single bin (accumulates)
Definition ProjMatrixElemsForOneBin.cxx:355
void merge(ProjMatrixElemsForOneBin &lor)
merge 2nd lor into current object
Definition ProjMatrixElemsForOneBin.cxx:163
void erase()
reset lor to 0 length
Definition ProjMatrixElemsForOneBin.cxx:57
size_type capacity() const
number of allocated elements
Definition ProjMatrixElemsForOneBin.cxx:63
This class contains all information about a set of bins related by symmetry.
Definition RelatedBins.h:40
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44