| 109 | |
| 110 | template<typename T, typename CT> |
| 111 | void richardsonLucy(Array<T>& currentEstimate, const Array<T>& in, |
| 112 | const Array<CT>& P, const Array<CT>& Pc, |
| 113 | const unsigned iters, const float normFactor, |
| 114 | const dim4 odims) { |
| 115 | for (unsigned i = 0; i < iters; ++i) { |
| 116 | auto fft1 = fft_r2c<CT, T>(currentEstimate, BASE_DIM); |
| 117 | auto cmul1 = arithOp<CT, af_mul_t>(fft1, P, P.dims()); |
| 118 | auto ifft1 = fft_c2r<CT, T>(cmul1, normFactor, odims, BASE_DIM); |
| 119 | auto div1 = arithOp<T, af_div_t>(in, ifft1, in.dims()); |
| 120 | auto fft2 = fft_r2c<CT, T>(div1, BASE_DIM); |
| 121 | auto cmul2 = arithOp<CT, af_mul_t>(fft2, Pc, Pc.dims()); |
| 122 | auto ifft2 = fft_c2r<CT, T>(cmul2, normFactor, odims, BASE_DIM); |
| 123 | |
| 124 | currentEstimate = |
| 125 | arithOp<T, af_mul_t>(currentEstimate, ifft2, ifft2.dims()); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | template<typename T, typename CT> |
| 130 | void landweber(Array<T>& currentEstimate, const Array<T>& in, |