diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-27 13:57:04 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-27 13:57:04 +0200 |
commit | 1a8243ed0311c3074a79b97e1730bf3409774b8d (patch) | |
tree | bc1c499f211c832ab8f28f332f616deb2403b5e9 /src/GeometryUtil2D.cpp | |
parent | e1a3f0ba1fe7455d0c9183ad07f106aebc1c821f (diff) | |
download | astra-1a8243ed0311c3074a79b97e1730bf3409774b8d.tar.gz astra-1a8243ed0311c3074a79b97e1730bf3409774b8d.tar.bz2 astra-1a8243ed0311c3074a79b97e1730bf3409774b8d.tar.xz astra-1a8243ed0311c3074a79b97e1730bf3409774b8d.zip |
Unify some parallel_vec parameter computations
Diffstat (limited to 'src/GeometryUtil2D.cpp')
-rw-r--r-- | src/GeometryUtil2D.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
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; } |