STIR  6.2.0
Public Member Functions | List of all members
stir::ProjDataInMemory Class Reference

A class which reads/writes projection data from/to memory. More...

#include "stir/ProjDataInMemory.h"

Inheritance diagram for stir::ProjDataInMemory:
Inheritance graph
[legend]

Public Types

iterator typedefs

iterator typedefs

typedef Array< 1, float >::iterator iterator
 
typedef Array< 1, float >::const_iterator const_iterator
 
typedef Array< 1, float >::full_iterator full_iterator
 
typedef Array< 1, float >::const_full_iterator const_full_iterator
 

Public Member Functions

 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 More...
 
 ProjDataInMemory (const ProjData &proj_data)
 constructor that copies data from another ProjData
 
 ProjDataInMemory (const ProjDataInMemory &proj_data)
 Copy constructor.
 
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. More...
 
Succeeded set_viewgram (const Viewgram< float > &v) override
 Set viewgram.
 
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. More...
 
Succeeded set_sinogram (const Sinogram< float > &s) override
 Set sinogram.
 
SegmentBySinogram< float > get_segment_by_sinogram (const int segment_num, const int timing_pos=0) const override
 Get all sinograms for the given segment.
 
SegmentByView< float > get_segment_by_view (const int segment_num, const int timing_pos=0) const override
 Get all viewgrams for the given segment.
 
Succeeded set_segment (const SegmentBySinogram< float > &) override
 Set all sinograms for the given segment.
 
Succeeded set_segment (const SegmentByView< float > &) override
 Set all viewgrams for the given segment.
 
void fill (const float value) override
 set all bins to the same value More...
 
void fill (const ProjData &) override
 set all bins from another ProjData object More...
 
 ~ProjDataInMemory () override
 destructor deallocates all memory the object owns
 
float get_bin_value (Bin &bin)
 Returns a value of a bin.
 
void set_bin_value (const Bin &bin)
 
iterator begin ()
 start value for iterating through all elements in the array, see iterator
 
const_iterator begin () const
 start value for iterating through all elements in the (const) array, see iterator
 
iterator end ()
 end value for iterating through all elements in the array, see iterator
 
const_iterator end () const
 end value for iterating through all elements in the (const) array, see iterator
 
iterator begin_all ()
 start value for iterating through all elements in the array, see iterator
 
const_iterator begin_all () const
 start value for iterating through all elements in the (const) array, see iterator
 
iterator end_all ()
 end value for iterating through all elements in the array, see iterator
 
const_iterator end_all () const
 end value for iterating through all elements in the (const) array, see iterator
 
arithmetic operations

return sum of all elements

float sum () const override
 
float find_max () const override
 return maximum value of all elements
 
float find_min () const override
 return minimum value of all elements
 
double norm () const override
 return L2-norm (sqrt of sum of squares)
 
double norm_squared () const override
 return L2-norm squared (sum of squares)
 
self_type operator+ (const self_type &iv) const
 elem by elem addition
 
self_type operator- (const self_type &iv) const
 elem by elem subtraction
 
self_type operator* (const self_type &iv) const
 elem by elem multiplication
 
self_type operator/ (const self_type &iv) const
 elem by elem division
 
self_type operator+ (const float a) const
 addition with a 'float'
 
self_type operator- (const float a) const
 subtraction with a 'float'
 
self_type operator* (const float a) const
 multiplication with a 'float'
 
self_type operator/ (const float a) const
 division with a 'float'
 
self_typeoperator+= (const base_type &v) override
 adding elements of v to the current data
 
self_typeoperator-= (const base_type &v) override
 subtracting elements of v from the current data
 
self_typeoperator*= (const base_type &v) override
 multiplying elements of the current data with elements of v
 
self_typeoperator/= (const base_type &v) override
 dividing all elements of the current data by elements of v
 
self_typeoperator+= (const float v) override
 adding an float to the elements of the current data
 
self_typeoperator-= (const float v) override
 subtracting an float from the elements of the current data
 
self_typeoperator*= (const float v) override
 multiplying the elements of the current data with an float
 
self_typeoperator/= (const float v) override
 dividing the elements of the current data by an float
 
STIR_DEPRECATED void axpby (const float a, const ProjData &x, const float b, const ProjData &y) override
 
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. This implementation requires that x and y are ProjDataInMemory (else falls back on general method)
 
