From 52ebf0670ae39abea04344c32a1dc054c6816a03 Mon Sep 17 00:00:00 2001
From: Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>
Date: Wed, 24 May 2017 11:52:05 +0200
Subject: Document FDK weighting slightly better

---
 cuda/3d/cone_bp.cu | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

(limited to 'cuda/3d')

diff --git a/cuda/3d/cone_bp.cu b/cuda/3d/cone_bp.cu
index c3405b8..02242b0 100644
--- a/cuda/3d/cone_bp.cu
+++ b/cuda/3d/cone_bp.cu
@@ -126,6 +126,9 @@ __global__ void dev_cone_BP(void* D_volData, unsigned int volPitch, int startAng
 			float fVNum = fCv.w + fX * fCv.x + fY * fCv.y + fZ * fCv.z;
 			float fDen  = fCd.w + fX * fCd.x + fY * fCd.y + fZ * fCd.z;
 
+			// fCd.w = -|| u v s || (determinant of 3x3 matrix with cols u,v,s)
+			// fDen =  || u v (x-s) ||
+
 			float fU,fV, fr;
 
 			for (int idx = 0; idx < ZSIZE; idx++)
@@ -134,9 +137,17 @@ __global__ void dev_cone_BP(void* D_volData, unsigned int volPitch, int startAng
 				fU = fUNum * fr;
 				fV = fVNum * fr;
 				float fVal = tex3D(gT_coneProjTexture, fU, fAngle, fV);
-				if (FDKWEIGHT)
+				if (FDKWEIGHT) {
+					// The correct factor here is this one:
+					// Z[idx] += (fr*fCd.w)*(fr*fCd.w)*fVal;
+					// This is the square of the inverse magnification factor
+					// from fX,fY,fZ to the detector.
+
+					// Since we are assuming we have a circular cone
+					// beam trajectory, fCd.w is constant, and we instead
+					// multiply by fCd.w*fCd.w in the FDK preweighting step.
 					Z[idx] += fr*fr*fVal;
-				else
+				} else
 					Z[idx] += fVal;
 
 				fUNum += fCu.z;
-- 
cgit v1.2.3