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

The SingleViewData class is the container class used to store all projections from one particular view. More...

#include <singleviewdata.h>

Classes

struct  Dimensions
 Struct that holds the dimensions, namely number of channels, rows and modules, of a SingleViewData object. More...
 
class  PixelIterator
 

Public Types

typedef Chunk2D< float > ModuleData
 Alias for template specialization Chunk2D<float>.
 
using iterator = PixelIterator< SingleViewData, ModuleData::iterator >
 
using const_iterator = PixelIterator< const SingleViewData, ModuleData::const_iterator >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

 SingleViewData (const ModuleData::Dimensions &moduleDimensions)
 
 SingleViewData (uint channelsPerModule, uint rowsPerModule)
 
 SingleViewData (const ModuleData &moduleData)
 
 SingleViewData (ModuleData &&moduleData)
 
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< ModuleData > & constData () const
 
const std::vector< ModuleData > & data () const
 
std::vector< ModuleData > & data ()
 
Dimensions dimensions () const
 
uint elementsPerModule () const
 
const ModuleDatafirst () const
 
ModuleDatafirst ()
 
ModuleDatamodule (uint i)
 
const ModuleDatamodule (uint i) const
 
uint nbModules () const
 
size_t totalPixelCount () const
 
void allocateMemory (uint nbModules)
 
void allocateMemory (uint nbModules, float initValue)
 
void append (ModuleData &&moduleData)
 
void append (const ModuleData &moduleData)
 
void append (std::vector< float > &&dataVector)
 
void append (const std::vector< float > &dataVector)
 
Chunk2D< float > combined (const ModuleLayout &layout=ModuleLayout(), bool *ok=nullptr) const
 
void fill (float fillValue)
 
void freeMemory ()
 
float max () const
 
float min () const
 
void setDataFromVector (const std::vector< float > &dataVector)
 
SingleViewData split (const ModuleLayout &layout) const
 Splits the projection data from a single module dataset into different modules according to the detector layout layout and returns the result. More...
 
std::vector< float > toVector () const
 
void transformToExtinction (double i0orN0=1.0)
 
void transformToIntensity (double i0=1.0)
 
void transformToCounts (double n0=1.0)
 
bool operator== (const SingleViewData &other) const
 
bool operator!= (const SingleViewData &other) const
 
SingleViewDataoperator+= (const SingleViewData &other)
 
SingleViewDataoperator-= (const SingleViewData &other)
 
SingleViewDataoperator *= (float factor)
 
SingleViewDataoperator/= (float divisor)
 
SingleViewData operator+ (const SingleViewData &other) const
 
SingleViewData operator- (const SingleViewData &other) const
 
SingleViewData operator * (float factor) const
 
SingleViewData operator/ (float divisor) const
 

Protected Attributes

ModuleData::Dimensions _moduleDim
 The dimensions of the individual modules.
 
std::vector< ModuleData_data
 The internal data storage vector.
 

Private Member Functions

bool hasEqualSizeAs (const ModuleData &other) const
 
bool hasEqualSizeAs (const std::vector< float > &other) const
 

Detailed Description

The SingleViewData class is the container class used to store all projections from one particular view.

In the generalized case, the detector consists of several individual flat-panel modules. Each of the modules acquires one projection image. The full set of these images are stored in a SingleViewData object.

Constructor & Destructor Documentation

◆ SingleViewData() [1/4]

CTL::SingleViewData::SingleViewData ( const ModuleData::Dimensions &  moduleDimensions)
explicit

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

◆ SingleViewData() [2/4]

CTL::SingleViewData::SingleViewData ( uint  channelsPerModule,
uint  rowsPerModule 
)

Constructs a SingleViewData object with individual module data dimensions of channelsPerModule x rowsPerModule. This does not allocate any memory for the actual data. To (explicitely) do so, use allocateMemory().

◆ SingleViewData() [3/4]

CTL::SingleViewData::SingleViewData ( const ModuleData moduleData)

Constructs a SingleViewData object containing only data of one module that is initialized with moduleData. You may use append() to add further modules.

◆ SingleViewData() [4/4]

CTL::SingleViewData::SingleViewData ( SingleViewData::ModuleData &&  moduleData)

Constructs a SingleViewData object containing only data of one module that is move-initialized with moduleData that is passed as an rvalue.

Member Function Documentation

◆ allocateMemory() [1/2]

void CTL::SingleViewData::allocateMemory ( uint  nbModules)

Enforces memory allocation. This resizes the internal std::vector to the required number of modules and requests memory allocation for each of the modules. As a result, the number of modules is equal to nbModules.

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

See also
allocateMemory(uint nbModules, float initValue)

◆ allocateMemory() [2/2]

void CTL::SingleViewData::allocateMemory ( uint  nbModules,
float  initValue 
)

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

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

◆ append() [1/4]

