Have OpenMP and non-OpenMP use same source/detector point rotation algorithm
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 21 Mar 2018 18:21:08 +0000 (12:21 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 21 Mar 2018 18:21:08 +0000 (12:21 -0600)
libctsim/scanner.cpp

index 1567bd8b0f2b32d20577c0b270b78961111ab1e3..850b99eef9f8a4c9da0185ce89bd507cbc622913 100644 (file)
@@ -309,30 +309,13 @@ Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iS
   m_trace = trace;
   double start_angle = (iStartView + iOffsetView) * proj.rotInc();
 
-#ifndef HAVE_OPENMP
-  // Without OpenMP, precalculate source and detector at view 0, then rotate incrementally each time
-  GRFMTX_2D rotmtx_initial;
-  mtx2_offset_rot (rotmtx_initial, start_angle, m_dXCenter, m_dYCenter);
-  double xd1=0, yd1=0, xd2=0, yd2=0;
-  if (m_idGeometry != GEOMETRY_EQUIANGULAR) {
-    xd1 = m_initPos.xd1; yd1 = m_initPos.yd1;
-    xd2 = m_initPos.xd2; yd2 = m_initPos.yd2;
-    xform_mtx2 (rotmtx_initial, xd1, yd1);      // rotate detector endpoints
-    xform_mtx2 (rotmtx_initial, xd2, yd2);      // to initial view_angle
-  }
-
-  double xs1 = m_initPos.xs1, ys1 = m_initPos.ys1;
-  double xs2 = m_initPos.xs2, ys2 = m_initPos.ys2;
-  xform_mtx2 (rotmtx_initial, xs1, ys1);      // rotate source endpoints to
-  xform_mtx2 (rotmtx_initial, xs2, ys2);      // initial view angle
-#else
+#ifdef HAVE_OPENMP
   #pragma omp parallel for
 #endif
   
   for (int iView = 0;  iView < iNumViews; iView++) {
     double viewAngle = start_angle + (iView * proj.rotInc());
     
-#ifdef HAVE_OPENMP
     // With OpenMP, need to calculate source and detector positions at each view
     GRFMTX_2D rotmtx;
     mtx2_offset_rot (rotmtx, viewAngle, m_dXCenter, m_dYCenter);
@@ -348,7 +331,6 @@ Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iS
     double xs2 = m_initPos.xs2, ys2 = m_initPos.ys2;
     xform_mtx2 (rotmtx, xs1, ys1);      // rotate source endpoints to
     xform_mtx2 (rotmtx, xs2, ys2);      // initial view angle
-#endif
     
     int iStoragePosition = iView + iStorageOffset;
     DetectorArray& detArray = proj.getDetectorArray( iStoragePosition );
@@ -429,15 +411,6 @@ Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iS
     }
 #endif
 
-#ifndef HAVE_OPENMP
-    // Without OpenMP, incrementally rotate source and detectors 
-    xform_mtx2 (m_rotmtxIncrement, xs1, ys1);
-    xform_mtx2 (m_rotmtxIncrement, xs2, ys2);
-    if (m_idGeometry != GEOMETRY_EQUIANGULAR) {
-      xform_mtx2 (m_rotmtxIncrement, xd1, yd1);  // rotate detector endpoints
-      xform_mtx2 (m_rotmtxIncrement, xd2, yd2);
-    }
-#endif    
   } /* for each iView */
 }