24 #ifndef CUDA_KERNELS_FAN2PARA_H_ 25 #define CUDA_KERNELS_FAN2PARA_H_ 31 #define _USE_MATH_DEFINES 42 T L, R, CA, eps, p1, p2, gamma, ae;
44 L = sqrt(DX * DX + DZ * DZ);
45 R = 0.5 * SourceRingDiam;
48 eps = (L * L + R * DX * CA) / (L * sqrt(L * L + R * R + 2.0 * R * DX * CA));
51 p1 = (L * L - R * DX) / (L * sqrt(L * L + R * R - 2.0 * R * DX));
52 p2 = (L * L + R * DX) / (L * sqrt(L * L + R * R + 2.0 * R * DX));
53 gamma = 0.5 * (acos(p1) - acos(p2));
55 ae = (eps * CA + gamma)
56 / sqrt(eps * eps + 2.0 * eps * gamma * CA + gamma * gamma);
61 return 2.0 * M_PI - acos(ae);
64 __global__
void interpolation(
int k,
const float* __restrict__ SinFan_data,
65 float* __restrict__ SinPar_data,
const float* __restrict__ Gamma,
66 const float* __restrict__ Teta,
const float* __restrict__ alpha_kreis,
67 const float* __restrict__ s,
const int* __restrict__ teta_nach_ray_1,
68 const int* __restrict__ teta_nach_ray_2,
69 const int* __restrict__ teta_vor_ray_1,
70 const int* __restrict__ teta_vor_ray_2,
71 const int* __restrict__ gamma_vor_ray_1,
72 const int* __restrict__ gamma_vor_ray_2,
73 const int* __restrict__ gamma_nach_ray_1,
74 const int* __restrict__ gamma_nach_ray_2,
75 const float* __restrict__ teta_ziel_ray_1,
76 const float* __restrict__ teta_ziel_ray_2,
77 const float* __restrict__ gamma_ziel_ray_1,
78 const float* __restrict__ gamma_ziel_ray_2,
const int* __restrict__ ray_1,
79 const int* __restrict__ ray_2,
const parameters* __restrict__ params) {
84 if (i >= (*params).numberOfParallelDetectors_
85 && j >= (*params).numberOfParallelProjections_)
89 float WZiel_1 = 0, WZiel_2 = 0, WZiel_end = 0, V1 = 0, V2 = 0, W1 = 0,
90 W2 = 0, W3 = 0, W4 = 0;
93 unsigned long long ind = j * (*params).numberOfParallelDetectors_ + i
94 + (k * (*params).numberOfParallelProjections_
95 * (*params).numberOfParallelDetectors_);
97 float temp_1 = s[i] / (*params).rDetector_;
99 if (temp_1 <= 1 || temp_1 >= -1) {
101 if (ray_1[ind] ==
true) {
103 W1 = SinFan_data[teta_vor_ray_1[ind] * (*params).numberOfFanDetectors_
104 + gamma_vor_ray_1[ind]];
105 W2 = SinFan_data[teta_vor_ray_1[ind] * (*params).numberOfFanDetectors_
106 + gamma_nach_ray_1[ind]];
107 W3 = SinFan_data[teta_nach_ray_1[ind] * (*params).numberOfFanDetectors_
108 + gamma_vor_ray_1[ind]];
109 W4 = SinFan_data[teta_nach_ray_1[ind] * (*params).numberOfFanDetectors_
110 + gamma_nach_ray_1[ind]];
114 + ((teta_ziel_ray_1[ind] - Teta[teta_vor_ray_1[ind]])
115 / (Teta[teta_nach_ray_1[ind]] - Teta[teta_vor_ray_1[ind]]))
118 + ((teta_ziel_ray_1[ind] - Teta[teta_vor_ray_1[ind]])
119 / (Teta[teta_nach_ray_1[ind]] - Teta[teta_vor_ray_1[ind]]))
122 + ((gamma_ziel_ray_1[ind] - Gamma[gamma_vor_ray_1[ind]])
123 / (Gamma[gamma_nach_ray_1[ind]]
124 - Gamma[gamma_vor_ray_1[ind]])) * (V2 - V1);
126 if (ray_2[ind] ==
true) {
129 W1 = SinFan_data[teta_vor_ray_2[ind] * (*params).numberOfFanDetectors_
130 + gamma_vor_ray_2[ind]];
131 W2 = SinFan_data[teta_vor_ray_2[ind] * (*params).numberOfFanDetectors_
132 + gamma_nach_ray_2[ind]];
133 W3 = SinFan_data[teta_nach_ray_2[ind] * (*params).numberOfFanDetectors_
134 + gamma_vor_ray_2[ind]];
135 W4 = SinFan_data[teta_nach_ray_2[ind] * (*params).numberOfFanDetectors_
136 + gamma_nach_ray_2[ind]];
140 + ((teta_ziel_ray_2[ind] - Teta[teta_vor_ray_2[ind]])
141 / (Teta[teta_nach_ray_2[ind]] - Teta[teta_vor_ray_2[ind]]))
144 + ((teta_ziel_ray_2[ind] - Teta[teta_vor_ray_2[ind]])
145 / (Teta[teta_nach_ray_2[ind]] - Teta[teta_vor_ray_2[ind]]))
148 + ((gamma_ziel_ray_2[ind] - Gamma[gamma_vor_ray_2[ind]])
149 / (Gamma[gamma_nach_ray_2[ind]]
150 - Gamma[gamma_vor_ray_2[ind]])) * (V2 - V1);
153 if (ray_1[ind] + ray_2[ind] > 0)
155 WZiel_end = (float) ray_1[ind]
156 / ((
float) ray_1[ind] + (float) ray_2[ind]) * WZiel_1
157 + (float) ray_2[ind] / ((
float) ray_1[ind] + (float) ray_2[ind])
161 const int address = j * (*params).numberOfParallelDetectors_;
162 const int parallelSize = (*params).numberOfParallelProjections_
163 * (*params).numberOfParallelDetectors_;
164 const int detectorSize_2 = (*params).numberOfParallelDetectors_ / 2;
165 int mirrorOffset = 0;
166 if (i < detectorSize_2)
167 mirrorOffset = (*params).numberOfParallelDetectors_ - i - 1;
169 mirrorOffset = -(i % detectorSize_2) + detectorSize_2 - 1;
170 if (j < ((*params).numberOfParallelProjections_ / 2))
172 atomicAdd(&SinPar_data[address + i], WZiel_end*0.5);
175 atomicAdd(&SinPar_data[address - parallelSize / 2 + mirrorOffset],
180 __global__
void setValue(T* data, T value,
int size) {
190 #endif //CUDA_KERNELS_FAN2PARA_H_
auto ellipse_kreis_uwe(T alpha, T DX, T DZ, T SourceRingDiam) -> T
__global__ void interpolation(int k, const float *__restrict__ SinFan_data, float *__restrict__ SinPar_data, const float *__restrict__ Gamma, const float *__restrict__ Teta, const float *__restrict__ alpha_kreis, const float *__restrict__ s, const int *__restrict__ teta_nach_ray_1, const int *__restrict__ teta_nach_ray_2, const int *__restrict__ teta_vor_ray_1, const int *__restrict__ teta_vor_ray_2, const int *__restrict__ gamma_vor_ray_1, const int *__restrict__ gamma_vor_ray_2, const int *__restrict__ gamma_nach_ray_1, const int *__restrict__ gamma_nach_ray_2, const float *__restrict__ teta_ziel_ray_1, const float *__restrict__ teta_ziel_ray_2, const float *__restrict__ gamma_ziel_ray_1, const float *__restrict__ gamma_ziel_ray_2, const int *__restrict__ ray_1, const int *__restrict__ ray_2, const parameters *__restrict__ params)
__device__ auto getY() -> unsigned int
collects all parameters that are needed in the fan to parallel beam interpolation kernel ...
__global__ void setValue(T *data, T value, int size)
__device__ auto getX() -> unsigned int