STIR 6.5.0
stir::SegmentByView< elemT > Class Template Reference

A class for storing (3d) projection data with fixed SegmentIndices. More...

#include "stir/SegmentByView.h"

Inheritance diagram for stir::SegmentByView< elemT >:

Public Types

typedef Segment< elemT >::StorageOrder StorageOrder
 typedef such that we do not need to have typename wherever we StorageOrder
Public Types inherited from stir::Segment< elemT >
enum  StorageOrder { StorageByView , StorageBySino }
Public Types inherited from stir::Array< 3, elemT >
typedef base_type::value_type value_type
 typedefs such that we do not need to have typename wherever we use these types defined in the base class
typedef base_type::reference reference
typedef base_type::const_reference const_reference
typedef base_type::difference_type difference_type
typedef base_type::size_type size_type
typedef base_type::iterator iterator
typedef base_type::const_iterator const_iterator
typedef elemT full_value_type
typedef full_value_type * full_pointer
typedef const full_value_type * const_full_pointer
typedef full_value_type & full_reference
typedef const full_value_type & const_full_reference
typedef 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.
typedef 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.
typedef T value_type
typedef value_type & reference
typedef const value_type & const_reference
typedef ptrdiff_t difference_type
typedef T * iterator
typedef T const * const_iterator
typedef std::reverse_iterator< iterator > reverse_iterator
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
typedef size_t size_type

Public Member Functions

 SegmentByView (const Array< 3, elemT > &v, const shared_ptr< const ProjDataInfo > &proj_data_info_sptr, const SegmentIndices &)
 Constructor that sets the data to a given 3d Array.
 SegmentByView (const shared_ptr< const ProjDataInfo > &proj_data_info_sptr, const SegmentIndices &)
 Constructor that sets sizes via the ProjDataInfo object, initialising data to 0.
 SegmentByView (const Array< 3, elemT > &v, const shared_ptr< const ProjDataInfo > &proj_data_info_ptr, const int segment_num, const int timing_pos_num=0)
 Constructor that sets the data to a given 3d Array.
 SegmentByView (const shared_ptr< const ProjDataInfo > &proj_data_info_ptr, const int segment_num, const int timing_pos_num=0)
 Constructor that sets sizes via the ProjDataInfo object, initialising data to 0.
 SegmentByView (const SegmentBySinogram< elemT > &)
 Conversion from 1 storage order to the other.
StorageOrder get_storage_order () const override
 Get storage order.
Sinogram< elemT > get_sinogram (int axial_pos_num) const override
 Get sinogram.
Viewgram< elemT > get_viewgram (int view_num) const override
 Get viewgram.
void set_sinogram (const Sinogram< elemT > &s) override
 Set sinogram.
void set_sinogram (Sinogram< elemT > const &s, int axial_pos_num) override
 Set sinogram.
void set_viewgram (const Viewgram< elemT > &v) override
 Set viewgram.
void grow (const IndexRange< 3 > &range) override
 Overloading Array::grow.
void resize (const IndexRange< 3 > &range) override
 Overloading Array::resize.
bool operator== (const Segment< elemT > &) const override
Public Member Functions inherited from stir::Segment< elemT >
SegmentIndices get_segment_indices () const
int get_segment_num () const
 Get the segment number.
int get_timing_pos_num () const
 Get the timing position index.
int get_min_axial_pos_num () const
int get_max_axial_pos_num () const
int get_num_axial_poss () const
Sinogram< elemT > get_sinogram (const SinogramIndices &s) const
 return a new sinogram, with data set as in the segment
Viewgram< elemT > get_viewgram (const ViewgramIndices &) const
 return a new viewgram, with data set as in the segment
bool has_same_characteristics (self_type const &, std::string &explanation) const
 Checks if the 2 objects have the proj_data_info, segment_num etc.
bool has_same_characteristics (self_type const &) const
 Checks if the 2 objects have the proj_data_info, segment_num etc.
