CTL  0.6.1
Computed Tomography Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CTL::ProjectionData Class Reference

The ProjectionData class is the container class used to store all projections from all views. More...

#include <projectiondata.h>

Collaboration diagram for CTL::ProjectionData:
Collaboration graph
[legend]

Classes

struct  Dimensions
 Struct that holds the dimensions of a ProjectionData object. More...
 
class  PixelIterator
 

Public Types

typedef PixelIterator< ProjectionData, SingleViewData::iteratoriterator
 
typedef PixelIterator< const ProjectionData, SingleViewData::const_iteratorconst_iterator
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 

Public Member Functions

 ProjectionData (const SingleViewData::Dimensions &viewDimensions)
 
 ProjectionData (uint channelsPerModule, uint rowsPerModule, uint nbModules)
 
 ProjectionData (const SingleViewData &singleViewData)
 
 ProjectionData (SingleViewData &&singleViewData)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
const std::vector< SingleViewData > & constData () const
 
const std::vector< SingleViewData > & data () const
 
std::vector< SingleViewData > & data ()
 
Dimensions dimensions () const
 
const SingleViewDatafirst () const
 
SingleViewDatafirst ()
 
uint nbViews () const
 
SingleViewDataview (uint i)
 
const SingleViewDataview (uint i) const
 
SingleViewData::Dimensions viewDimensions () const
 
void allocateMemory (uint nbViews)
 
void allocateMemory (uint nbViews, float initValue)
 
void append (SingleViewData &&singleView)
 
void append (const SingleViewData &singleView)
 
ProjectionData combined (const ModuleLayout &layout=ModuleLayout()) const
 
void fill (float fillValue)
 
void freeMemory ()
 
float max () const
 
float min () const
 
void setDataFromVector (const std::vector< float > &dataVector)
 
ProjectionData split (const ModuleLayout &layout) const
 Splits the projection data from a single module dataset into different modules according to the detector layout layout for all views and returns the result. More...
 
std::vector< float > toVector () const
 
void transformToExtinction (double i0=1.0)
 
void transformToExtinction (const std::vector< double > &viewDependentI0)
 
void transformToIntensity (double i0=1.0)
 
void transformToIntensity (const std::vector< double > &viewDependentI0)
 
void transformToCounts (double n0=1.0)
 
void transformToCounts (const std::vector< double > &viewDependentN0)
 
bool operator== (const ProjectionData &other) const
 
bool operator!= (const ProjectionData &other) const
 
ProjectionDataoperator+= (const ProjectionData &other)
 
ProjectionDataoperator-= (const ProjectionData &other)
 
ProjectionDataoperator *= (float factor)
 
ProjectionDataoperator/= (float divisor)
 
ProjectionData operator+ (const ProjectionData &other) const
 
ProjectionData operator- (const ProjectionData &other) const
 
ProjectionData operator * (float factor) const
 
ProjectionData operator/ (float divisor) const
 

Static Public Member Functions

static ProjectionData dummy ()
 Constructs a ProjectionData object with dimensions (0, 0, 0). More...
 

Protected Attributes

SingleViewData::Dimensions _viewDim
 The dimensions of the individual single views.
 
std::vector< SingleViewData_data
 The internal data storage vector.
 

Private Member Functions

bool hasEqualSizeAs (const SingleViewData &other) const
 
template<class Function >
void parallelExecution (const Function &f) const
 

Detailed Description

The ProjectionData class is the container class used to store all projections from all views.

This container holds all projection data in a vector of SingleViewData objects. Individual single views can be added using append(). Alternatively, the entire data can be set from a std::vector using setDataFromVector(). This might be useful to convert data from other sources that provide the projection as a one dimensional memory block.

Constructor & Destructor Documentation

◆ ProjectionData() [1/4]

CTL::ProjectionData::ProjectionData ( const SingleViewData::Dimensions viewDimensions)
explicit

Constructs a ProjectionData object with dimensions for the individual single views as specified by viewDimensions. This does not allocate any memory for the actual data. To (explicitely) do so, use allocateMemory().

◆ ProjectionData() [2/4]

CTL::ProjectionData::ProjectionData ( uint  channelsPerModule,
uint  rowsPerModule,
uint  nbModules 
)

Constructs a ProjectionData object with dimensions for the individual single views specified by channelsPerModule, rowsPerModule and nbModules. This does not allocate any memory for the actual data. To (explicitely) do so, use allocateMemory().

◆ ProjectionData() [3/4]

CTL::ProjectionData::ProjectionData ( const SingleViewData singleViewData)

Constructs a ProjectionData object containing only data of one view that is initialized with singleViewData. You may use append() to add further projections.

◆ ProjectionData() [4/4]

