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

This stores the non-zero projection matrix elements for every 'densel' that contributes to a given bin. More...

#include "stir/recon_buildblock/ProjMatrixElemsForOneBin.h"

Public Types

typedef ProjMatrixElemsForOneBinValue value_type
 Recommended way to call the type of the elements, instead of referring to the actual classname. More...
 
typedef Element_vector::iterator iterator
 typedefs for iterator support
 
typedef Element_vector::const_iterator const_iterator
 
typedef Element_vector::size_type size_type
 
typedef Element_vector::difference_type difference_type
 
typedef std::random_access_iterator_tag iterator_category
 
typedef value_typereference
 
typedef const value_typeconst_reference
 

Public Member Functions

 ProjMatrixElemsForOneBin (const Bin &bin=Bin(), const int default_capacity=0)
 constructor More...
 
Succeeded check_state () const
 check if each voxel occurs only once
 
const Binget_bin () const
 get the bin coordinates corresponding to this row
 
void set_bin (const Bin &)
 and set the bin coordinates
 
iterator begin ()
 functions for allowing iterator access
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void erase ()
 reset lor to 0 length
 
iterator erase (iterator it)
 remove a single value_type
 
void push_back (const value_type &)
 add a new value_type object at the end More...
 
void reserve (size_type max_number)
 reserve enough space for max_number elements (but don't fill them in)
 
size_type size () const
 number of non-zero elements
 
size_type capacity () const
 number of allocated elements
 
ProjMatrixElemsForOneBinoperator*= (const float d)
 Multiplies all values with a constant.
 
ProjMatrixElemsForOneBinoperator/= (const float d)
 Divides all values with a constant.
 
void sort ()
 Sort the elements on coordinates of the voxels. More...
 
void merge (ProjMatrixElemsForOneBin &lor)
 merge 2nd lor into current object More...
 
bool operator== (const ProjMatrixElemsForOneBin &) const
 Compare 2 lors to see if they are equal. More...
 
bool operator!= (const ProjMatrixElemsForOneBin &) const
 Compare 2 lors.
 
float square_sum () const
 Return sum of squares of all values. More...
 
void back_project (DiscretisedDensity< 3, float > &, const Bin &) const
 back project a single bin (accumulates)
 
void forward_project (Bin &, const DiscretisedDensity< 3, float > &) const
 forward project into a single bin (accumulates)
 
void back_project (DiscretisedDensity< 3, float > &, const RelatedBins &) const
 back project related bins (accumulates)
 
void forward_project (RelatedBins &, const DiscretisedDensity< 3, float > &) const
 forward project related bins (accumulates)
 

Detailed Description

This stores the non-zero projection matrix elements for every 'densel' that contributes to a given bin.

In the usual terminology, this class implements a Line (or Tube) of Response (LOR, or TOR).

Todo:
Most of the members of this class would work just as well for a (not yet existing) class ProjMatrixElemsForOneDensel. This means that we should derived both from a common base class, templated in the type of element.
Todo:
It might be useful to template this class in terms of the element-type as well. That way, we could have 'compact' elements, efficient elements, etc. However, doing this will probably only be useful if all ProjMatrixByBin classes are then templated as well, which would be a pain.

Member Typedef Documentation

◆ value_type

Recommended way to call the type of the elements, instead of referring to the actual classname.

Think about this name as 'the type of the value of a ProjMatrixElemsForOneBin::iterator *'.

This typedef is also required for 'standard' iterators.

Constructor & Destructor Documentation

◆ ProjMatrixElemsForOneBin()

stir::ProjMatrixElemsForOneBin::ProjMatrixElemsForOneBin ( const Bin bin = Bin(),
const int  default_capacity = 0 
)
explicit

constructor

Parameters
bineffectively calls set_bin(bin)
default_capacityeffectively calls reserve(default_capacity)

Member Function Documentation

◆ push_back()

void stir::ProjMatrixElemsForOneBin::push_back ( const value_type el)
inline

add a new value_type object at the end

Warning
For future compatibility, it is required (but not checked) that the elements are added such that calling sort() after the push_back() would not change the order of the elements. Otherwise, schemes for 'incremental' storing of coordinates would require too much overhead.

Referenced by merge(), stir::ProjMatrixByBinSinglePhoton::set_up(), stir::ProjMatrixByBinPinholeSPECTUB::~ProjMatrixByBinPinholeSPECTUB(), and stir::ProjMatrixByBinSPECTUB::~ProjMatrixByBinSPECTUB().

◆ sort()

void stir::ProjMatrixElemsForOneBin::sort ( )

Sort the elements on coordinates of the voxels.

Uses value_type::coordinates_less as ordering function.

References begin(), and stir::ProjMatrixElemsForOneBinValue::coordinates_less().

Referenced by check_state(), and merge().

◆ merge()

void stir::ProjMatrixElemsForOneBin::merge ( ProjMatrixElemsForOneBin lor)

merge 2nd lor into current object

This makes sure that in the result, no duplicate coordinates occur.

Warning
This currently modifies the argument lor.

References begin(), check_state(), stir::ProjMatrixElemsForOneBinValue::coordinates_equal(), stir::ProjMatrixElemsForOneBinValue::coordinates_less(), erase(), push_back(), size(), and sort().

◆ operator==()

bool stir::ProjMatrixElemsForOneBin::operator== ( const ProjMatrixElemsForOneBin lor) const

Compare 2 lors to see if they are equal.

Warning
Compares element by element. Does not sort first or so.
Compares float values, so uses a tolerance. This tolerance is currently set to a fraction of the maximum value in the first lor.
this is a fairly CPU intensive operation.

References begin().

◆ square_sum()

float stir::ProjMatrixElemsForOneBin::square_sum ( ) const

Return sum of squares of all values.

Warning
This sums over all elements in the LOR, irrespective if they are inside the FOV or not

References begin(), and stir::square().


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