summaryrefslogtreecommitdiffstats
path: root/src/ProjectionGeometry3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2021-12-01 14:43:03 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2021-12-06 11:01:36 +0100
commit86615d4161b050fbf3335e30ae85801aa1cefe92 (patch)
tree281a13131e0912e2a76754461e91b98767cd5be1 /src/ProjectionGeometry3D.cpp
parent0070b8bafe1365b97ed922bd0ede84de7edd7dc7 (diff)
downloadastra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.gz
astra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.bz2
astra-86615d4161b050fbf3335e30ae85801aa1cefe92.tar.xz
astra-86615d4161b050fbf3335e30ae85801aa1cefe92.zip
Move bounding box projection to ProjectionGeometry3D
Diffstat (limited to 'src/ProjectionGeometry3D.cpp')
-rw-r--r--src/ProjectionGeometry3D.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/ProjectionGeometry3D.cpp b/src/ProjectionGeometry3D.cpp
index 71c8df5..39c9af5 100644
--- a/src/ProjectionGeometry3D.cpp
+++ b/src/ProjectionGeometry3D.cpp
@@ -249,4 +249,64 @@ bool CProjectionGeometry3D::_initialize(int _iProjectionAngleCount,
return true;
}
+void CProjectionGeometry3D::getProjectedBBox(double fXMin, double fXMax,
+ double fYMin, double fYMax,
+ double fZMin, double fZMax,
+ double &fUMin, double &fUMax,
+ double &fVMin, double &fVMax) const
+{
+ double vmin_g, vmax_g;
+ double umin_g, umax_g;
+
+ // Default implementation, correct for flat panel detectors:
+ // Project corners of volume, take bounding box
+
+ assert(getProjectionCount() > 0);
+ for (int i = 0; i < getProjectionCount(); ++i) {
+
+ double vol_u[8];
+ double vol_v[8];
+
+ projectPoint(fXMin, fYMin, fZMin, i, vol_u[0], vol_v[0]);
+ projectPoint(fXMin, fYMin, fZMax, i, vol_u[1], vol_v[1]);
+ projectPoint(fXMin, fYMax, fZMin, i, vol_u[2], vol_v[2]);
+ projectPoint(fXMin, fYMax, fZMax, i, vol_u[3], vol_v[3]);
+ projectPoint(fXMax, fYMin, fZMin, i, vol_u[4], vol_v[4]);
+ projectPoint(fXMax, fYMin, fZMax, i, vol_u[5], vol_v[5]);
+ projectPoint(fXMax, fYMax, fZMin, i, vol_u[6], vol_v[6]);
+ projectPoint(fXMax, fYMax, fZMax, i, vol_u[7], vol_v[7]);
+
+ double umin = vol_u[0];
+ double umax = vol_u[0];
+ double vmin = vol_v[0];
+ double vmax = vol_v[0];
+
+ for (int j = 1; j < 8; ++j) {
+ if (vol_u[j] < umin)
+ umin = vol_u[j];
+ if (vol_u[j] > umax)
+ umax = vol_u[j];
+ if (vol_v[j] < vmin)
+ vmin = vol_v[j];
+ if (vol_v[j] > vmax)
+ vmax = vol_v[j];
+ }
+
+ if (i == 0 || umin < umin_g)
+ umin_g = umin;
+ if (i == 0 || umax > umax_g)
+ umax_g = umax;
+ if (i == 0 || vmin < vmin_g)
+ vmin_g = vmin;
+ if (i == 0 || vmax > vmax_g)
+ vmax_g = vmax;
+ }
+
+ fUMin = umin_g;
+ fUMax = umax_g;
+ fVMin = vmin_g;
+ fVMax = vmax_g;
+}
+
+
} // namespace astra