From ca9d1d4729dfeef41d72f861d85951eb40f44b4b Mon Sep 17 00:00:00 2001 From: Georg Schramm <40211162+gschramm@users.noreply.github.com> Date: Sat, 14 Dec 2024 17:27:49 +0100 Subject: [PATCH] skip TOF backprojections along LOR where the sum over TOF is zero (#104) Co-authored-by: Georg Schramm --- c/src/joseph3d_back_tof_sino.c | 12 ++++++++++++ cuda/src/projector_kernels.cu | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/c/src/joseph3d_back_tof_sino.c b/c/src/joseph3d_back_tof_sino.c index dbf7b0b9..63fed0f5 100644 --- a/c/src/joseph3d_back_tof_sino.c +++ b/c/src/joseph3d_back_tof_sino.c @@ -46,6 +46,18 @@ void joseph3d_back_tof_sino(const float *xstart, # pragma omp parallel for schedule(static) for(i = 0; i < nlors; i++) { + float tof_lor_sum = 0; + + // check whether the sum over TOF of the TOF sinogram to be backprojcted is > 0 + // if it is 0, we can skip the backprojection of this LOR + for (int j = 0; j < n_tofbins; j++) { + tof_lor_sum += p[i * n_tofbins + j]; + } + + if (tof_lor_sum == 0) { + continue; + } + float d0, d1, d2, d0_sq, d1_sq, d2_sq; float cs0, cs1, cs2, cf; float lsq, cos0_sq, cos1_sq, cos2_sq; diff --git a/cuda/src/projector_kernels.cu b/cuda/src/projector_kernels.cu index 749e0bcb..0b9a05f4 100644 --- a/cuda/src/projector_kernels.cu +++ b/cuda/src/projector_kernels.cu @@ -816,8 +816,20 @@ extern "C" __global__ void joseph3d_back_tof_sino_cuda_kernel(float *xstart, int n_half = n_tofbins/2; + float tof_lor_sum = 0.0f; + if(i < nlors) { + // check whether the sum over TOF of the TOF sinogram to be backprojcted is > 0 + // if it is 0, we can skip the backprojection of this LOR + for (int j = 0; j < n_tofbins; j++) { + tof_lor_sum += p[i * n_tofbins + j]; + } + + if (tof_lor_sum == 0) { + return; + } + float d0, d1, d2, d0_sq, d1_sq, d2_sq; float cs0, cs1, cs2, cf; float lsq, cos0_sq, cos1_sq, cos2_sq;