20#ifndef __stir_ProjDataInMemory_H__
21#define __stir_ProjDataInMemory_H__
40#ifdef STIR_COMPILING_SWIG_WRAPPER
56 shared_ptr<const ProjDataInfo>
const& proj_data_info_ptr,
57 const bool initialise_with_0 =
true);
65 shared_ptr<const ProjDataInfo>
const& proj_data_info_ptr,
75 static shared_ptr<ProjDataInMemory>
read_from_file(
const std::string& filename);
78 const int segment_num,
79 const bool make_num_tangential_poss_odd =
false,
80 const int timing_pos = 0)
const override;
84 const int segment_num,
85 const bool make_num_tangential_poss_odd =
false,
86 const int timing_pos = 0)
const override;
102 void fill(
const float value)
override;
117 void set_bin_value(
const Bin& bin);
122 float sum()
const override;
131 double norm()
const override;
137 self_type
operator+(
const self_type& iv)
const;
140 self_type
operator-(
const self_type& iv)
const;
143 self_type
operator*(
const self_type& iv)
const;
146 self_type
operator/(
const self_type& iv)
const;
149 self_type
operator+(
const float a)
const;
152 self_type
operator-(
const float a)
const;
155 self_type
operator*(
const float a)
const;
158 self_type
operator/(
const float a)
const;
163 self_type&
operator+=(
const base_type& v)
override;
166 self_type&
operator-=(
const base_type& v)
override;
169 self_type&
operator*=(
const base_type& v)
override;
172 self_type&
operator/=(
const base_type& v)
override;
175 self_type&
operator+=(
const float v)
override;
178 self_type&
operator-=(
const float v)
override;
181 self_type&
operator*=(
const float v)
override;
184 self_type&
operator/=(
const float v)
override;
202 void sapyb(
const float a,
const ProjData& y,
const float b)
override;
214 typedef Array<1, float>::iterator iterator;
215 typedef Array<1, float>::const_iterator const_iterator;
223 return buffer.begin();
228 return buffer.begin();
236 const_iterator
end()
const
243 return buffer.begin_all();
248 return buffer.begin_all();
253 return buffer.end_all();
258 return buffer.end_all();
266 return buffer.get_data_ptr();
272 return buffer.get_const_data_ptr();
278 buffer.release_data_ptr();
284 buffer.release_const_data_ptr();
292 void create_buffer(
const bool initialise_with_0 =
false);
294 void initialise_layout_metadata();
296 std::streamoff offset;
298 std::streamoff offset_3d_data;
301 std::vector<int> segment_sequence;
303 std::vector<int> timing_poss_sequence;
307 std::streamoff get_index(
const Bin&)
const;
311norm(
const ProjDataInMemory& p)
319 return p.norm_squared();
defines the stir::Array class for multi-dimensional (numeric) arrays
Declaration of class stir::ProjData.
This class defines multi-dimensional (numeric) arrays.
Definition Array.h:78
FullArrayIterator< typename base_type::iterator, typename Array< num_dimensions - 1, elemT >::full_iterator, elemT, full_reference, full_pointer > full_iterator
This defines an iterator type that iterates through all elements.
Definition Array.h:117
FullArrayIterator< typename base_type::const_iterator, typename Array< num_dimensions - 1, elemT >::const_full_iterator, elemT, const_full_reference, const_full_pointer > const_full_iterator
As full_iterator, but for const objects.
Definition Array.h:125
A class for storing coordinates and value of a single projection bin.
Definition Bin.h:49
void release_const_data_ptr() const
signal end of access to const float*
Definition ProjDataInMemory.h:282
self_type operator-(const self_type &iv) const
elem by elem subtraction
Definition ProjDataInMemory.cxx:493
const_iterator end_all() const
end value for iterating through all elements in the (const) array, see iterator
Definition ProjDataInMemory.h:256
const_iterator begin() const
start value for iterating through all elements in the (const) array, see iterator
Definition ProjDataInMemory.h:226
double norm_squared() const override
return L2-norm squared (sum of squares)
Definition ProjDataInMemory.cxx:410
iterator end()
end value for iterating through all elements in the array, see iterator
Definition ProjDataInMemory.h:231
SegmentBySinogram< float > get_segment_by_sinogram(const int segment_num, const int timing_pos=0) const override
Get all sinograms for the given segment.
Definition ProjDataInMemory.cxx:282
Succeeded set_viewgram(const Viewgram< float > &v) override
Set viewgram.
Definition ProjDataInMemory.cxx:162
void xapyb(const ProjData &x, const float a, const ProjData &y, const float b) override
set values of the array to x*a+y*b, where a and b are scalar, and x and y are ProjData....
Definition ProjDataInMemory.cxx:548
float get_bin_value(const Bin &bin) const
Returns a value of a bin.
Definition ProjDataInMemory.cxx:374
void release_data_ptr()
signal end of access to float*
Definition ProjDataInMemory.h:276
self_type & operator*=(const base_type &v) override
multiplying elements of the current data with elements of v
Definition ProjDataInMemory.cxx:437
self_type & operator-=(const base_type &v) override
subtracting elements of v from the current data
Definition ProjDataInMemory.cxx:427
Viewgram< float > get_viewgram(const int view_num, const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const override
Get viewgram.
Definition ProjDataInMemory.cxx:134
self_type operator*(const self_type &iv) const
elem by elem multiplication
Definition ProjDataInMemory.cxx:500
iterator begin_all()
start value for iterating through all elements in the array, see iterator
Definition ProjDataInMemory.h:241
void sapyb(const float a, const ProjData &y, const float b) override
set values of the array to self*a+y*b where a and b are scalar, y is ProjData This implementation req...
Definition ProjDataInMemory.cxx:624
Succeeded set_sinogram(const Sinogram< float > &s) override
Set sinogram.
Definition ProjDataInMemory.cxx:260
self_type operator/(const self_type &iv) const
elem by elem division
Definition ProjDataInMemory.cxx:507
self_type operator+(const self_type &iv) const
elem by elem addition
Definition ProjDataInMemory.cxx:486
ProjDataInMemory(shared_ptr< const ExamInfo > const &exam_info_sptr, shared_ptr< const ProjDataInfo > const &proj_data_info_ptr, const bool initialise_with_0=true)
constructor with only info, but no data
Definition ProjDataInMemory.cxx:49
SegmentByView< float > get_segment_by_view(const int segment_num, const int timing_pos=0) const override
Get all viewgrams for the given segment.
Definition ProjDataInMemory.cxx:295
Succeeded set_segment(const SegmentBySinogram< float > &) override
Set all sinograms for the given segment.
Definition ProjDataInMemory.cxx:302
float * get_data_ptr()
member function for access to the data via a float*
Definition ProjDataInMemory.h:264
iterator end_all()
end value for iterating through all elements in the array, see iterator
Definition ProjDataInMemory.h:251
STIR_DEPRECATED void axpby(const float a, const ProjData &x, const float b, const ProjData &y) override
Definition ProjDataInMemory.cxx:542
self_type & operator+=(const base_type &v) override
adding elements of v to the current data
Definition ProjDataInMemory.cxx:416
const float * get_const_data_ptr() const
member function for access to the data via a const float*
Definition ProjDataInMemory.h:270
void fill(const float value) override
set all bins to the same value
Definition ProjDataInMemory.cxx:336
static shared_ptr< ProjDataInMemory > read_from_file(const std::string &filename)
A static member to get the projection data in memory from a file.
Definition ProjDataInMemory.cxx:368
float find_min() const override
return minimum value of all elements
Definition ProjDataInMemory.cxx:398
const_iterator end() const
end value for iterating through all elements in the (const) array, see iterator
Definition ProjDataInMemory.h:236
iterator begin()
start value for iterating through all elements in the array, see iterator
Definition ProjDataInMemory.h:221
Sinogram< float > get_sinogram(const int ax_pos_num, const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const override
Get sinogram.
Definition ProjDataInMemory.cxx:239
const_iterator begin_all() const
start value for iterating through all elements in the (const) array, see iterator
Definition ProjDataInMemory.h:246
float find_max() const override
return maximum value of all elements
Definition ProjDataInMemory.cxx:392
self_type & operator/=(const base_type &v) override
dividing all elements of the current data by elements of v
Definition ProjDataInMemory.cxx:447
double norm() const override
return L2-norm (sqrt of sum of squares)
Definition ProjDataInMemory.cxx:404
ProjData()
Empty constructor.
Definition ProjData.cxx:394
A class for storing (3d) projection data with fixed SegmentIndices.
Definition SegmentBySinogram.h:51
A class for storing (3d) projection data with fixed SegmentIndices.
Definition SegmentByView.h:52
A class for 2d projection data.
Definition Sinogram.h:47
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
A class for 2d projection data.
Definition Viewgram.h:49
#define STIR_DEPRECATED
Deprecation macro.
Definition deprecated.h:21
double norm_squared(const BasicCoordinate< num_dimensions, coordT > &p1)
compute (inner_product(p1,p1))
Definition BasicCoordinate.inl:415