RISA
risa::cuda::Backprojection Class Reference

This stage back projects a parallel beam sinogram and returns the reconstructed image. More...

#include <Backprojection.h>

Collaboration diagram for risa::cuda::Backprojection:

Public Types

using input_type = glados::Image< glados::cuda::DeviceMemoryManager< float, glados::cuda::async_copy_policy >>
 The input data type that needs to fit the output type of the previous stage. More...
 
using output_type = glados::Image< glados::cuda::DeviceMemoryManager< float, glados::cuda::async_copy_policy >>
 The output data type that needs to fit the input type of the following stage. More...
 
using deviceManagerType = glados::cuda::DeviceMemoryManager< float, glados::cuda::async_copy_policy >
 

Public Member Functions

 Backprojection (const std::string &configFile)
 Initializes everything, that needs to be done only once. More...
 
 ~Backprojection ()
 Destroys everything that is not destroyed automatically. More...
 
auto process (input_type &&inp) -> void
 Pushes the filtered parallel beam sinogram to the processor-threads. More...
 
auto wait () -> output_type
 Takes one image from the output queue results_ and transfers it to the neighbored stage. More...
 

Private Member Functions

auto processor (const int deviceID) -> void
 main data processing routine executed in its own thread for each CUDA device, that performs the data processing of this stage More...
 
auto readConfig (const std::string &configFile) -> bool
 Read configuration values from configuration file. More...
 

Private Attributes

std::map< int, glados::Queue< input_type > > sinograms_
 one separate input queue for each available CUDA device More...
 
glados::Queue< output_typeresults_
 the output queue in which the processed sinograms are stored More...
 
std::map< int, std::thread > processorThreads_
 stores the processor()-threads More...
 
std::map< int, cudaStream_t > streams_
 stores the cudaStreams that are created once More...
 
std::vector< unsigned int > memoryPoolIdxs_
 stores the indeces received when regisitering in MemoryPool More...
 
int numberOfProjections_
 the number of projections in the parallel beam sinogramm over 180 degrees More...
 
int numberOfDetectors_
 the number of detectors in the parallel beam sinogramm More...
 
int numberOfPixels_
 the number of pixels in the reconstruction grid in one dimension More...
 
float rotationOffset_
 the rotation of the reconstructed image More...
 
float backProjectionAngleTotal_
 180° or 360° degrees More...
 
int numberOfDevices_
 the number of available CUDA devices in the system More...
 
detail::InterpolationType interpolationType_
 the interpolation type that shall be used More...
 
int blockSize2D_
 2D block size of the back projection kernel More...
 
int memPoolSize_
 specifies, how many elements are allocated by memory pool More...
 
bool useTextureMemory_
 stores, whether texture memory should be used (only nearest neighbour interpolation possible) More...
 

Detailed Description

This stage back projects a parallel beam sinogram and returns the reconstructed image.

This class represents the back projection stage. It computes the back projection on the GPU using the CUDA language. Multi GPU usage is supported.

Definition at line 109 of file Backprojection.h.

Member Typedef Documentation

The input data type that needs to fit the output type of the previous stage.

Definition at line 112 of file Backprojection.h.

The output data type that needs to fit the input type of the following stage.

Definition at line 114 of file Backprojection.h.

Constructor & Destructor Documentation

risa::cuda::Backprojection::Backprojection ( const std::string &  configFile)

Initializes everything, that needs to be done only once.

Runs as many processor-thread as CUDA devices are available in the system. Allocates memory using the MemoryPool for all CUDA devices.

Parameters
[in]configFilepath to configuration file

Definition at line 46 of file Backprojection.cu.

risa::cuda::Backprojection::~Backprojection ( )

Destroys everything that is not destroyed automatically.

Tells MemoryPool to free the allocated memory. Destroys the cudaStreams.

Definition at line 80 of file Backprojection.cu.

Member Function Documentation

auto risa::cuda::Backprojection::process ( input_type &&  inp) -> void

Pushes the filtered parallel beam sinogram to the processor-threads.

Parameters
[in]inpinput data that arrived from previous stage

Definition at line 91 of file Backprojection.cu.

auto risa::cuda::Backprojection::processor ( const int  deviceID) -> void
private

main data processing routine executed in its own thread for each CUDA device, that performs the data processing of this stage

This method takes one sinogram from the queue. It calls the desired back projection CUDA kernel in its own stream. After the computation of the back projection, the reconstructed image is pushed into the output queue

Parameters
[in]deviceIDspecifies on which CUDA device to execute the device functions
[in]streamIDspecifies on which CUDA stream to execute the device functions

Definition at line 115 of file Backprojection.cu.

auto risa::cuda::Backprojection::readConfig ( const std::string &  configFile) -> bool
private

Read configuration values from configuration file.

All values needed for setting up the class are read from the config file in this function.

Parameters
[in]configFilepath to config file
Return values
trueconfiguration options were read successfully
falseconfiguration options could not be read successfully

Definition at line 210 of file Backprojection.cu.

auto risa::cuda::Backprojection::wait ( ) -> output_type

Takes one image from the output queue results_ and transfers it to the neighbored stage.

Returns
the oldest reconstructed image in the output queue results_

Definition at line 111 of file Backprojection.cu.

Member Data Documentation

float risa::cuda::Backprojection::backProjectionAngleTotal_
private

180° or 360° degrees

Definition at line 162 of file Backprojection.h.

int risa::cuda::Backprojection::blockSize2D_
private

2D block size of the back projection kernel

Definition at line 169 of file Backprojection.h.

detail::InterpolationType risa::cuda::Backprojection::interpolationType_
private

the interpolation type that shall be used

Definition at line 166 of file Backprojection.h.

std::vector<unsigned int> risa::cuda::Backprojection::memoryPoolIdxs_
private

stores the indeces received when regisitering in MemoryPool

Definition at line 156 of file Backprojection.h.

int risa::cuda::Backprojection::memPoolSize_
private

specifies, how many elements are allocated by memory pool

Definition at line 170 of file Backprojection.h.

int risa::cuda::Backprojection::numberOfDetectors_
private

the number of detectors in the parallel beam sinogramm

Definition at line 159 of file Backprojection.h.

int risa::cuda::Backprojection::numberOfDevices_
private

the number of available CUDA devices in the system

Definition at line 164 of file Backprojection.h.

int risa::cuda::Backprojection::numberOfPixels_
private

the number of pixels in the reconstruction grid in one dimension

Definition at line 160 of file Backprojection.h.

int risa::cuda::Backprojection::numberOfProjections_
private

the number of projections in the parallel beam sinogramm over 180 degrees

Definition at line 158 of file Backprojection.h.

std::map<int, std::thread> risa::cuda::Backprojection::processorThreads_
private

stores the processor()-threads

Definition at line 154 of file Backprojection.h.

glados::Queue<output_type> risa::cuda::Backprojection::results_
private

the output queue in which the processed sinograms are stored

Definition at line 152 of file Backprojection.h.

float risa::cuda::Backprojection::rotationOffset_
private

the rotation of the reconstructed image

Definition at line 161 of file Backprojection.h.

std::map<int, glados::Queue<input_type> > risa::cuda::Backprojection::sinograms_
private

one separate input queue for each available CUDA device

Definition at line 151 of file Backprojection.h.

std::map<int, cudaStream_t> risa::cuda::Backprojection::streams_
private

stores the cudaStreams that are created once

Definition at line 155 of file Backprojection.h.

bool risa::cuda::Backprojection::useTextureMemory_
private

stores, whether texture memory should be used (only nearest neighbour interpolation possible)

Definition at line 172 of file Backprojection.h.


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