CTL::ProjectionData::ProjectionData ( SingleViewData &&  singleViewData)

Constructs a ProjectionData object containing only data of one view that is move-initialized with singleViewData that is passed as an rvalue.

Member Function Documentation

◆ allocateMemory() [1/2]

void CTL::ProjectionData::allocateMemory ( uint  nbViews)

Enforces memory allocation and allocates memory for nbViews views. As a result, the number of views is equal to nbViews.

Note that if the current number of views is less than nbViews the additionally allocated views remain uninitialized, i.e. they contain undefined values.

See also
allocateMemory(uint nbViews, float initValue), SingleViewData::allocateMemory().

◆ allocateMemory() [2/2]

void CTL::ProjectionData::allocateMemory ( uint  nbViews,
float  initValue 
)

Enforces memory allocation and if the current number of views is less than nbViews, the additionally appended views are initialized with initValue.

See also
allocateMemory(uint nbViews), fill().

◆ append() [1/2]

void CTL::ProjectionData::append ( SingleViewData &&  singleView)

Appends the data from singleView to this single view. The dimensions of singleView must match the dimensions specified for single views in this dataset. Throws std::domain_error in case of mismatching dimensions.

Overloaded method that uses move-semantics.

See also
append(const SingleViewData &)

◆ append() [2/2]

void CTL::ProjectionData::append ( const SingleViewData singleView)

Appends the data from singleView to this single view. The dimensions of singleView must match the dimensions specified for single views in this dataset. Throws std::domain_error in case of mismatching dimensions.

See also
append(SingleViewData&&)

◆ combined()

ProjectionData CTL::ProjectionData::combined ( const ModuleLayout layout = ModuleLayout()) const

Combines the projection data from all modules into single Chunk2Ds for all views and returns the result.

To combine the data, a layout is required that describes the arrangement of the individual modules.

◆ constData()

const std::vector< SingleViewData > & CTL::ProjectionData::constData ( ) const

Returns a constant reference to the stored data vector.

◆ data() [1/2]

const std::vector< SingleViewData > & CTL::ProjectionData::data ( ) const

Returns a constant reference to the stored data vector.

◆ data() [2/2]

std::vector< SingleViewData > & CTL::ProjectionData::data ( )

Returns a reference to the stored data vector.

◆ dimensions()

ProjectionData::Dimensions CTL::ProjectionData::dimensions ( ) const

Returns the dimensions of the data. This contains the number of views (nbViews), the number of modules in each view (nbModules) and the dimensions of individual modules, namely module width (nbChannels) and module height (nbRows).

◆ dummy()

ProjectionData CTL::ProjectionData::dummy ( )
static

Constructs a ProjectionData object with dimensions (0, 0, 0).

Intended for explicitely marking placeholder variables.

Same as: ProjectionData{0, 0, 0};

Example:

// introduce the dummy object
bool someCriterion = someDecisionFunction(); // decides which situation should be handled
if(someCriterion)
{
projections = ProjectionData(13, 37, 42);
projections.allocateMemory(10, 1.0f);
}
else
{
projections = someFunctionThatReturnsProjections();
// NOTE: here, we might not know the size of the projections in advance
}
// do something with 'projections'
// ...

◆ fill()

void CTL::ProjectionData::fill ( float  fillValue)

Fills the projection data with fillValue. Note that this will overwrite all data.

◆ first() [1/2]

const SingleViewData & CTL::ProjectionData::first ( ) const

Same as view(0).

◆ first() [2/2]

SingleViewData & CTL::ProjectionData::first ( )

Same as view(0).

◆ freeMemory()

void CTL::ProjectionData::freeMemory ( )

Removes all views from the projection data and deletes the image data.

◆ hasEqualSizeAs()

bool CTL::ProjectionData::hasEqualSizeAs ( const SingleViewData other) const
private

Returns true if the dimensions of other are equal to those of the views in this instance.

◆ max()

float CTL::ProjectionData::max ( ) const

Returns the maximum value in this instance.

Returns zero if this data is empty.

◆ min()

float CTL::ProjectionData::min ( ) const

Returns the minimum value in this instance.

Returns zero if this data is empty.

◆ nbViews()

uint CTL::ProjectionData::nbViews ( ) const

Returns the number of views in the data.

◆ operator *()

ProjectionData CTL::ProjectionData::operator * ( float  factor) const

Multiplies all projection data in this instance by factor and returns the result.

◆ operator *=()

ProjectionData & CTL::ProjectionData::operator *= ( float  factor)

Multiplies all projection data in this instance by factor and returns a reference to this instance.

◆ operator+()

ProjectionData CTL::ProjectionData::operator+ ( const ProjectionData other) const

Returns the (element-wise) sum of other and this instance. Throws an std::domain_error if the dimensions of other and this view do not match.

