From ae518f2954d8c6b9f1d5156595ccb1d7dc2ec581 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 5 Feb 2016 14:54:47 +0100 Subject: Process non-cubic-voxel astra geometries --- cuda/3d/astra3d.cu | 15 ++++++++---- include/astra/GeometryUtil3D.h | 52 +++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/cuda/3d/astra3d.cu b/cuda/3d/astra3d.cu index 454530e..42cece2 100644 --- a/cuda/3d/astra3d.cu +++ b/cuda/3d/astra3d.cu @@ -72,29 +72,36 @@ static bool convertAstraGeometry_internal(const CVolumeGeometry3D* pVolGeom, assert(pVolGeom); assert(pProjs); +#if 0 // TODO: Relative instead of absolute const float EPS = 0.00001f; if (abs(pVolGeom->getPixelLengthX() - pVolGeom->getPixelLengthY()) > EPS) return false; if (abs(pVolGeom->getPixelLengthX() - pVolGeom->getPixelLengthZ()) > EPS) return false; - +#endif // Translate float dx = -(pVolGeom->getWindowMinX() + pVolGeom->getWindowMaxX()) / 2; float dy = -(pVolGeom->getWindowMinY() + pVolGeom->getWindowMaxY()) / 2; float dz = -(pVolGeom->getWindowMinZ() + pVolGeom->getWindowMaxZ()) / 2; - float factor = 1.0f / pVolGeom->getPixelLengthX(); + float fx = 1.0f / pVolGeom->getPixelLengthX(); + float fy = 1.0f / pVolGeom->getPixelLengthY(); + float fz = 1.0f / pVolGeom->getPixelLengthZ(); for (int i = 0; i < iProjectionAngleCount; ++i) { // CHECKME: Order of scaling and translation pProjs[i].translate(dx, dy, dz); - pProjs[i].scale(factor); + pProjs[i].scale(fx, fy, fz); } + params.fVolScaleX = pVolGeom->getPixelLengthX(); + params.fVolScaleY = pVolGeom->getPixelLengthY(); + params.fVolScaleZ = pVolGeom->getPixelLengthZ(); + // CHECKME: Check factor - params.fOutputScale *= pVolGeom->getPixelLengthX(); + //params.fOutputScale *= pVolGeom->getPixelLengthX(); return true; } diff --git a/include/astra/GeometryUtil3D.h b/include/astra/GeometryUtil3D.h index e4d73e4..e051240 100644 --- a/include/astra/GeometryUtil3D.h +++ b/include/astra/GeometryUtil3D.h @@ -56,19 +56,19 @@ struct SConeProjection { fDetSZ += dz; } - void scale(double factor) { - fSrcX *= factor; - fSrcY *= factor; - fSrcZ *= factor; - fDetSX *= factor; - fDetSY *= factor; - fDetSZ *= factor; - fDetUX *= factor; - fDetUY *= factor; - fDetUZ *= factor; - fDetVX *= factor; - fDetVY *= factor; - fDetVZ *= factor; + void scale(double fx, double fy, double fz) { + fSrcX *= fx; + fSrcY *= fy; + fSrcZ *= fz; + fDetSX *= fx; + fDetSY *= fy; + fDetSZ *= fz; + fDetUX *= fx; + fDetUY *= fy; + fDetUZ *= fz; + fDetVX *= fx; + fDetVY *= fy; + fDetVZ *= fz; } }; @@ -93,19 +93,19 @@ struct SPar3DProjection { fDetSY += dy; fDetSZ += dz; } - void scale(double factor) { - fRayX *= factor; - fRayY *= factor; - fRayZ *= factor; - fDetSX *= factor; - fDetSY *= factor; - fDetSZ *= factor; - fDetUX *= factor; - fDetUY *= factor; - fDetUZ *= factor; - fDetVX *= factor; - fDetVY *= factor; - fDetVZ *= factor; + void scale(double fx, double fy, double fz) { + fRayX *= fx; + fRayY *= fy; + fRayZ *= fz; + fDetSX *= fx; + fDetSY *= fy; + fDetSZ *= fz; + fDetUX *= fx; + fDetUY *= fy; + fDetUZ *= fz; + fDetVX *= fx; + fDetVY *= fy; + fDetVZ *= fz; } }; -- cgit v1.2.3