CTL
0.6.1
Computed Tomography Library
|
The ProjectionData class is the container class used to store all projections from all views. More...
#include <projectiondata.h>
Classes | |
struct | Dimensions |
Struct that holds the dimensions of a ProjectionData object. More... | |
class | PixelIterator |
Public Types | |
typedef PixelIterator< ProjectionData, SingleViewData::iterator > | iterator |
typedef PixelIterator< const ProjectionData, SingleViewData::const_iterator > | const_iterator |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_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 SingleViewData & | first () const |
SingleViewData & | first () |
uint | nbViews () const |
SingleViewData & | view (uint i) |
const SingleViewData & | view (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 |
ProjectionData & | operator+= (const ProjectionData &other) |
ProjectionData & | operator-= (const ProjectionData &other) |
ProjectionData & | operator *= (float factor) |
ProjectionData & | operator/= (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 |
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.
|
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().
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().
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.
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.
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.
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.
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.
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.
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.
const std::vector< SingleViewData > & CTL::ProjectionData::constData | ( | ) | const |
Returns a constant reference to the stored data vector.
const std::vector< SingleViewData > & CTL::ProjectionData::data | ( | ) | const |
Returns a constant reference to the stored data vector.
std::vector< SingleViewData > & CTL::ProjectionData::data | ( | ) |
Returns a reference to the stored data vector.
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
).
|
static |
Constructs a ProjectionData object with dimensions (0, 0, 0).
Intended for explicitely marking placeholder variables.
Same as: ProjectionData{0, 0, 0};
Example:
void CTL::ProjectionData::fill | ( | float | fillValue | ) |
Fills the projection data with fillValue. Note that this will overwrite all data.
const SingleViewData & CTL::ProjectionData::first | ( | ) | const |
Same as view(0)
.
SingleViewData & CTL::ProjectionData::first | ( | ) |
Same as view(0)
.
void CTL::ProjectionData::freeMemory | ( | ) |
Removes all views from the projection data and deletes the image data.
|
private |
Returns true if the dimensions of other are equal to those of the views in this instance.
float CTL::ProjectionData::max | ( | ) | const |
Returns the maximum value in this instance.
Returns zero if this data is empty.
float CTL::ProjectionData::min | ( | ) | const |
Returns the minimum value in this instance.
Returns zero if this data is empty.
uint CTL::ProjectionData::nbViews | ( | ) | const |
Returns the number of views in the data.
ProjectionData CTL::ProjectionData::operator * | ( | float | factor | ) | const |
Multiplies all projection data in this instance by factor and returns the result.
ProjectionData & CTL::ProjectionData::operator *= | ( | float | factor | ) |
Multiplies all projection data in this instance by factor and returns a reference to this instance.
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.
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.
ProjectionData CTL::ProjectionData::operator/ | ( | float | divisor | ) | const |
Divides all projection data in this instance by divisor and returns the result.
ProjectionData & CTL::ProjectionData::operator/= | ( | float | divisor | ) |
Divides all projection data in this instance by divisor and returns a reference to this instance.
|
private |
Helper function for running tasks in parallel over views.
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.
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:
std::vector< float > CTL::ProjectionData::toVector | ( | ) | const |
Concatenates the projection data from all views and returns it as a one-dimensional vector.
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}). \)
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}. \)
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}}. \)
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}. \)
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}). \)
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}. \)
SingleViewData & CTL::ProjectionData::view | ( | uint | i | ) |
Returns a (modifiable) reference to the SingleViewData of view i.
const SingleViewData & CTL::ProjectionData::view | ( | uint | i | ) | const |
Returns a constant reference to the SingleViewData of view i.
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
).