From 1a8243ed0311c3074a79b97e1730bf3409774b8d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 27 Sep 2017 13:57:04 +0200 Subject: Unify some parallel_vec parameter computations --- src/GeometryUtil2D.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/GeometryUtil2D.cpp b/src/GeometryUtil2D.cpp index 1bca2bc..2ee6185 100644 --- a/src/GeometryUtil2D.cpp +++ b/src/GeometryUtil2D.cpp @@ -104,13 +104,27 @@ SFanProjection* genFanProjections(unsigned int iProjAngles, // Convert a SParProjection back into its set of "standard" circular parallel // beam parameters. This is always possible. -bool getParParameters(const SParProjection &proj /* , ... */) +bool getParParameters(const SParProjection &proj, unsigned int iProjDets, float &fAngle, float &fDetSize, float &fOffset) { - // angle - // det size - // offset + // Take part of DetU orthogonal to Ray + double ux = proj.fDetUX; + double uy = proj.fDetUY; + + double t = (ux * proj.fRayX + uy * proj.fRayY) / (proj.fRayX * proj.fRayX + proj.fRayY * proj.fRayY); + + ux -= t * proj.fRayX; + uy -= t * proj.fRayY; + + double angle = atan2(uy, ux); + + fAngle = (float)angle; + + double norm2 = uy * uy + ux * ux; + + fDetSize = (float)sqrt(norm2); - // (see convertAndUploadAngles in par_fp.cu) + // CHECKME: SIGNS? + fOffset = (float)(-0.5*iProjDets - (proj.fDetSY*uy + proj.fDetSX*ux) / norm2); return true; } -- cgit v1.2.3