◆ operator+=()

ProjectionData & CTL::ProjectionData::operator+= ( const ProjectionData other)

Adds the data from other to this instance and returns a reference to this instance. Throws an std::domain_error if the dimensions of other and this instance do not match.

◆ operator/()

ProjectionData CTL::ProjectionData::operator/ ( float  divisor) const

Divides all projection data in this instance by divisor and returns the result.

◆ operator/=()

ProjectionData & CTL::ProjectionData::operator/= ( float  divisor)

Divides all projection data in this instance by divisor and returns a reference to this instance.

◆ parallelExecution()

template<class Function >
void CTL::ProjectionData::parallelExecution ( const Function &  f) const
private

Helper function for running tasks in parallel over views.

◆ setDataFromVector()

void CTL::ProjectionData::setDataFromVector ( const std::vector< float > &  dataVector)

Sets the projection data of this instance based on the data given by dataVector. For this, it is assumed that the data in dataVector has row major order, i.e. all values of a module row, followed by the remaining rows, the other modules of the same view and finally all other views.

This method is provided for convenience to serve as an alternative to use append() for individual views.

◆ split()

ProjectionData CTL::ProjectionData::split ( const ModuleLayout layout) const

Splits the projection data from a single module dataset into different modules according to the detector layout layout for all views and returns the result.

To split the data, a layout is required that describes the arrangement of the individual modules. Note that only data containing a single module can be split.

Throws an exception of data cannot be split; this happens if:

  • this instance has more than a single module,
  • the number of channels and rows in this instance's data is not divisable by the number of columns and rows in layout
  • layout contains a module id more than once.

◆ toVector()

std::vector< float > CTL::ProjectionData::toVector ( ) const

Concatenates the projection data from all views and returns it as a one-dimensional vector.

◆ transformToCounts() [1/2]

void CTL::ProjectionData::transformToCounts ( double  n0 = 1.0)

Transforms all data values in this instance to photon counts (w.r.t. the initial photon count passed by n0) using the following formula:

\( \mathtt{newValue}=n0\cdot\exp(-\mathtt{oldValue}). \)

◆ transformToCounts() [2/2]

void CTL::ProjectionData::transformToCounts ( const std::vector< double > &  viewDependentN0)

Transforms all data values in this instance to photon counts (w.r.t. the view-dependent initial photon counts passed by viewDependentN0) using the following formula:

\( \mathtt{newValue}_{v}=n0_{v}\cdot\exp(-\mathtt{oldValue}_{v})\,,\quad v=1,...,\textrm{nbViews}. \)

◆ transformToExtinction() [1/2]

void CTL::ProjectionData::transformToExtinction ( double  i0 = 1.0)

Transforms all data values in this instance to extinction (w.r.t. the initial intensity passed by i0) using the following formula:

\( \mathtt{newValue}=\ln\frac{i0}{\mathtt{oldValue}}. \)

◆ transformToExtinction() [2/2]

void CTL::ProjectionData::transformToExtinction ( const std::vector< double > &  viewDependentI0)

Transforms all data values in this instance to extinction (w.r.t. the view-dependent initial intensities passed by viewDependentI0) using the following formula:

\( \mathtt{newValue}_{v}=\ln\frac{i0_{v}}{\mathtt{oldValue}_{v}}\,,\quad v=1,...,\textrm{nbViews}. \)

◆ transformToIntensity() [1/2]

void CTL::ProjectionData::transformToIntensity ( double  i0 = 1.0)

Transforms all data values in this instance to intensities (w.r.t. the initial intensity passed by i0) using the following formula:

\( \mathtt{newValue}=i0\cdot\exp(-\mathtt{oldValue}). \)

◆ transformToIntensity() [2/2]

void CTL::ProjectionData::transformToIntensity ( const std::vector< double > &  viewDependentI0)

Transforms all data values in this instance to intensities (w.r.t. the view-dependent initial intensities passed by viewDependentI0) using the following formula:

\( \mathtt{newValue}_{v}=i0_{v}\cdot\exp(-\mathtt{oldValue}_{v})\,,\quad v=1,...,\textrm{nbViews}. \)

◆ view() [1/2]

SingleViewData & CTL::ProjectionData::view ( uint  i)

Returns a (modifiable) reference to the SingleViewData of view i.

◆ view() [2/2]

const SingleViewData & CTL::ProjectionData::view ( uint  i) const

Returns a constant reference to the SingleViewData of view i.

◆ viewDimensions()

SingleViewData::Dimensions CTL::ProjectionData::viewDimensions ( ) const

Returns the dimensions of the individual single views in the dataset. This contains the number of modules (nbModules) and the dimensions of individual modules (nbChannels and nbRows).


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