void xapyb (const ProjData &x, const ProjData &a, const ProjData &y, const ProjData &b) override
 set values of the array to x*a+y*b, where a, b, x and y are ProjData. This implementation requires that a, b, x and y are ProjDataInMemory (else falls back on general method)
 
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 requires that a, b and y are ProjDataInMemory (else falls back on general method)
 
void sapyb (const ProjData &a, const ProjData &y, const ProjData &b) override
 set values of the array to self*a+y*b where a, b and y are ProjData This implementation requires that a, b and y are ProjDataInMemory (else falls back on general method)
 
access to the data via a pointer
float * get_data_ptr ()
 member function for access to the data via a float*
 
const float * get_const_data_ptr () const
 member function for access to the data via a const float*
 
void release_data_ptr ()
 signal end of access to float*
 
void release_const_data_ptr () const
 signal end of access to const float*
 
- Public Member Functions inherited from stir::ProjData
 ProjData ()
 Empty constructor.
 
 ProjData (const shared_ptr< const ExamInfo > &exam_info_sptr, const shared_ptr< const ProjDataInfo > &proj_data_info_ptr)
 construct by specifying info. Data will be undefined.
 
 ~ProjData () override
 Destructor.
 
shared_ptr< const ProjDataInfoget_proj_data_info_sptr () const
 Get shared pointer to proj data info.
 
Viewgram< float > get_viewgram (const ViewgramIndices &) const
 Get viewgram.
 
Sinogram< float > get_sinogram (const SinogramIndices &) const
 Get sinogram.
 
unique_ptr< ProjDataInMemoryget_subset (const std::vector< int > &views) const
 construct projection data that stores a subset of the views
 
Viewgram< float > get_empty_viewgram (const ViewgramIndices &) const
 Get empty viewgram.
 