void CTL::SingleViewData::append ( ModuleData &&  moduleData)

Appends the data from moduleData to this single view. The dimensions of moduleData must match the dimensions of this view. Throws std::domain_error in case of mismatching dimensions.

Overloaded method that uses move-semantics.

See also
append(const ModuleData &)

◆ append() [2/4]

void CTL::SingleViewData::append ( const ModuleData moduleData)

Appends the data from moduleData to this single view. The dimensions of moduleData must match the dimensions of this view. Throws std::domain_error in case of mismatching dimensions.

See also
append(ModuleData&&)

◆ append() [3/4]

void CTL::SingleViewData::append ( std::vector< float > &&  dataVector)

Constructs a Chunk2D from the data in dataVector and appends it to this single view. dataVector must have the same number of elements that are required for the module data in this view, i.e. nbChannels x nbRows.Throws std::domain_error in case of mismatching dimensions.

Overloaded method that uses move-semantics.

See also
append(const std::vector<float>&)

◆ append() [4/4]

void CTL::SingleViewData::append ( const std::vector< float > &  dataVector)

Constructs a Chunk2D from the data in dataVector and appends it to this single view. dataVector must have the same number of elements that are required for the module data in this view, i.e. nbChannels x nbRows.Throws std::domain_error in case of mismatching dimensions.

See also
append(std::vector<float>&&)

◆ combined()

Chunk2D< float > CTL::SingleViewData::combined ( const ModuleLayout layout = ModuleLayout(),
bool *  ok = nullptr 
) const

Combines the projection data from all modules into a single Chunk2D 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::ModuleData > & CTL::SingleViewData::constData ( ) const

Returns a constant reference to the stored data vector.

◆ data() [1/2]

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

Returns a constant reference to the stored data vector.

◆ data() [2/2]

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

Returns a reference to the stored data vector.

◆ dimensions()

SingleViewData::Dimensions CTL::SingleViewData::dimensions ( ) const

Returns the dimensions of the data. This contains module width (nbChannels), module height (nbRows) and the number of modules (nbModules).

◆ elementsPerModule()

uint CTL::SingleViewData::elementsPerModule ( ) const

Returns the number of elements (or pixels) per module.

Same as: dimensions().nbChannels * dimensions().nbRows.

◆ fill()

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

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

◆ first() [1/2]

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

Same as module(0).

◆ first() [2/2]

SingleViewData::ModuleData & CTL::SingleViewData::first ( )

Same as module(0).

◆ freeMemory()

void CTL::SingleViewData::freeMemory ( )

Removes all modules from the view and deletes the image data.

◆ hasEqualSizeAs() [1/2]

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

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

◆ hasEqualSizeAs() [2/2]

bool CTL::SingleViewData::hasEqualSizeAs ( const std::vector< float > &  other) const
private

Returns true if the number of elements in other is equal to the number of elements in an individual module of this instance.

◆ max()

float CTL::SingleViewData::max ( ) const

Returns the maximum value in this instance.

Returns zero if this data is empty.

◆ min()

float CTL::SingleViewData::min ( ) const

Returns the minimum value in this instance.

Returns zero if this data is empty.

◆ module() [1/2]

SingleViewData::ModuleData & CTL::SingleViewData::module ( uint  i)

Returns a (modifiable) reference to the projection data of module i. Does not perform boundary checks.

◆ module() [2/2]

const SingleViewData::ModuleData & CTL::SingleViewData::module ( uint  i) const

Returns a constant reference to the projection data of module i. Does not perform boundary checks.

◆ nbModules()

uint CTL::SingleViewData::nbModules ( ) const

Returns the number of modules.

◆ operator *()

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

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

◆ operator *=()

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

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

◆ operator+()

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

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

◆ operator+=()

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

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

◆ operator/()

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

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

◆ operator/=()

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

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

◆ setDataFromVector()

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

Sets the 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 and the other modules.

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

◆ split()

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

Splits the projection data from a single module dataset into different modules according to the detector layout layout 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.

◆ totalPixelCount()

size_t CTL::SingleViewData::totalPixelCount ( ) const

Returns the total number of pixels in the data. This computes as nbChannels x nbRows x nbModules.

Same as: nbModules() * elementsPerModule().

◆ toVector()

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

Concatenates the projection data from all modules into a vector and returns the result.

Data is concatenated in row major order, i.e. the vector starts with the data from the first row of the first module, followed by the remaining rows of that module. Subsequently, the next modules are appended with the same concept.

◆ transformToCounts()

void CTL::SingleViewData::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}). \)

◆ transformToExtinction()

void CTL::SingleViewData::transformToExtinction ( double  i0orN0 = 1.0)

Transforms all data values in this instance to extinction (w.r.t. the initial intensity i0 or photon count n0) using the following formula:

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

◆ transformToIntensity()

void CTL::SingleViewData::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}). \)


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