elsa projectors_cuda¶
Table of Contents
SiddonsMethodCUDA¶

template<typename
data_t
= real_t>
classelsa
::
SiddonsMethodCUDA
: public elsa::LinearOperator<real_t>¶ GPUoperator representing the discretized Xray transform in 2d/3d using Siddon’s method.
The volume is traversed along the rays as specified by the
Geometry. Each ray is traversed in a continguous fashion (i.e. along long voxel borders, not diagonally) and each traversed voxel is counted as a hit with weight according to the length of the path of the ray through the voxel. Author
Nikola Dinev
 Template Parameters
data_t
: data type for the domain and range of the operator, defaulting to real_t
The geometry is represented as a list of projection matrices (see class Geometry), one for each acquisition pose.
Forward projection is accomplished using apply(), backward projection using applyAdjoint(). This projector is matched.
Currently only utilizes a single GPU. Volume and images should both fit in device memory at the same time.
Public Functions

SiddonsMethodCUDA
(const VolumeDescriptor &domainDescriptor, const DetectorDescriptor &rangeDescriptor)¶ Constructor for Siddon’s method traversal.
The domain is expected to be 2 or 3 dimensional (volSizeX, volSizeY, [volSizeZ]), the range is expected to be matching the domain (detSizeX, [detSizeY], acqPoses).
 Parameters
[in] domainDescriptor
: describing the domain of the operator (the volume)[in] rangeDescriptor
: describing the range of the operator (the sinogram)[in] geometryList
: vector containing the geometries for the acquisition poses

~SiddonsMethodCUDA
() override¶ destructor
Protected Functions

SiddonsMethodCUDA
(const SiddonsMethodCUDA<data_t>&) = default¶ default copy constructor, hidden from nonderived classes to prevent potential slicing

void
applyImpl
(const DataContainer<data_t> &x, DataContainer<data_t> &Ax) const override¶ apply Siddon’s method (i.e. forward projection)

void
applyAdjointImpl
(const DataContainer<data_t> &y, DataContainer<data_t> &Aty) const override¶ apply the adjoint of Siddon’s method (i.e. backward projection)

SiddonsMethodCUDA<data_t> *
cloneImpl
() const override¶ implement the polymorphic clone operation

bool
isEqual
(const LinearOperator<data_t> &other) const override¶ implement the polymorphic comparison operation
Private Functions

template<bool
adjoint
>
voidtraverseVolume
(void *volumePtr, void *sinoPtr) const¶ sets up and starts the kernel traversal routine (for both apply/applyAdjoint)

template<cudaMemcpyKind
direction
, boolasync
= true>
voidcopy3DDataContainerGPU
(void *hostData, const cudaPitchedPtr &gpuData, const cudaExtent &extent) const¶ Copies contents of a 3D data container between GPU and host memory.
Note that hostData is expected to be a pointer to a linear memory region with no padding between dimensions  e.g. the data in
DataContainer is stored as a vector with no extra padding, and the pointer to the start of the memory region can be retrieved as follows: Template Parameters
direction
: specifies the direction of the copy operationasync
: whether the copy should be performed asynchronously wrt. the host
 Parameters
hostData
: pointer to host datagpuData
: pointer to gpu data[in] extent
: specifies the amount of data to be copied
DataContainer x; void* hostData = (void*)&x[0];
Private Members

BoundingBox
_boundingBox
¶ the bounding box of the volume

DetectorDescriptor &
_detectorDescriptor
¶ Reference to DetectorDescriptor stored in LinearOperator.

VolumeDescriptor &
_volumeDescriptor
¶ Reference to VolumeDescriptor stored in LinearOperator.

cudaPitchedPtr
_projInvMatrices
¶ inverse of of projection matrices; stored columnwise on GPU

cudaPitchedPtr
_rayOrigins
¶ ray origins for each acquisition angle
JosephsMethodCUDA¶

template<typename
data_t
= real_t>
classelsa
::
JosephsMethodCUDA
: public elsa::LinearOperator<real_t>¶ GPUoperator representing the discretized Xray transform in 2d/3d using Joseph’s method.
The volume is traversed along the rays as specified by the
Geometry. For interior voxels the sampling point is located in the middle of the two planes orthogonal to the main direction of the ray. For boundary voxels the sampling point is located at the center of the ray intersection with the voxel. Author
Nikola Dinev
 Template Parameters