virtual bool operator== (const self_type &) const =0
 check equality (data has to be identical)
bool operator!= (const self_type &) const
 negation of operator==
Public Member Functions inherited from stir::DataWithProjDataInfo
 DataWithProjDataInfo ()
 Default constructor sets internal member to 0.
 DataWithProjDataInfo (const shared_ptr< const ProjDataInfo > &proj_data_info_sptr_v)
virtual const ProjDataInfo & get_proj_data_info () const
virtual shared_ptr< const ProjDataInfo > get_proj_data_info_sptr () const
 Get shared pointer to ProjData info.
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 timing 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.
Public Member Functions inherited from stir::Array< 3, elemT >
 Array (Array< num_dimensions, elemT > &&other) noexcept
void axpby (const elemT2 a, const Array &x, const elemT2 b, const Array &y)
full_iterator begin_all ()
 start value for iterating through all elements in the array, see full_iterator
const_full_iterator begin_all_const () const
 start value for iterating through all elements in the array, see full_iterator
full_iterator end_all ()
 end value for iterating through all elements in the array, see full_iterator
const_full_iterator end_all_const () const
 end value for iterating through all elements in the array, see full_iterator
IndexRange< num_dimensions > get_index_range () const
size_t size_all () const
 return the total number of elements in this array
virtual void resize (const IndexRange< num_dimensions > &range)
 change the array to a new range of indices, new elements are set to 0
virtual void grow (const IndexRange< num_dimensions > &range)
 alias for resize()
elemT sum () const
 return sum of all elements
elemT sum_positive () const
 return sum of all positive elements
elemT find_max () const
 return maximum of all the elements
elemT find_min () const
 return minimum of all the elements
void fill (const elemT &n)
 Fill elements with value n.
void apply_lower_threshold (const elemT &l)
 Sets elements below value to the value.
void apply_upper_threshold (const elemT &u)
 Sets elements above value to the value.
bool is_regular () const
 checks if the index range is 'regular'
bool get_regular_range (BasicCoordinate< num_dimensions, int > &min, BasicCoordinate< num_dimensions, int > &max) const
 find regular range, returns false if the range is not regular
Array< num_dimensions - 1, elemT > & operator[] (int i)
 allow array-style access, read/write
Array< num_dimensions - 1, elemT > & at (int i)
self & operator+= (const self &x)
self & operator-= (const self &x)
self & operator*= (const self &x)
self & operator/= (const self &x)
self operator+ (const self &x) const
self operator- (const self &x) const
self operator* (const self &x) const
self operator/ (const self &x) const
void xapyb (const Array &x, const elemT a, const Array &y, const elemT b)
 set values of the array to x*a+y*b, where a and b are scalar
void sapyb (const T &a, const Array &y, const T &b)
 set values of the array to self*a+y*b where a and b are scalar or arrays
 ~Array () override
 virtual destructor, frees up any allocated memory
Array & operator= (Array other)
 assignment operator
bool is_contiguous () const
 return if the array is contiguous in memory
elemT * get_full_data_ptr ()
 member function for access to the data via a elemT*
const elemT * get_const_full_data_ptr () const
 member function for access to the data via a const elemT*
void release_full_data_ptr ()
 signal end of access to elemT*
void release_const_full_data_ptr () const
 signal end of access to const elemT*