Viewgram< float > get_empty_viewgram (const int view, const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get empty viewgram. More...
 
Sinogram< float > get_empty_sinogram (const SinogramIndices &) const
 Get empty_sinogram.
 
Sinogram< float > get_empty_sinogram (const int ax_pos_num, const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get empty_sinogram. More...
 
SegmentByView< float > get_empty_segment_by_view (const SegmentIndices &) const
 Get empty segment by view.
 
SegmentBySinogram< float > get_empty_segment_by_sinogram (const SegmentIndices &) const
 Get empty segment by sino.
 
SegmentByView< float > get_empty_segment_by_view (const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get empty segment view. More...
 
SegmentBySinogram< float > get_empty_segment_by_sinogram (const int segment_num, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get empty segment sino. More...
 
SegmentBySinogram< float > get_segment_by_sinogram (const SegmentIndices &) const
 Get segment by sinogram.
 
SegmentByView< float > get_segment_by_view (const SegmentIndices &) const
 Get segment by view.
 
virtual RelatedViewgrams< float > get_related_viewgrams (const ViewgramIndices &, const shared_ptr< DataSymmetriesForViewSegmentNumbers > &, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get related viewgrams.
 
virtual Succeeded set_related_viewgrams (const RelatedViewgrams< float > &viewgrams)
 Set related viewgrams.
 
RelatedViewgrams< float > get_empty_related_viewgrams (const ViewgramIndices &viewgram_indices, const shared_ptr< DataSymmetriesForViewSegmentNumbers > &symmetries_ptr, const bool make_num_tangential_poss_odd=false, const int timing_pos=0) const
 Get empty related viewgrams, where the symmetries_ptr specifies the symmetries to use.
 
template<typename iterT >
iterT fill_from (iterT array_iter)
 set all bins from an array iterator More...
 
template<typename iterT >
iterT copy_to (iterT array_iter) const
 Copy all bins to a range specified by a (forward) iterator. More...
 
int get_num_segments () const
 Get number of segments.
 
int get_num_axial_poss (const int segment_num) const
 Get number of axial positions per segment.
 
int get_num_views () const
 Get number of views.
 
int get_num_tangential_poss () const
 Get number of tangential positions.
 
int get_num_tof_poss () const
 Get number of TOF positions.
 
int get_min_tof_pos_num () const
 Get the index of the first timing position.
 
int get_max_tof_pos_num () const
 Get the index of the last timgin position.
 
int get_tof_mash_factor () const
 Get TOG mash factor.
 
int get_min_segment_num () const
 Get minimum segment number.
 
int get_max_segment_num () const
 Get maximum segment number.
 
int get_min_axial_pos_num (const int segment_num) const
 Get mininum axial position per segmnet.
 
int get_max_axial_pos_num (const int segment_num) const
 Get maximum axial position per segment.
 
int get_min_view_num () const
 Get minimum view number.
 
int get_max_view_num () const
 Get maximum view number.
 
int get_min_tangential_pos_num () const
 Get minimum tangential position number.
 
int get_max_tangential_pos_num () const
 Get maximum tangential position number.
 
int get_num_sinograms () const
 Get the total number of sinograms. More...
 
int get_num_non_tof_sinograms () const
 Get the number of non-tof sinograms. More...
 
std::size_t size_all () const
 Get the total size of the data.
 
std::vector< int > get_original_view_nums () const
 forward ProjDataInfo::get_original_view_nums()
 
Succeeded write_to_file (const std::string &filename) const
 writes data to a file in Interfile format
 
- Public Member Functions inherited from stir::ExamData
 ExamData ()
 ExamData. More...
 
 ExamData (const shared_ptr< const ExamInfo > &_this_exam)
 
virtual const ExamInfoget_exam_info () const
 
virtual shared_ptr< const ExamInfoget_exam_info_sptr () const
 Get shared pointer to exam info.
 
virtual void set_exam_info (ExamInfo const &)
 change exam info More...
 
void set_exam_info_sptr (shared_ptr< const ExamInfo > new_exam_info_sptr)
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::ProjData
static shared_ptr< ProjDataread_from_file (const std::string &filename, const std::ios::openmode open_mode=std::ios::in)
 A static member to get the projection data from a file. More...
 
static std::vector< int > standard_segment_sequence (const ProjDataInfo &pdi)
 Return a vector with segment numbers in a standard order. More...
 
- Protected Attributes inherited from stir::ProjData
shared_ptr< const ProjDataInfoproj_data_info_sptr
 
- Protected Attributes inherited from stir::ExamData
shared_ptr< const ExamInfoexam_info_sptr
 

Detailed Description

A class which reads/writes projection data from/to memory.

Mainly useful for temporary storage of projection data.

Constructor & Destructor Documentation

◆ ProjDataInMemory()

stir::ProjDataInMemory::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

Parameters
proj_data_info_ptrobject specifying all sizes etc. The ProjDataInfo object pointed to will not be modified.
initialise_with_0specifies if the data should be set to 0. If false, the data is undefined until you set it yourself.

References stir::ProjData::get_num_axial_poss(), stir::ProjData::get_num_tangential_poss(), stir::ProjData::get_num_views(), and stir::ProjData::size_all().

Member Function Documentation

◆ get_viewgram()

Viewgram< float > stir::ProjDataInMemory::get_viewgram ( const int  view,
const int  segment_num,
const bool  make_num_tangential_poss_odd = false,
const int  timing_pos = 0 
) const
overridevirtual

◆ get_sinogram()

Sinogram< float > stir::ProjDataInMemory::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
overridevirtual

◆ fill() [1/2]

void stir::ProjDataInMemory::fill ( const float  value)
overridevirtual

set all bins to the same value

will call error() if setting failed

Reimplemented from stir::ProjData.

References begin_all(), and end_all().

Referenced by ProjDataInMemory(), and stir::ProjDataInMemoryTests::run_tests().

◆ fill() [2/2]

void stir::ProjDataInMemory::fill ( const ProjData proj_data)
overridevirtual

set all bins from another ProjData object

will call error() if setting failed or if the 'source' proj_data is not compatible. The current check requires at least the same segment numbers (but the source can have more), all other geometric parameters have to be the same.

Reimplemented from stir::ProjData.

References begin_all(), stir::ProjData::fill(), and stir::ProjData::get_proj_data_info_sptr().

◆ axpby()

void stir::ProjDataInMemory::axpby ( const float  a,
const ProjData x,
const float  b,
const ProjData y 
)
overridevirtual
Deprecated:
a*x+b*y (use xapyb)

Reimplemented from stir::ProjData.

References xapyb().


The documentation for this class was generated from the following files: