- * Scanner::Scanner Construct a user specified detector structure
- *
- * SYNOPSIS
- * Scanner (phm, nDet, nView, nSample)
- * Phantom& phm PHANTOM that we are making detector for
- * int geomety Geometry of detector
- * int nDet Number of detector along detector array
- * int nView Number of rotated views
- * int nSample Number of rays per detector
- */
+* Scanner::Scanner Construct a user specified detector structure
+*
+* SYNOPSIS
+* Scanner (phm, nDet, nView, nSample)
+* Phantom& phm PHANTOM that we are making detector for
+* int geomety Geometry of detector
+* int nDet Number of detector along detector array
+* int nView Number of rotated views
+* int nSample Number of rays per detector
+*/
Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet, int nView, int nSample, const double rot_anglen, const double dFocalLengthRatio, const double dFieldOfViewRatio)
{
m_phmLen = phm.maxAxisLength(); // maximal length along an axis
Scanner::Scanner (const Phantom& phm, const char* const geometryName, int nDet, int nView, int nSample, const double rot_anglen, const double dFocalLengthRatio, const double dFieldOfViewRatio)
{
m_phmLen = phm.maxAxisLength(); // maximal length along an axis
- * collectProjections Calculate projections for a Phantom
- *
- * SYNOPSIS
- * collectProjections (proj, phm, start_view, nView, bStoreViewPos, trace)
- * Projectrions& proj Projection storage
- * Phantom& phm Phantom for which we collect projections
- * bool bStoreViewPos TRUE then storage proj at normal view position
- * int trace Trace level
+* collectProjections Calculate projections for a Phantom
+*
+* SYNOPSIS
+* collectProjections (proj, phm, start_view, nView, bStoreViewPos, trace)
+* Projectrions& proj Projection storage
+* Phantom& phm Phantom for which we collect projections
+* bool bStoreViewPos TRUE then storage proj at normal view position
+* int trace Trace level
mult_mtx2 (rotmtx_initial, temp, rotmtx_initial);
xlat_mtx2 (temp, m_dXCenter, m_dYCenter);
mult_mtx2 (rotmtx_initial, temp, rotmtx_initial);
mult_mtx2 (rotmtx_initial, temp, rotmtx_initial);
xlat_mtx2 (temp, m_dXCenter, m_dYCenter);
mult_mtx2 (rotmtx_initial, temp, rotmtx_initial);
-
- m_pSGP->setWindow (m_dXMinWin, m_dYMinWin, m_dXMaxWin, m_dYMaxWin);
- m_pSGP->setRasterOp (RO_COPY);
- m_pSGP->setColor (C_RED);
- m_pSGP->moveAbs (0., 0.);
- m_pSGP->drawRect (m_dXCenter - dHalfPhmLen, m_dYCenter - dHalfPhmLen, m_dXCenter + dHalfPhmLen, m_dYCenter + dHalfPhmLen);
- m_pSGP->moveAbs (0., 0.);
- m_pSGP->drawCircle (m_dFocalLength);
- m_pSGP->setColor (C_BLUE);
- phm.draw (*m_pSGP);
- m_dTextHeight = m_pSGP->getCharHeight ();
-
- traceShowParam ("Phantom:", "%s", PROJECTION_TRACE_ROW_PHANT_ID, C_BLACK, phm.name().c_str());
- traceShowParam ("Geometry:", "%s", PROJECTION_TRACE_ROW_GEOMETRY, C_BLUE, convertGeometryIDToName(m_idGeometry));
- traceShowParam ("Focal Length Ratio:", "%.2f", PROJECTION_TRACE_ROW_FOCAL_LENGTH, C_BLUE, m_dFocalLengthRatio);
- traceShowParam ("Field Of View Ratio:", "%.2f", PROJECTION_TRACE_ROW_FIELD_OF_VIEW, C_BLUE, m_dFieldOfViewRatio);
- traceShowParam ("Num Detectors:", "%d", PROJECTION_TRACE_ROW_NDET, C_BLUE, proj.nDet());
- traceShowParam ("Num Views:", "%d", PROJECTION_TRACE_ROW_NVIEW, C_BLUE, proj.nView());
- traceShowParam ("Samples / Ray:", "%d", PROJECTION_TRACE_ROW_SAMPLES, C_BLUE, m_nSample);
-
- m_pSGP->setMarker (SGP::MARK_BDIAMOND, C_LTGREEN);
- }
+
+ m_pSGP->setWindow (m_dXMinWin, m_dYMinWin, m_dXMaxWin, m_dYMaxWin);
+ m_pSGP->setRasterOp (RO_COPY);
+ m_pSGP->setColor (C_RED);
+ m_pSGP->moveAbs (0., 0.);
+ m_pSGP->drawRect (m_dXCenter - dHalfPhmLen, m_dYCenter - dHalfPhmLen, m_dXCenter + dHalfPhmLen, m_dYCenter + dHalfPhmLen);
+ m_pSGP->moveAbs (0., 0.);
+ m_pSGP->drawCircle (m_dFocalLength);
+ m_pSGP->setColor (C_BLUE);
+ phm.draw (*m_pSGP);
+ m_dTextHeight = m_pSGP->getCharHeight ();
+
+ traceShowParam ("Phantom:", "%s", PROJECTION_TRACE_ROW_PHANT_ID, C_BLACK, phm.name().c_str());
+ traceShowParam ("Geometry:", "%s", PROJECTION_TRACE_ROW_GEOMETRY, C_BLUE, convertGeometryIDToName(m_idGeometry));
+ traceShowParam ("Focal Length Ratio:", "%.2f", PROJECTION_TRACE_ROW_FOCAL_LENGTH, C_BLUE, m_dFocalLengthRatio);
+ traceShowParam ("Field Of View Ratio:", "%.2f", PROJECTION_TRACE_ROW_FIELD_OF_VIEW, C_BLUE, m_dFieldOfViewRatio);
+ traceShowParam ("Num Detectors:", "%d", PROJECTION_TRACE_ROW_NDET, C_BLUE, proj.nDet());
+ traceShowParam ("Num Views:", "%d", PROJECTION_TRACE_ROW_NVIEW, C_BLUE, proj.nView());
+ traceShowParam ("Samples / Ray:", "%d", PROJECTION_TRACE_ROW_SAMPLES, C_BLUE, m_nSample);
+
+ m_pSGP->setMarker (SGP::MARK_BDIAMOND, C_LTGREEN);
+ }
- m_pSGP->moveAbs (xs1, ys1);
- m_pSGP->lineAbs (xs2, ys2);
- m_pSGP->moveAbs (xd1, yd1);
- m_pSGP->lineAbs (xd2, yd2);
+ m_pSGP->moveAbs (xs1, ys1);
+ m_pSGP->lineAbs (xs2, ys2);
+ m_pSGP->moveAbs (xd1, yd1);
+ m_pSGP->lineAbs (xd2, yd2);
- m_pSGP->setPenWidth (4);
- m_pSGP->moveAbs (xs1, ys1);
- m_pSGP->lineAbs (xs2, ys2);
- m_pSGP->setPenWidth (2);
- m_pSGP->moveAbs (xd1, yd1);
- m_pSGP->lineAbs (xd2, yd2);
+ m_pSGP->setPenWidth (4);
+ m_pSGP->moveAbs (xs1, ys1);
+ m_pSGP->lineAbs (xs2, ys2);
+ m_pSGP->setPenWidth (2);
+ m_pSGP->moveAbs (xd1, yd1);
+ m_pSGP->lineAbs (xd2, yd2);
- m_pSGP->setPenWidth (4);
- m_pSGP->moveAbs (xs1, ys1);
- m_pSGP->lineAbs (xs2, ys2);
- m_pSGP->setPenWidth (2);
- m_pSGP->moveAbs (0., 0.);
- m_pSGP->drawArc (m_dFocalLength, viewAngle + 3 * HALFPI - (m_dAngularDetLen/2), viewAngle + 3 * HALFPI + (m_dAngularDetLen/2));
+ m_pSGP->setPenWidth (4);
+ m_pSGP->moveAbs (xs1, ys1);
+ m_pSGP->lineAbs (xs2, ys2);
+ m_pSGP->setPenWidth (2);
+ m_pSGP->moveAbs (0., 0.);
+ m_pSGP->drawArc (m_dFocalLength, viewAngle + 3 * HALFPI - (m_dAngularDetLen/2), viewAngle + 3 * HALFPI + (m_dAngularDetLen/2));
projectSingleView (phm, detArray, xd1, yd1, xd2, yd2, xs1, ys1, xs2, ys2, viewAngle + 3 * HALFPI);
detArray.setViewAngle (viewAngle);
projectSingleView (phm, detArray, xd1, yd1, xd2, yd2, xs1, ys1, xs2, ys2, viewAngle + 3 * HALFPI);
detArray.setViewAngle (viewAngle);
- * rayview Calculate raysums for a view at any angle
- *
- * SYNOPSIS
- * rayview (phm, detArray, xd1, nSample, yd1, xd2, yd2, xs1, ys1, xs2, ys2)
- * Phantom& phm Phantom to scan
- * DETARRAY *detArray Storage of values for detector array
- * Scanner& det Scanner parameters
- * double xd1, yd1, xd2, yd2 Beginning & ending detector positions
- * double xs1, ys1, xs2, ys2 Beginning & ending source positions
- *
- * RAY POSITIONING
- * For each detector, have there are a variable number of rays traced.
- * The source of each ray is the center of the source x-ray cell. The
- * detector positions are equally spaced within the cell
- *
- * The increments between rays are calculated so that the cells start
- * at the beginning of a detector cell and they end on the endpoint
- * of the cell. Thus, the last cell starts at (xd2-ddx),(yd2-ddy).
- * The exception to this is if there is only one ray per detector.
- * In that case, the detector position is the center of the detector cell.
- */
+* rayview Calculate raysums for a view at any angle
+*
+* SYNOPSIS
+* rayview (phm, detArray, xd1, nSample, yd1, xd2, yd2, xs1, ys1, xs2, ys2)
+* Phantom& phm Phantom to scan
+* DETARRAY *detArray Storage of values for detector array
+* Scanner& det Scanner parameters
+* double xd1, yd1, xd2, yd2 Beginning & ending detector positions
+* double xs1, ys1, xs2, ys2 Beginning & ending source positions
+*
+* RAY POSITIONING
+* For each detector, have there are a variable number of rays traced.
+* The source of each ray is the center of the source x-ray cell. The
+* detector positions are equally spaced within the cell
+*
+* The increments between rays are calculated so that the cells start
+* at the beginning of a detector cell and they end on the endpoint
+* of the cell. Thus, the last cell starts at (xd2-ddx),(yd2-ddy).
+* The exception to this is if there is only one ray per detector.
+* In that case, the detector position is the center of the detector cell.
+*/
void
Scanner::projectSingleView (const Phantom& phm, DetectorArray& detArray, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2, const double dDetAngle)
{
void
Scanner::projectSingleView (const Phantom& phm, DetectorArray& detArray, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2, const double dDetAngle)
{
double ddx=0, ddy=0, ddx2=0, ddy2=0, ddx2_ofs=0, ddy2_ofs=0, xd_maj=0, yd_maj=0;
double dAngleInc=0, dAngleSampleInc=0, dAngleSampleOffset=0, dAngleMajor=0;
if (m_idGeometry == GEOMETRY_EQUIANGULAR) {
double ddx=0, ddy=0, ddx2=0, ddy2=0, ddx2_ofs=0, ddy2_ofs=0, xd_maj=0, yd_maj=0;
double dAngleInc=0, dAngleSampleInc=0, dAngleSampleOffset=0, dAngleMajor=0;
if (m_idGeometry == GEOMETRY_EQUIANGULAR) {
- ddx = (xd2 - xd1) / detArray.nDet(); // change in coords
- ddy = (yd2 - yd1) / detArray.nDet(); // between detectors
- ddx2 = ddx / m_nSample; // Incr. between rays with detector cell
- ddy2 = ddy / m_nSample; // Doesn't include detector endpoints
- ddx2_ofs = ddx2 / 2; // offset of 1st ray from start of detector cell
- ddy2_ofs = ddy2 / 2;
-
- xd_maj = xd1 + ddx2_ofs; // Incr. between detector cells
- yd_maj = yd1 + ddy2_ofs;
+ ddx = (xd2 - xd1) / detArray.nDet(); // change in coords
+ ddy = (yd2 - yd1) / detArray.nDet(); // between detectors
+ ddx2 = ddx / m_nSample; // Incr. between rays with detector cell
+ ddy2 = ddy / m_nSample; // Doesn't include detector endpoints
+ ddx2_ofs = ddx2 / 2; // offset of 1st ray from start of detector cell
+ ddy2_ofs = ddy2 / 2;
+
+ xd_maj = xd1 + ddx2_ofs; // Incr. between detector cells
+ yd_maj = yd1 + ddy2_ofs;
- if (m_pSGP && m_trace >= Trace::TRACE_PROJECTIONS) {
- m_pSGP->setColor (C_YELLOW);
- m_pSGP->setRasterOp (RO_AND);
- m_pSGP->moveAbs (xs, ys);
- m_pSGP->lineAbs (xd, yd);
- }
+ if (m_pSGP && m_trace >= Trace::TRACE_PROJECTIONS) {
+ m_pSGP->setColor (C_YELLOW);
+ m_pSGP->setRasterOp (RO_AND);
+ m_pSGP->moveAbs (xs, ys);
+ m_pSGP->lineAbs (xd, yd);
+ }
- // if (m_trace >= Trace::TRACE_CLIPPING) {
- // traceShowParam ("Attenuation:", "%s", PROJECTION_TRACE_ROW_ATTEN, C_LTMAGENTA, " ");
- // traceShowParam ("Attenuation:", "%.3f", PROJECTION_TRACE_ROW_ATTEN, C_LTMAGENTA, sum);
- // }
+ // if (m_trace >= Trace::TRACE_CLIPPING) {
+ // traceShowParam ("Attenuation:", "%s", PROJECTION_TRACE_ROW_ATTEN, C_LTMAGENTA, " ");
+ // traceShowParam ("Attenuation:", "%.3f", PROJECTION_TRACE_ROW_ATTEN, C_LTMAGENTA, sum);
+ // }
- * projectSingleLine INTERNAL: Calculates raysum along a line for a Phantom
- *
- * SYNOPSIS
- * rsum = phm_ray_attenuation (phm, x1, y1, x2, y2)
- * double rsum Ray sum of Phantom along given line
- * Phantom& phm; Phantom from which to calculate raysum
- * double *x1, *y1, *x2, y2 Endpoints of ray path (in Phantom coords)
- */
+* projectSingleLine INTERNAL: Calculates raysum along a line for a Phantom
+*
+* SYNOPSIS
+* rsum = phm_ray_attenuation (phm, x1, y1, x2, y2)
+* double rsum Ray sum of Phantom along given line
+* Phantom& phm; Phantom from which to calculate raysum
+* double *x1, *y1, *x2, y2 Endpoints of ray path (in Phantom coords)
+*/
- * pelem_ray_attenuation Calculate raysum of an pelem along one line
- *
- * SYNOPSIS
- * rsum = pelem_ray_attenuation (pelem, x1, y1, x2, y2)
- * double rsum Computed raysum
- * PhantomElement& pelem Pelem to scan
- * double x1, y1, x2, y2 Endpoints of raysum line
- */
+* pelem_ray_attenuation Calculate raysum of an pelem along one line
+*
+* SYNOPSIS
+* rsum = pelem_ray_attenuation (pelem, x1, y1, x2, y2)
+* double rsum Computed raysum
+* PhantomElement& pelem Pelem to scan
+* double x1, y1, x2, y2 Endpoints of raysum line
+*/