RISA
|
This stage computes the attenuation coefficients in the fan beam sinogram. More...
#include <Attenuation.h>
Public Types | |
using | input_type = glados::Image< glados::cuda::DeviceMemoryManager< unsigned short, 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 | |
Attenuation (const std::string &configFile) | |
Initializes everything, that needs to be done only once. More... | |
~Attenuation () | |
Destroys everything that is not destroyed automatically. More... | |
auto | process (input_type &&img) -> void |
Pushes the sinogram to the processor-threads. More... | |
auto | wait () -> output_type |
Takes one sinogram 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 | init () -> void |
Capsules the average computation of dark and reference measurement. More... | |
template<typename T > | |
auto | computeAverage (const std::vector< T > &values, std::vector< float > &average) -> void |
computes the average values from the given input files More... | |
template<typename T > | |
auto | computeDarkAverage (const std::vector< T > &values, std::vector< float > &average) -> void |
template<typename T > | |
auto | readDarkInputFiles (std::string &file, std::vector< T > &values) -> void |
template<typename T > | |
auto | readInput (std::string &path, std::vector< T > &values, const int numberOfFrames) -> void |
template<typename T > | |
auto | relevantAreaMask (std::vector< T > &mask) -> void |
Computes a mask to hide the unrelevant areas in the fan beam sinogram. 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_type > | results_ |
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::map< int, unsigned int > | memoryPoolIdxs_ |
stores the indeces received when regisitering in MemoryPool More... | |
int | numberOfDevices_ |
the number of available CUDA devices in the system More... | |
unsigned int | chunkSize_ {500u} |
defines how much input data is loaded from reference and dark input at once More... | |
int | numberOfDetectorModules_ |
the number of detector modules More... | |
int | numberOfDetectors_ |
the number of detectors in the fan beam sinogram More... | |
int | numberOfProjections_ |
the number of projections in the fan beam sinogram More... | |
int | numberOfPlanes_ |
the number of detector planes More... | |
int | numberOfDarkFrames_ |
the number of frames in the dark measurement More... | |
int | numberOfRefFrames_ |
the number of frames in the reference measurement More... | |
std::string | pathDark_ |
file path to dark measurement data More... | |
std::string | pathReference_ |
file path to reference measurement data More... | |
double | sourceOffset_ |
source offset in the fan beam sinogram More... | |
double | lowerLimOffset_ |
lower offset, which is masked More... | |
double | upperLimOffset_ |
upper offset, which is masked More... | |
unsigned int | xa_ |
unsigned int | xb_ |
unsigned int | xc_ |
unsigned int | xd_ |
unsigned int | xe_ |
unsigned int | xf_ |
double | threshMin_ |
minimum threshold for defect detector interpolation More... | |
double | threshMax_ |
maximum threshold for defect detector interpolation More... | |
int | blockSize2D_ |
2D block size of the attenuation kernel More... | |
int | memPoolSize_ |
specifies, how many elements are allocated by memory pool More... | |
std::vector< float > | avgDark_ |
stores averaged dark measurement on host More... | |
std::vector< float > | avgReference_ |
stores averaged reference measurement on host More... | |
This stage computes the attenuation coefficients in the fan beam sinogram.
This class represents the attenuation stage. It computes the attenuation data on the GPU device using the CUDA language. Multi GPU usage is possible.
Definition at line 68 of file Attenuation.h.
using risa::cuda::Attenuation::deviceManagerType = glados::cuda::DeviceMemoryManager<float, glados::cuda::async_copy_policy> |
Definition at line 74 of file Attenuation.h.
using risa::cuda::Attenuation::input_type = glados::Image<glados::cuda::DeviceMemoryManager<unsigned short, glados::cuda::async_copy_policy>> |
The input data type that needs to fit the output type of the previous stage.
Definition at line 71 of file Attenuation.h.
using risa::cuda::Attenuation::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.
Definition at line 73 of file Attenuation.h.
risa::cuda::Attenuation::Attenuation | ( | 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.
[in] | configFile | path to configuration file |
Definition at line 48 of file Attenuation.cu.
risa::cuda::Attenuation::~Attenuation | ( | ) |
Destroys everything that is not destroyed automatically.
Tells MemoryPool to free the allocated memory. Destroys the cudaStreams.
Definition at line 81 of file Attenuation.cu.
|
private |
computes the average values from the given input files
[in] | values | vector, containing the data read from the input files |
[out] | average | vector, containing the averaged data |
Definition at line 237 of file Attenuation.cu.
|
private |
Definition at line 220 of file Attenuation.cu.
|
private |
Capsules the average computation of dark and reference measurement.
Fills the host vectors avgDark_ and avgReference_ with the computed data from the input files.
Definition at line 177 of file Attenuation.cu.
auto risa::cuda::Attenuation::process | ( | input_type && | img | ) | -> void |
Pushes the sinogram to the processor-threads.
[in] | img | input data that arrived from previous stage |
Definition at line 93 of file Attenuation.cu.
|
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 attenuation CUDA kernel in its own stream. After the computation of the attenuation data, the fan beam sinogram is pushed into the output queue
[in] | deviceID | specifies on which CUDA device to execute the device functions |
Definition at line 118 of file Attenuation.cu.
|
private |
Read configuration values from configuration file.
All values needed for setting up the class are read from the config file in this function.
[in] | configFile | path to config file |
true | configuration options were read successfully |
false | configuration options could not be read successfully |
Definition at line 383 of file Attenuation.cu.
|
private |
Definition at line 254 of file Attenuation.cu.
|
private |
Definition at line 275 of file Attenuation.cu.
|
private |
Computes a mask to hide the unrelevant areas in the fan beam sinogram.
Due to the special geometry of ROFEX (e.g. limited angle) there are areas where it is known from a priori knowledge that all values need to be zero. This mask is multiplied with the fan beam sinogramm after the attenuation computation.
[out] | mask | contains the values of the mask |
Definition at line 328 of file Attenuation.cu.
auto risa::cuda::Attenuation::wait | ( | ) | -> output_type |
Takes one sinogram from the output queue results_ and transfers it to the neighbored stage.
Definition at line 114 of file Attenuation.cu.
|
private |
stores averaged dark measurement on host
Definition at line 202 of file Attenuation.h.
|
private |
stores averaged reference measurement on host
Definition at line 203 of file Attenuation.h.
|
private |
2D block size of the attenuation kernel
Definition at line 198 of file Attenuation.h.
|
private |
defines how much input data is loaded from reference and dark input at once
Definition at line 171 of file Attenuation.h.
|
private |
lower offset, which is masked
Definition at line 185 of file Attenuation.h.
|
private |
stores the indeces received when regisitering in MemoryPool
Definition at line 113 of file Attenuation.h.
|
private |
specifies, how many elements are allocated by memory pool
Definition at line 199 of file Attenuation.h.
|
private |
the number of frames in the dark measurement
Definition at line 178 of file Attenuation.h.
|
private |
the number of detector modules
Definition at line 174 of file Attenuation.h.
|
private |
the number of detectors in the fan beam sinogram
Definition at line 175 of file Attenuation.h.
|
private |
the number of available CUDA devices in the system
Definition at line 169 of file Attenuation.h.
|
private |
the number of detector planes
Definition at line 177 of file Attenuation.h.
|
private |
the number of projections in the fan beam sinogram
Definition at line 176 of file Attenuation.h.
|
private |
the number of frames in the reference measurement
Definition at line 179 of file Attenuation.h.
|
private |
file path to dark measurement data
Definition at line 180 of file Attenuation.h.
|
private |
file path to reference measurement data
Definition at line 181 of file Attenuation.h.
|
private |
stores the processor()-threads
Definition at line 111 of file Attenuation.h.
|
private |
the output queue in which the processed sinograms are stored
Definition at line 109 of file Attenuation.h.
|
private |
one separate input queue for each available CUDA device
Definition at line 108 of file Attenuation.h.
|
private |
source offset in the fan beam sinogram
Definition at line 184 of file Attenuation.h.
|
private |
stores the cudaStreams that are created once
Definition at line 112 of file Attenuation.h.
|
private |
maximum threshold for defect detector interpolation
Definition at line 195 of file Attenuation.h.
|
private |
minimum threshold for defect detector interpolation
Definition at line 194 of file Attenuation.h.
|
private |
upper offset, which is masked
Definition at line 186 of file Attenuation.h.
|
private |
Definition at line 187 of file Attenuation.h.
|
private |
Definition at line 188 of file Attenuation.h.
|
private |
Definition at line 189 of file Attenuation.h.
|
private |
Definition at line 190 of file Attenuation.h.
|
private |
Definition at line 191 of file Attenuation.h.
|
private |
Definition at line 192 of file Attenuation.h.