RISA
risa::cuda::Masking Class Reference

This stage multiplies a precomputed mask with the reconstructed image. More...

#include <Masking.h>

Collaboration diagram for risa::cuda::Masking:

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...
 

Public Member Functions

 Masking (const std::string &configFile)
 Initializes everything, that needs to be done only once. More...
 
 ~Masking ()
 Destroys everything that is not destroyed automatically. More...
 
auto process (input_type &&img) -> 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 (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 > > imgs_
 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...
 
int numberOfDevices_
 the number of available CUDA devices in the system More...
 
int numberOfPixels_
 the number of pixels in the reconstruction grid in one dimension More...
 
bool performNormalization_ {true}
 specifies, if the normalization via thrust shall be performed (! performance drop, so far) More...
 
float maskingValue_ {0.0}
 the value to which the masked area should be set More...
 

Detailed Description

This stage multiplies a precomputed mask with the reconstructed image.

This class represents a masking stage. It multiplies the reconstructed image with a precomputed mask in a CUDA kernel, to hide irrelevant areas.

Definition at line 43 of file Masking.h.

Member Typedef Documentation

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

Definition at line 47 of file Masking.h.

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

Definition at line 49 of file Masking.h.

Constructor & Destructor Documentation

risa::cuda::Masking::Masking ( 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.

Parameters
[in]configFilepath to configuration file

Definition at line 55 of file Masking.cu.

risa::cuda::Masking::~Masking ( )

Destroys everything that is not destroyed automatically.

Destroys the cudaStreams.

Definition at line 80 of file Masking.cu.

Member Function Documentation

auto risa::cuda::Masking::process ( input_type &&  img) -> void

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

Parameters
[in]inpinput data that arrived from previous stage

Definition at line 88 of file Masking.cu.

auto risa::cuda::Masking::processor ( 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 reconstruced image from the queue. It calls the masking CUDA kernel in its own stream. After the multiplication of the mask with the image, the result is pushed into the output queue

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

Definition at line 113 of file Masking.cu.

auto risa::cuda::Masking::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 146 of file Masking.cu.

auto risa::cuda::Masking::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 109 of file Masking.cu.

Member Data Documentation

std::map<int, glados::Queue<input_type> > risa::cuda::Masking::imgs_
private

one separate input queue for each available CUDA device

Definition at line 82 of file Masking.h.

float risa::cuda::Masking::maskingValue_ {0.0}
private

the value to which the masked area should be set

Definition at line 103 of file Masking.h.

int risa::cuda::Masking::numberOfDevices_
private

the number of available CUDA devices in the system

Definition at line 98 of file Masking.h.

int risa::cuda::Masking::numberOfPixels_
private

the number of pixels in the reconstruction grid in one dimension

Definition at line 100 of file Masking.h.

bool risa::cuda::Masking::performNormalization_ {true}
private

specifies, if the normalization via thrust shall be performed (! performance drop, so far)

Definition at line 102 of file Masking.h.

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

stores the processor()-threads

Definition at line 85 of file Masking.h.

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

the output queue in which the processed sinograms are stored

Definition at line 83 of file Masking.h.

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

stores the cudaStreams that are created once

Definition at line 86 of file Masking.h.


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