RISA
risa::cuda::Filter Class Reference

This stage filters the projections in the parallel beam sinogram with a precomputed filter function. More...

#include <Filter.h>

Collaboration diagram for risa::cuda::Filter:

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

 Filter (const std::string &configFile)
 Initializes everything, that needs to be done only once. More...
 
 ~Filter ()
 Destroys everything that is not destroyed automatically. More...
 
auto process (input_type &&sinogram) -> 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 initCuFFT (const int deviceID) -> void
 initializes the cuFFT and creates the forward and inverse plans once for each deviceID More...
 
auto readConfig (const std::string &configFile) -> bool
 Read configuration values from configuration file. More...
 
auto designFilter () -> void
 

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...
 
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 over 180 degrees More...
 
int numberOfPixels_
 the number of pixels in the reconstruction grid in one dimension More...
 
detail::FilterType filterType_
 the filter type that shall be used; standarf filter type is the ramp filter. More...
 
float cutoffFraction_
 the fraction at which the filter function is cropped and set to zero. More...
 
int numberOfDevices_
 the number of available CUDA devices in the system More...
 
int blockSize2D_
 the block size of the filter kernel More...
 
std::map< int, cufftHandle > plansFwd_
 the forward plans for the cuFFT forward transformation; for each device one; More...
 
std::map< int, cufftHandle > plansInv_
 the inverse plans for the cuFFT inverse tranformation; for each device one; More...
 
std::map< int, cudaStream_t > streams_
 stores the cudaStreams that are created once More...
 
std::vector< float > filter_
 stores the values of the filter function More...
 

Detailed Description

This stage filters the projections in the parallel beam sinogram with a precomputed filter function.

Definition at line 57 of file Filter.h.

Member Typedef Documentation

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

Definition at line 60 of file Filter.h.

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

Definition at line 62 of file Filter.h.

Constructor & Destructor Documentation

risa::cuda::Filter::Filter ( 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 44 of file Filter.cu.

risa::cuda::Filter::~Filter ( )

Destroys everything that is not destroyed automatically.

Destroys the cudaStreams.

Definition at line 67 of file Filter.cu.

Member Function Documentation

auto risa::cuda::Filter::designFilter ( ) -> void
private

Definition at line 169 of file Filter.cu.

auto risa::cuda::Filter::initCuFFT ( const int  deviceID) -> void
private

initializes the cuFFT and creates the forward and inverse plans once for each deviceID

Parameters
[in]deviceIDthe ID of the device that shall be initialized for cuFFT

Definition at line 145 of file Filter.cu.

auto risa::cuda::Filter::process ( input_type &&  sinogram) -> void

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

Parameters
[in]inpinput data that arrived from previous stage

Definition at line 77 of file Filter.cu.

auto risa::cuda::Filter::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 filter CUDA kernel in its own stream. After the computation of the filtered projections the filtered parallel sinogram is pushed into the output queue

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

Definition at line 102 of file Filter.cu.

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

Read configuration values from configuration file.

CUDA Kernel that weights all the projections with the filter function.

All values needed for setting up the class are read from the config file in this function. If an invalid filter function is requested, the ramp filter is used.

Parameters
[in]configFilepath to config file
Return values
trueconfiguration options were read successfully
falseconfiguration options could not be read successfullyThis function computes the requested filter function once on the host

Definition at line 193 of file Filter.cu.

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

Member Data Documentation

int risa::cuda::Filter::blockSize2D_
private

the block size of the filter kernel

Definition at line 109 of file Filter.h.

float risa::cuda::Filter::cutoffFraction_
private

the fraction at which the filter function is cropped and set to zero.

Definition at line 104 of file Filter.h.

std::vector<float> risa::cuda::Filter::filter_
private

stores the values of the filter function

Definition at line 116 of file Filter.h.

detail::FilterType risa::cuda::Filter::filterType_
private

the filter type that shall be used; standarf filter type is the ramp filter.

Definition at line 103 of file Filter.h.

int risa::cuda::Filter::numberOfDetectors_
private

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

Definition at line 100 of file Filter.h.

int risa::cuda::Filter::numberOfDevices_
private

the number of available CUDA devices in the system

Definition at line 106 of file Filter.h.

int risa::cuda::Filter::numberOfPixels_
private

the number of pixels in the reconstruction grid in one dimension

Definition at line 101 of file Filter.h.

int risa::cuda::Filter::numberOfProjections_
private

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

Definition at line 99 of file Filter.h.

std::map<int, cufftHandle> risa::cuda::Filter::plansFwd_
private

the forward plans for the cuFFT forward transformation; for each device one;

Definition at line 111 of file Filter.h.

std::map<int, cufftHandle> risa::cuda::Filter::plansInv_
private

the inverse plans for the cuFFT inverse tranformation; for each device one;

Definition at line 112 of file Filter.h.

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

stores the processor()-threads

Definition at line 97 of file Filter.h.

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

the output queue in which the processed sinograms are stored

Definition at line 95 of file Filter.h.

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

one separate input queue for each available CUDA device

Definition at line 94 of file Filter.h.

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

stores the cudaStreams that are created once

Definition at line 114 of file Filter.h.


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