From 975537c8c68b115399af522cb1a0a1e731eca576 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 2 Apr 2019 15:56:57 +0200 Subject: Fix fan-beam FBP scaling --- src/GeometryUtil2D.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/GeometryUtil2D.cpp b/src/GeometryUtil2D.cpp index e09a3bc..806572f 100644 --- a/src/GeometryUtil2D.cpp +++ b/src/GeometryUtil2D.cpp @@ -28,6 +28,7 @@ along with the ASTRA Toolbox. If not, see . #include "astra/GeometryUtil2D.h" #include +#include namespace astra { @@ -158,14 +159,16 @@ bool getFanParameters(const SFanProjection &proj, unsigned int iProjDets, float // project origin on detector line ( == project source on detector line) double t = (- proj.fDetSX) * proj.fDetUX + (- proj.fDetSY) * proj.fDetUY; + t /= (proj.fDetUX * proj.fDetUX + proj.fDetUY * proj.fDetUY); fOffset = (float)t - 0.5*iProjDets; - // TODO: CHECKME fOriginDetector = sqrt((proj.fDetSX + t * proj.fDetUX)*(proj.fDetSX + t * proj.fDetUX) + (proj.fDetSY + t * proj.fDetUY)*(proj.fDetSY + t * proj.fDetUY)); - //float fAngle = atan2(proj.fDetSX + t * proj.fDetUX - proj.fSrcX, proj.fDetSY + t * proj.fDetUY); // TODO: Fix order + sign - fAngle = atan2(proj.fDetUY, proj.fDetUX); // TODO: Check order + sign + fAngle = atan2(proj.fDetUY, proj.fDetUX); + + //fprintf(stderr, "getFanParams: s = (%f,%f) d = (%f,%f) u = (%f,%f)\n", proj.fSrcX, proj.fSrcY, proj.fDetSX, proj.fDetSY, proj.fDetUX, proj.fDetUY); + //fprintf(stderr, "getFanParams: fOS = %f, fOD = %f, detsize = %f, offset = %f (t = %f), angle = %f\n", fOriginSource, fOriginDetector, fDetSize, fOffset, t, fAngle); return true; } -- cgit v1.2.3