Public Member Functions inherited from stir::NumericVectorWithOffset< Array< num_dimensions - 1, elemT >, elemT >
 NumericVectorWithOffset (const VectorWithOffset< Array< num_dimensions - 1, elemT > > &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (const NumericVectorWithOffset &t)
 Constructor from an object of this class' base_type.
 NumericVectorWithOffset (NumericVectorWithOffset &&other) noexcept
 move constructor
NumericVectorWithOffset & operator= (const NumericVectorWithOffset &other)
 assignment
NumericVectorWithOffset operator+ (const NumericVectorWithOffset &v) const
 adding vectors, element by element
NumericVectorWithOffset operator- (const NumericVectorWithOffset &v) const
 subtracting vectors, element by element
NumericVectorWithOffset operator* (const NumericVectorWithOffset &v) const
 multiplying vectors, element by element
NumericVectorWithOffset operator/ (const NumericVectorWithOffset &v) const
 dividing vectors, element by element
NumericVectorWithOffset operator+ (const elemT &v) const
 return a new vector with elements equal to the sum of the elements in the original and the elemT
NumericVectorWithOffset operator- (const elemT &v) const
 return a new vector with elements equal to the difference of the elements in the original and the elemT
NumericVectorWithOffset operator* (const elemT &v) const
 return a new vector with elements equal to the multiplication of the elements in the original and the elemT
NumericVectorWithOffset operator/ (const elemT &v) const
 return a new vector with elements equal to the division of the elements in the original and the elemT
NumericVectorWithOffset & operator+= (const NumericVectorWithOffset &v)
 adding elements of v to the current vector
NumericVectorWithOffset & operator-= (const NumericVectorWithOffset &v)
 subtracting elements of v from the current vector
NumericVectorWithOffset & operator*= (const NumericVectorWithOffset &v)
 multiplying elements of the current vector with elements of v
NumericVectorWithOffset & operator/= (const NumericVectorWithOffset &v)
 dividing all elements of the current vector by elements of v
NumericVectorWithOffset & operator+= (const elemT &v)
 adding an elemT to the elements of the current vector
NumericVectorWithOffset & operator-= (const elemT &v)
 subtracting an elemT from the elements of the current vector
NumericVectorWithOffset & operator*= (const elemT &v)
 multiplying the elements of the current vector with an elemT
NumericVectorWithOffset & operator/= (const elemT &v)
 dividing the elements of the current vector by an elemT
STIR_DEPRECATED void axpby (const elemT2 a, const NumericVectorWithOffset &x, const elemT2 b, const NumericVectorWithOffset &y)
void xapyb (const NumericVectorWithOffset &x, const elemT a, const NumericVectorWithOffset &y, const elemT b)
 set values of the array to x*a+y*b, where a and b are scalar
void xapyb (const NumericVectorWithOffset &x, const NumericVectorWithOffset &a, const NumericVectorWithOffset &y, const NumericVectorWithOffset &b)
 set the values of the array to x*a+y*b, where a and b are vectors
void sapyb (const T2 &a, const NumericVectorWithOffset &y, const T2 &b)
 set the values of the array to self*a+y*b, where a and b are scalar or vectors
void axpby (const NUMBER2 a, const NumericVectorWithOffset &x, const NUMBER2 b, const NumericVectorWithOffset &y)
Public Member Functions inherited from stir::VectorWithOffset< T >
int get_length () const
 return number of elements in this vector
size_t size () const
 return number of elements in this vector
int get_min_index () const
 get value of first valid index
int get_max_index () const
 get value of last valid index
void set_offset (const int min_index)
 change value of starting index
void set_min_index (const int min_index)
 identical to set_offset()
virtual void grow (const int min_index, const int max_index)
 grow the range of the vector, new elements are set to T()
void grow (const unsigned int new_size)
 grow the range of the vector from 0 to new_size-1, new elements are set to T()
virtual void resize (const int min_index, const int max_index)
 change the range of the vector, new elements are set to T()
void resize (const unsigned int new_size)
 change the range of the vector from 0 to new_size-1, new elements are set to T()
void reserve (const int min_index, const int max_index)
 make the allocated range at least from min_index to max_index
void reserve (const unsigned int new_size)
 make the allocated range at least from 0 to new_size-1
size_t capacity () const
 get allocated size
bool owns_memory_for_data () const
 check if this object owns the memory for the data
int get_capacity_min_index () const
 get min_index within allocated range
int get_capacity_max_index () const
 get max_index within allocated range
T & operator[] (int i)
 allow array-style access, read/write
const T & operator[] (int i) const
 array access, read-only
T & at (int i)
 allow array-style access, read/write, but with range checking (throws std::out_of_range)
const T & at (int i) const
 array access, read-only, but with range checking (throws std::out_of_range)
bool empty () const
 checks if the vector is empty
bool operator== (const VectorWithOffset &iv) const
bool operator!= (const VectorWithOffset &iv) const
void fill (const T &n)
 fill elements with value n
void apply_lower_threshold (const T &lower)
 Sets elements below value to the value.
void apply_upper_threshold (const T &upper)
 Sets elements above value to the value.
T * get_data_ptr ()
 member function for access to the data via a T*
const T * get_const_data_ptr () const
 member function for access to the data via a const T*
void release_data_ptr ()
 signal end of access to T*
void release_const_data_ptr () const
 signal end of access to const T*
iterator begin ()
 use to initialise an iterator to the first element of the vector
const_iterator begin () const
 use to initialise an iterator to the first element of the (const) vector
iterator end ()
 iterator 'past' the last element of the vector
const_iterator end () const
 iterator 'past' the last element of the (const) vector
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
VectorWithOffset & operator+= (const VectorWithOffset &v)
 adding elements of v to the current vector
VectorWithOffset & operator-= (const VectorWithOffset &v)
 subtracting elements of v from the current vector
VectorWithOffset & operator*= (const VectorWithOffset &v)
 multiplying elements of the current vector with elements of v
VectorWithOffset & operator/= (const VectorWithOffset &v)
 dividing all elements of the current vector by elements of v
 VectorWithOffset ()
 Default constructor: creates a vector of length 0.
 VectorWithOffset (const int hsz)
 Construct a VectorWithOffset of given length (initialised with T()).
 VectorWithOffset (const int min_index, const int max_index)
 Construct a VectorWithOffset with offset min_index (initialised with T()).
STIR_DEPRECATED VectorWithOffset (const int hsz, T *const data_ptr, T *const end_of_data_ptr)
 Construct a VectorWithOffset of given length pointing to existing data.
STIR_DEPRECATED VectorWithOffset (const int min_index, const int max_index, T *const data_ptr, T *const end_of_data_ptr)
 Construct a VectorWithOffset with offset min_index pointing to existing data.
 VectorWithOffset (const int hsz, const T *const data_ptr)
 Construct a VectorWithOffset of given length from a bare pointer (copying data).
 VectorWithOffset (const int min_index, const int max_index, const T *const data_ptr)
 Construct a VectorWithOffset with offset min_index from a bare pointer (copying data).
 VectorWithOffset (const int min_index, const int max_index, shared_ptr< T[]> data_sptr)
 Construct a VectorWithOffset sharing existing data.
 VectorWithOffset (const int sz, shared_ptr< T[]> data_sptr)
 Construct a VectorWithOffset sharing existing data.
 VectorWithOffset (const VectorWithOffset &il)
 copy constructor
virtual ~VectorWithOffset ()
 Destructor.
 VectorWithOffset (VectorWithOffset &&other) noexcept
 move constructor
void recycle ()
 Free all memory and make object as if default-constructed.
VectorWithOffset & operator= (const VectorWithOffset &il)
 assignment operator with another vector
VectorWithOffset operator+ (const VectorWithOffset &v) const
 adding vectors, element by element
VectorWithOffset operator- (const VectorWithOffset &v) const
 subtracting vectors, element by element
VectorWithOffset operator* (const VectorWithOffset &v) const
 multiplying vectors, element by element
VectorWithOffset operator/ (const VectorWithOffset &v) const
 dividing vectors, element by element

Additional Inherited Members

 Segment (const shared_ptr< const ProjDataInfo > &proj_data_info_sptr_v, const SegmentIndices &)
void check_state () const
 Called internally to see if all variables are consistent.
void init_with_copy (const int min_index, const int max_index, T const *const data_ptr)
 change vector to the new index range and copy data from data_ptr
void init (const int min_index, const int max_index, T *const data_ptr, bool copy_data)
 initialise vector to the given index range and either copy from or point to data_ptr
SegmentIndices _indices
Protected Attributes inherited from stir::DataWithProjDataInfo
shared_ptr< const ProjDataInfo > proj_data_info_sptr
T * num
 pointer to (*this)[0] (taking get_min_index() into account that is).

Detailed Description

template<typename elemT>
class stir::SegmentByView< elemT >

A class for storing (3d) projection data with fixed SegmentIndices.

Storage order is as follows:

segment_by_view[axial_pos_num][view_num][tangential_pos_num]

Constructor & Destructor Documentation

◆ SegmentByView() [1/5]

template<typename elemT>
stir::SegmentByView< elemT >::SegmentByView ( const Array< 3, elemT > & v,
const shared_ptr< const ProjDataInfo > & proj_data_info_sptr,
const SegmentIndices & ind )

Constructor that sets the data to a given 3d Array.

References SegmentByView().

Referenced by stir::ProjDataInMemory::get_segment_by_view(), SegmentByView(), SegmentByView(), SegmentByView(), and SegmentByView().

◆ SegmentByView() [2/5]

template<typename elemT>
stir::SegmentByView< elemT >::SegmentByView ( const shared_ptr< const ProjDataInfo > & proj_data_info_sptr,
const SegmentIndices & ind )

◆ SegmentByView() [3/5]

template<typename elemT>
stir::SegmentByView< elemT >::SegmentByView ( const Array< 3, elemT > & v,
const shared_ptr< const ProjDataInfo > & proj_data_info_ptr,
const int segment_num,
const int timing_pos_num = 0 )

Constructor that sets the data to a given 3d Array.

Deprecated
Use version with SegmentIndices instead

References SegmentByView().

◆ SegmentByView() [4/5]

template<typename elemT>
stir::SegmentByView< elemT >::SegmentByView ( const shared_ptr< const ProjDataInfo > & proj_data_info_ptr,
const int segment_num,
const int timing_pos_num = 0 )

Constructor that sets sizes via the ProjDataInfo object, initialising data to 0.

Deprecated
Use version with SegmentIndices instead

References SegmentByView().

◆ SegmentByView() [5/5]

Member Function Documentation

◆ get_storage_order()

template<typename elemT>
SegmentByView< elemT >::StorageOrder stir::SegmentByView< elemT >::get_storage_order ( ) const
inlineoverridevirtual

Get storage order.

Implements stir::Segment< elemT >.

References get_storage_order().

Referenced by get_storage_order().

◆ get_sinogram()

◆ get_viewgram()

template<typename elemT>
Viewgram< elemT > stir::SegmentByView< elemT >::get_viewgram ( int view_num) const
inlineoverridevirtual

Get viewgram.

Implements stir::Segment< elemT >.

References get_viewgram().

Referenced by get_viewgram(), and stir::ProjData::set_segment().

◆ set_sinogram() [1/2]

template<typename elemT>
void stir::SegmentByView< elemT >::set_sinogram ( const Sinogram< elemT > & s)
inlineoverridevirtual

Set sinogram.

Implements stir::Segment< elemT >.

References stir::Sinogram< elemT >::get_axial_pos_num(), and set_sinogram().

Referenced by set_sinogram().

◆ set_sinogram() [2/2]

template<typename elemT>
void stir::SegmentByView< elemT >::set_sinogram ( Sinogram< elemT > const & s,
int axial_pos_num )
overridevirtual

◆ set_viewgram()

template<typename elemT>
void stir::SegmentByView< elemT >::set_viewgram ( const Viewgram< elemT > & v)
inlineoverridevirtual

◆ grow()

template<typename elemT>
void stir::SegmentByView< elemT >::grow ( const IndexRange< 3 > & range)
override

Overloading Array::grow.

This makes sure that the new Array dimensions are the same as those in the ProjDataInfo member.

References resize().

◆ resize()


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