data_t
: data type for the domain and range of the operator, defaulting to real_t
The geometry is represented as a list of projection matrices (see class Geometry), one for each acquisition pose.
Forward projection is accomplished using apply(), backward projection using applyAdjoint(). The projector provides two implementations for the backward projection. The slow version is matched, while the fast one is not.
Currently only utilizes a single GPU. Volume and images should both fit in device memory at the same time.
 Warning
Hardware interpolation is only supported for JosephsMethodCUDA<float>
 Warning
Hardware interpolation is significantly less accurate than the software interpolation
Public Functions

JosephsMethodCUDA
(const VolumeDescriptor &domainDescriptor, const DetectorDescriptor &rangeDescriptor, bool fast = true)¶ Constructor for Joseph’s traversal method.
The domain is expected to be 2 or 3 dimensional (volSizeX, volSizeY, [volSizeZ]), the range is expected to be matching the domain (detSizeX, [detSizeY], acqPoses).
 Parameters
[in] domainDescriptor
: describing the domain of the operator (the volume)[in] rangeDescriptor
: describing the range of the operator (the sinogram)[in] geometryList
: vector containing the geometries for the acquisition poses[in] fast
: performs fast backward projection if set, otherwise matched; forward projection is unaffected

~JosephsMethodCUDA
() override¶ destructor
Protected Functions

JosephsMethodCUDA
(const JosephsMethodCUDA<data_t> &other)¶ copy constructor, used for cloning

void
applyImpl
(const DataContainer<data_t> &x, DataContainer<data_t> &Ax) const override¶ apply Joseph’s method (i.e. forward projection)

void
applyAdjointImpl
(const DataContainer<data_t> &y, DataContainer<data_t> &Aty) const override¶ apply the adjoint of Joseph’s method (i.e. backward projection)

JosephsMethodCUDA<data_t> *
cloneImpl
() const override¶ implement the polymorphic clone operation

bool
isEqual
(const LinearOperator<data_t> &other) const override¶ implement the polymorphic comparison operation
Private Types

using
cudaArrayFlags
= unsigned int¶ convenience typedef for cuda array flags
Private Functions

template<cudaMemcpyKind
direction
, boolasync
= true>
voidcopy3DDataContainer
(void *hostData, const cudaPitchedPtr &gpuData, const cudaExtent &extent) const¶ Copies contents of a 3D data container between GPU and host memory.
Note that hostData is expected to be a pointer to a linear memory region with no padding between dimensions  e.g. the data in
DataContainer is stored as a vector with no extra padding, and the pointer to the start of the memory region can be retrieved as follows: Template Parameters
direction
: specifies the direction of the copy operationasync
: whether the copy should be performed asynchronously wrt. the host
 Parameters
hostData
: pointer to host datagpuData
: pointer to gpu data[in] extent
: specifies the amount of data to be copied
DataContainer x; void* hostData = (void*)&x[0];

template<cudaArrayFlags
flags
= 0U>
std::pair<cudaTextureObject_t, cudaArray*>copyTextureToGPU
(const DataContainer<data_t> &hostData) const¶ Copies the entire contents of DataContainer to the GPU texture memory.
 Return
a pair of the created texture object and its associated cudaArray
 Template Parameters
cudaArrayFlags
: flags used for the creation of the cudaArray which will contain the data
 Parameters
[in] hostData
: the host data container
Private Members

BoundingBox
_boundingBox
¶ the bounding box of the volume

DetectorDescriptor &
_detectorDescriptor
¶ Reference to DetectorDescriptor stored in LinearOperator.

VolumeDescriptor &
_volumeDescriptor
¶ Reference to VolumeDescriptor stored in LinearOperator.

const bool
_fast
¶ flag specifying which version of the backward projection should be used

cudaPitchedPtr
_projInvMatrices
¶ inverse of of projection matrices; stored columnwise on GPU

cudaPitchedPtr
_projMatrices
¶ projection matrices; stored columnwise on GPU

cudaPitchedPtr
_rayOrigins
¶ ray origins for each acquisition angle