diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2021-12-01 14:43:03 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2021-12-06 11:01:36 +0100 |
commit | 86615d4161b050fbf3335e30ae85801aa1cefe92 (patch) | |
tree | 281a13131e0912e2a76754461e91b98767cd5be1 /src/CompositeGeometryManager.cpp | |
parent | 0070b8bafe1365b97ed922bd0ede84de7edd7dc7 (diff) | |
download | astra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.gz astra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.bz2 astra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.xz astra-86615d4161b050fbf3335e30ae85801aa1cefe92.zip |
Move bounding box projection to ProjectionGeometry3D
Diffstat (limited to 'src/CompositeGeometryManager.cpp')
-rw-r--r-- | src/CompositeGeometryManager.cpp | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp index bbca805..c71e08b 100644 --- a/src/CompositeGeometryManager.cpp +++ b/src/CompositeGeometryManager.cpp @@ -324,53 +324,21 @@ bool CCompositeGeometryManager::splitJobs(TJobSet &jobs, size_t maxSize, int div static std::pair<double, double> reduceProjectionVertical(const CVolumeGeometry3D* pVolGeom, const CProjectionGeometry3D* pProjGeom) { + double umin_g, umax_g; double vmin_g, vmax_g; - // reduce self to only cover intersection with projection of VolumePart - // (Project corners of volume, take bounding box) - - assert(pProjGeom->getProjectionCount() > 0); - for (int i = 0; i < pProjGeom->getProjectionCount(); ++i) { - - double vol_u[8]; - double vol_v[8]; - - double pixx = pVolGeom->getPixelLengthX(); - double pixy = pVolGeom->getPixelLengthY(); - double pixz = pVolGeom->getPixelLengthZ(); - - // TODO: Is 0.5 sufficient? - double xmin = pVolGeom->getWindowMinX() - 0.5 * pixx; - double xmax = pVolGeom->getWindowMaxX() + 0.5 * pixx; - double ymin = pVolGeom->getWindowMinY() - 0.5 * pixy; - double ymax = pVolGeom->getWindowMaxY() + 0.5 * pixy; - double zmin = pVolGeom->getWindowMinZ() - 0.5 * pixz; - double zmax = pVolGeom->getWindowMaxZ() + 0.5 * pixz; - - pProjGeom->projectPoint(xmin, ymin, zmin, i, vol_u[0], vol_v[0]); - pProjGeom->projectPoint(xmin, ymin, zmax, i, vol_u[1], vol_v[1]); - pProjGeom->projectPoint(xmin, ymax, zmin, i, vol_u[2], vol_v[2]); - pProjGeom->projectPoint(xmin, ymax, zmax, i, vol_u[3], vol_v[3]); - pProjGeom->projectPoint(xmax, ymin, zmin, i, vol_u[4], vol_v[4]); - pProjGeom->projectPoint(xmax, ymin, zmax, i, vol_u[5], vol_v[5]); - pProjGeom->projectPoint(xmax, ymax, zmin, i, vol_u[6], vol_v[6]); - pProjGeom->projectPoint(xmax, ymax, zmax, i, vol_u[7], vol_v[7]); - - double vmin = vol_v[0]; - double vmax = vol_v[0]; - - for (int j = 1; j < 8; ++j) { - if (vol_v[j] < vmin) - vmin = vol_v[j]; - if (vol_v[j] > vmax) - vmax = vol_v[j]; - } + double pixx = pVolGeom->getPixelLengthX(); + double pixy = pVolGeom->getPixelLengthY(); + double pixz = pVolGeom->getPixelLengthZ(); - if (i == 0 || vmin < vmin_g) - vmin_g = vmin; - if (i == 0 || vmax > vmax_g) - vmax_g = vmax; - } + pProjGeom->getProjectedBBox(pVolGeom->getWindowMinX() - 0.5 * pixx, + pVolGeom->getWindowMaxX() + 0.5 * pixx, + pVolGeom->getWindowMinY() - 0.5 * pixy, + pVolGeom->getWindowMaxY() + 0.5 * pixy, + pVolGeom->getWindowMinZ() - 0.5 * pixz, + pVolGeom->getWindowMaxZ() + 0.5 * pixz, + umin_g, umax_g, + vmin_g, vmax_g); if (vmin_g < -1.0) vmin_g = -1.0; |