r628: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 06:34:37 +0000 (06:34 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 06:34:37 +0000 (06:34 +0000)
include/projections.h
include/scanner.h
libctsim/projections.cpp
libctsim/scanner.cpp
msvc/ctsim/ctsim.plg
src/backgroundmgr.cpp
src/backgroundsupr.cpp
src/ctsim.h
src/views.cpp
src/views.h

index 9e64f260d49fd9da53e39468223900565053e625..67cae86462ad282856fdf99733c1756f5425481f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.h,v 1.29 2001/03/10 23:56:58 kevin Exp $
+**  $Id: projections.h,v 1.30 2001/03/11 06:34:37 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -45,19 +45,19 @@ class ParallelRaysumCoordinate {
 public:
   double m_dT;      // Distance from center of origin
   double m_dTheta;  // perpendicular angle to origin
-  int m_iViewNum;   // View number for this raysum
-  int m_iDetNum;    // Detector number for this raysum
+  double m_dRaysum;
 
   bool lessThanT (ParallelRaysumCoordinate& rCompare)
   {return m_dT < rCompare.m_dT; }
   bool lessThanTheta (ParallelRaysumCoordinate& rCompare)
   {return m_dTheta < rCompare.m_dTheta; }
 
-  static compareByTheta(ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b)
-  { return a->m_dTheta > b->m_dTheta; }
+  static bool compareByTheta (ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b)
+  { return a->m_dTheta == b->m_dTheta ? b->m_dT > a->m_dT : b->m_dTheta > a->m_dTheta; }
 
-  static compareByT(ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b)
-  { return a->m_dT > b->m_dT; }
+  // sort first by T, then Theta
+  static bool compareByT (ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b)
+  { return a->m_dT == b->m_dT ? b->m_dTheta > a->m_dTheta : b->m_dT > a->m_dT; }
 
 };
 
@@ -74,12 +74,17 @@ public:
   void getLimits (double* dMinT, double* dMaxT, double* dMinTheta, double* dMaxTheta) const;
   CoordinateContainer& getSortedByT();
   CoordinateContainer& getSortedByTheta();
+  double interpolate (double* pdX, double* pdY, int n, double dXValue);
+  void getThetaAndRaysumsForT (int iT, double* pdTheta, double* pdRaysum);
+  void getDetPositions (double* pdDetPos);
 
 private:
   CoordinateContainer m_vecpCoordinates;
   CoordinateContainer m_vecpSortedByT;
   CoordinateContainer m_vecpSortedByTheta;
   int m_iNumCoordinates;
+  int m_iNumView;
+  int m_iNumDet;
 };
 
 
@@ -120,7 +125,7 @@ class Projections
   bool detarrayRead (fnetorderstream& fs, DetectorArray& darray, const int view_num);
   bool detarrayWrite (fnetorderstream& fs, const DetectorArray& darray, const int view_num);
 
-  bool interpolateToParallel();
+  Projections* interpolateToParallel();
 
   bool convertPolar (ImageFile& rIF, int iInterpolation);
   bool convertFFTPolar (ImageFile& rIF, int iInterpolation, int iZeropad);
index 7f8780a66316b130ece9560be6423c7d1e6bfb5c..663ebd7f72d1d45d8c4cdfa364362c95bde22c44 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: scanner.h,v 1.20 2001/03/01 07:30:49 kevin Exp $
+**  $Id: scanner.h,v 1.21 2001/03/11 06:34:37 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -98,6 +98,7 @@ class Scanner
   double rotInc() const {return m_rotInc;}
   double detInc() const {return m_detInc;}
   double detLen() const {return m_detLen;}
+  double detStart() const {return m_detStart;}
   double focalLength() const {return m_dFocalLength;}
   double sourceDetectorLength() const {return m_dSourceDetectorLength;}
   double centerDetectorLength() const {return m_dCenterDetectorLength;}
@@ -136,6 +137,7 @@ class Scanner
   double m_rotLen;             // Rotation angle length in radians (norm 2PI)
   double m_detInc;             // Increment between centers of detectors 
   double m_rotInc;             // Increment in rotation angle between views 
+  double m_detStart;
   double m_dXCenter;            // Center of Phantom
   double m_dYCenter;            
   double m_dAngularDetIncrement;
index d6a484335943945d8f4ffa02a6bb77e495412fb7..c55aa37a5fcc94b6292ac9b912f93e858bbb5b7f 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.56 2001/03/10 23:56:58 kevin Exp $
+**  $Id: projections.cpp,v 1.57 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -150,12 +150,12 @@ Projections::initFromScanner (const Scanner& scanner)
   
   m_rotInc = scanner.rotInc();
   m_detInc = scanner.detInc();
+  m_detStart =  scanner.detStart();
   m_geometry = scanner.geometry();
   m_dFocalLength = scanner.focalLength();
   m_dSourceDetectorLength = scanner.sourceDetectorLength();
   m_dViewDiameter = scanner.viewDiameter();
   m_rotStart = 0;
-  m_detStart =  -(scanner.detLen() / 2);
   m_dFanBeamAngle = scanner.fanBeamAngle();
 }
 
@@ -968,34 +968,114 @@ Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pDa
   return true;
 }
 
+Projections*
+Projections::interpolateToParallel ()
+{
+  if (m_geometry == Scanner::GEOMETRY_PARALLEL)
+    return this;
+
+  int nDet = m_nDet;
+  int nView = m_nView;
+  Projections* pProjNew = new Projections (nView, nDet);
+  pProjNew->m_geometry = Scanner::GEOMETRY_PARALLEL;
+  pProjNew->m_dFocalLength = m_dFocalLength;
+  pProjNew->m_dSourceDetectorLength = m_dSourceDetectorLength;
+  pProjNew->m_dViewDiameter = m_dViewDiameter;
+  pProjNew->m_dFanBeamAngle = m_dFanBeamAngle;
+  pProjNew->m_calcTime  = 0;
+  pProjNew->m_remark = m_remark;
+  pProjNew->m_remark += "; Interpolate to Parallel";
+  pProjNew->m_label.setLabelType (Array2dFileLabel::L_HISTORY);
+  pProjNew->m_label.setLabelString (pProjNew->m_remark);
+  pProjNew->m_label.setCalcTime (pProjNew->m_calcTime);
+  pProjNew->m_label.setDateTime (pProjNew->m_year, pProjNew->m_month, pProjNew->m_day, pProjNew->m_hour, pProjNew->m_minute, pProjNew->m_second);
+
+  pProjNew->m_rotStart = 0;
+  pProjNew->m_rotInc = PI / nView;;
+  pProjNew->m_detStart = -m_dViewDiameter / 2;
+  pProjNew->m_detInc = m_dViewDiameter / nDet;
+  if (nDet % 2 == 0) // even
+    pProjNew->m_detInc = m_dViewDiameter / (nDet - 1);
+
+  ParallelRaysums parallel (this);
+
+  double* pdThetaValuesForT = new double [pProjNew->nView()];
+  double* pdRaysumsForT = new double [pProjNew->nView()];
+
+  // interpolate to evenly spaced theta (views)
+  double dDetPos = pProjNew->m_detStart;
+  for (int iD = 0; iD < pProjNew->nDet(); iD++, dDetPos += pProjNew->m_detInc) {
+    parallel.getThetaAndRaysumsForT (iD, pdThetaValuesForT, pdRaysumsForT);
+
+    double dViewAngle = m_rotStart;
+    for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) {
+      DetectorValue* detValues = pProjNew->getDetectorArray (iV).detValues();
+
+      detValues[iD] = parallel.interpolate (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView(), dViewAngle);
+    }
+  }
+  delete pdThetaValuesForT;
+  delete pdRaysumsForT;
+
+  // interpolate to evenly space t (detectors)
+  double* pdOriginalDetPositions = new double [pProjNew->nDet()];
+  parallel.getDetPositions (pdOriginalDetPositions);
+
+  double* pdDetValueCopy = new double [pProjNew->nDet()];
+  double dViewAngle = m_rotStart;
+  for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) {
+    DetectorArray& detArray = pProjNew->getDetectorArray (iV);
+    DetectorValue* detValues = detArray.detValues();
+    detArray.setViewAngle (dViewAngle);
+
+    for (int i = 0; i < pProjNew->nDet(); i++)
+      pdDetValueCopy[i] = detValues[i];
+
+    double dDetPos = pProjNew->m_detStart;
+    for (int iD = 0; iD < pProjNew->nDet(); iD++, dDetPos += pProjNew->m_detInc) {
+      detValues[iD] = parallel.interpolate (pdOriginalDetPositions, pdDetValueCopy, pProjNew->nDet(), dDetPos);
+    }
+  }
+  delete pdDetValueCopy;
+  delete pdOriginalDetPositions;
+
+  return pProjNew;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Class ParallelRaysums
+//
+// Used for converting divergent beam raysums into Parallel raysums
+//
+///////////////////////////////////////////////////////////////////////////////
 
 ParallelRaysums::ParallelRaysums (Projections* pProjections)
-: m_iNumCoordinates(0)
+: m_iNumCoordinates(0), m_iNumView(pProjections->nView()), m_iNumDet(pProjections->nDet())
 {
-  int nDet = pProjections->nDet();
-  int nView = pProjections->nView();
   int iGeometry = pProjections->geometry();
   double dDetInc = pProjections->detInc();
   double dDetStart = pProjections->detStart();
   double dFocalLength = pProjections->focalLength();
 
-  m_iNumCoordinates =  nDet * nView;
+  m_iNumCoordinates =  m_iNumView * m_iNumDet;
   m_vecpCoordinates.reserve (m_iNumCoordinates);
   for (int i = 0; i < m_iNumCoordinates; i++)
     m_vecpCoordinates[i] = new ParallelRaysumCoordinate;
 
   int iCoordinate = 0;
-  for (int iV = 0; iV < nView; iV++) {
+  for (int iV = 0; iV < m_iNumView; iV++) {
     double dViewAngle = pProjections->getDetectorArray(iV).viewAngle();
+    const DetectorValue* detValues = pProjections->getDetectorArray(iV).detValues();
 
     double dDetPos = dDetStart;
-    for (int iD = 0; iD < nDet; iD++) {
+    for (int iD = 0; iD < m_iNumDet; iD++) {
       ParallelRaysumCoordinate* pC = m_vecpCoordinates[iCoordinate++];
 
       if (iGeometry == Scanner::GEOMETRY_PARALLEL) {
         pC->m_dTheta = normalizeAngle (dViewAngle);
         pC->m_dT = dDetPos;
-
       } else if (iGeometry == Scanner::GEOMETRY_EQUILINEAR) {
         double dFanAngle = atan (dDetPos / pProjections->sourceDetectorLength());
         pC->m_dTheta = normalizeAngle (dViewAngle + dFanAngle);
@@ -1006,6 +1086,11 @@ ParallelRaysums::ParallelRaysums (Projections* pProjections)
         pC->m_dTheta = normalizeAngle (dViewAngle + dDetPos);
         pC->m_dT = dFocalLength * sin (dDetPos);        
       }
+      if (pC->m_dTheta >= PI) {  // convert T/Theta to 0-PI interval
+        pC->m_dTheta -= PI;
+        pC->m_dT = -pC->m_dT - pProjections->detInc();
+      }
+      pC->m_dRaysum = detValues[iD];
       dDetPos += dDetInc;
     }
   }
@@ -1021,7 +1106,7 @@ ParallelRaysums::CoordinateContainer&
 ParallelRaysums::getSortedByTheta()
 {
   if (m_vecpSortedByTheta.size() == 0) {
-    m_vecpSortedByTheta.reserve (m_iNumCoordinates);
+    m_vecpSortedByTheta.resize (m_iNumCoordinates);
     for (int i = 0; i < m_iNumCoordinates; i++)
       m_vecpSortedByTheta[i] = m_vecpCoordinates[i];
     std::sort (m_vecpSortedByTheta.begin(), m_vecpSortedByTheta.end(), ParallelRaysumCoordinate::compareByTheta);
@@ -1034,7 +1119,7 @@ ParallelRaysums::CoordinateContainer&
 ParallelRaysums::getSortedByT()
 {
   if (m_vecpSortedByT.size() == 0) {
-    m_vecpSortedByT.reserve (m_iNumCoordinates);
+    m_vecpSortedByT.resize (m_iNumCoordinates);
     for (int i = 0; i < m_iNumCoordinates; i++)
       m_vecpSortedByT[i] = m_vecpCoordinates[i];
     std::sort (m_vecpSortedByT.begin(), m_vecpSortedByT.end(), ParallelRaysumCoordinate::compareByT);
@@ -1068,3 +1153,56 @@ ParallelRaysums::getLimits (double* dMinT, double* dMaxT, double* dMinTheta, dou
       *dMaxTheta = dTheta;
   }
 }
+
+void
+ParallelRaysums::getThetaAndRaysumsForT (int iTheta, double* pTheta, double* pRaysum)
+{
+  const CoordinateContainer& coordsT = getSortedByT();
+
+  int iBase = iTheta * m_iNumView;
+  for (int i = 0; i < m_iNumView; i++) {
+    int iPos = iBase + i;
+    pTheta[i] = coordsT[iPos]->m_dTheta;
+    pRaysum[i] = coordsT[iPos]->m_dRaysum;
+  }
+}
+
+void
+ParallelRaysums::getDetPositions (double* pdDetPos)
+{
+  const CoordinateContainer& coordsT = getSortedByT();
+
+  int iPos = 0;
+  for (int i = 0; i < m_iNumDet; i++) {
+    pdDetPos[i] = coordsT[iPos]->m_dT;
+    iPos += m_iNumView;
+  }
+}
+
+// locate by bisection, O(log2(n))
+double
+ParallelRaysums::interpolate (double* pdX, double* pdY, int n, double dX)
+{
+  int iLower = -1;
+  int iUpper = n;
+
+  while (iUpper - iLower > 1) {
+    int iMiddle = (iUpper + iLower) >> 1;
+    if (dX >= pdX[iMiddle])
+      iLower = iMiddle;
+    else
+      iUpper = iMiddle;
+  }
+  if (dX <= pdX[0])
+    return pdY[0];
+  else if (dX >= pdX[n-1])
+    return pdY[1];
+
+  if (iLower < 0 || iLower >= n) {
+    sys_error (ERR_SEVERE, "Coordinate out of range [locateThetaBase]");
+    return 0;
+  }
+
+  return pdY[iLower] + (pdY[iUpper] - pdY[iLower]) * ((dX - pdX[iLower]) / (pdX[iUpper] - pdX[iLower]));
+}
+
index ff3cd9af366833c74a3e7e3e52641aeeaaa43a2b..f28d9fa56030032499095b13596f433a466510f5 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: scanner.cpp,v 1.34 2001/03/10 23:14:16 kevin Exp $
+**  $Id: scanner.cpp,v 1.35 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -125,6 +125,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName,
   if (m_idGeometry == GEOMETRY_PARALLEL) {
     m_dFanBeamAngle = 0;
     m_detLen   = m_dScanDiameter;
+    m_detStart = -m_detLen / 2;
     m_detInc  = m_detLen / m_nDet;
     double dDetectorArrayEndOffset = 0;
     // For even number of detectors, make detInc slightly larger so that center lies
@@ -144,6 +145,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName,
     m_initPos.xd2 = m_dXCenter + dHalfDetLen + dDetectorArrayEndOffset;
     m_initPos.yd2 = m_dYCenter - m_dCenterDetectorLength;
     m_initPos.angle = 0.0;
+    m_detLen += dDetectorArrayEndOffset;
   } else if (m_idGeometry == GEOMETRY_EQUILINEAR) {
   if (m_dScanDiameter / 2 >= m_dFocalLength) {
       m_fail = true;
@@ -155,11 +157,13 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName,
     const double dHalfDetLen = m_dSourceDetectorLength * tan (dAngle);
     
     m_detLen = dHalfDetLen * 2;
+    m_detStart = -dHalfDetLen;
     m_detInc  = m_detLen / m_nDet;
     double dDetectorArrayEndOffset = 0;
     if (m_nDet % 2 == 0) { // Adjust for Even number of detectors
       m_detInc = m_detLen / (m_nDet - 1); // center detector = (nDet/2)
       dDetectorArrayEndOffset = m_detInc;
+      m_detLen += dDetectorArrayEndOffset;
     }
   
     m_dFanBeamAngle = dAngle * 2;
@@ -182,6 +186,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName,
     const double dAngle = asin ((m_dScanDiameter / 2) / m_dFocalLength);
 
     m_detLen = 2 * dAngle;
+    m_detStart = -dAngle;
     m_detInc = m_detLen / m_nDet;
     double dDetectorArrayEndOffset = 0;
     if (m_nDet % 2 == 0) { // Adjust for Even number of detectors
@@ -202,6 +207,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName,
     m_initPos.ys1 = m_dYCenter + m_dFocalLength;;
     m_initPos.xs2 = m_dXCenter;
     m_initPos.ys2 = m_dYCenter + m_dFocalLength;
+    m_detLen += dDetectorArrayEndOffset;
   }
   
   // Calculate incrementatal rotation matrix 
index 2a1a9212ac6e0c438f173e9c31b1c71e324965b0..d0e65d49e5914d472b7697cc86fe9d20aba6f7c4 100644 (file)
@@ -6,13 +6,13 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EE.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP377.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /D VERSION=\"3.1.0\" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
 "C:\ctsim\libctsim\projections.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EE.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP377.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP378.tmp" with contents
 [
 /nologo /out:"Debug\libctsim.lib" 
 .\Debug\array2dfile.obj
@@ -48,7 +48,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" with conten
 .\Debug\transformmatrix.obj
 .\Debug\xform.obj
 ]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp"
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP378.tmp"
 <h3>Output Window</h3>
 Compiling...
 projections.cpp
@@ -57,7 +57,7 @@ Creating library...
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP379.tmp" with contents
 [
 winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug" 
 .\Debug\backgroundmgr.obj
@@ -84,7 +84,7 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..
 \wx2.2.5\lib\zlibd.lib
 \wx2.2.5\lib\tiffd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP379.tmp"
 <h3>Output Window</h3>
 Linking...
 
index 6d4a50cafd2ff13479b45be2c7432ee1bab600a9..52ee7965cf1fc8f8af3fd3e6f501930f7f94446c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.15 2001/03/09 21:31:51 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.16 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -67,6 +67,7 @@ BackgroundManager::BackgroundManager ()
 
   m_sizeCell.Set (m_sizeGauge.x + m_sizeLabel.x + m_sizeCellSpacing.x + m_sizeButton.x, 25);
 
+  theApp->getMainFrame()->SetFocus();
   Show(false);
 }
 
@@ -150,9 +151,9 @@ BackgroundManager::OnAddTask (wxCommandEvent& event)
 
   resizeWindow();
   if (m_iNumTasks == 1) {
-       SetFocus();
+       theApp->getMainFrame()->SetFocus();
     Show(true);  
-    theApp->getMainFrame()->SetFocus();  // necessary to keep wxWindows from crashing
+       theApp->getMainFrame()->SetFocus();
   }
 }
 
@@ -186,8 +187,11 @@ BackgroundManager::OnRemoveTask (wxCommandEvent& event)
   }
   pSupervisor->ackRemoveBackgroundManager();
   resizeWindow();
-  if (m_iNumTasks <= 0)
+  if (m_iNumTasks <= 0) {
+    theApp->getMainFrame()->SetFocus();
     Show(false);
+    theApp->getMainFrame()->SetFocus();
+  }
 }
 
 void
index 13c1e32de81cf5f013e1aa6169903cd3f785e29b..8107a9e0b1b280d67091c2eb391f5be2c690eb74 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundsupr.cpp,v 1.18 2001/03/09 21:31:51 kevin Exp $
+**  $Id: backgroundsupr.cpp,v 1.19 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -62,7 +62,7 @@ BackgroundSupervisor::BackgroundSupervisor (SupervisorThread* pMyThread, wxFrame
   m_iNumThreads = theApp->getNumberCPU();
   //   ++m_iNumThreads;
 
-  m_vecpThreads.reserve (m_iNumThreads);
+  m_vecpThreads.resize (m_iNumThreads);
   for (int iThread = 0; iThread < m_iNumThreads; iThread++)
     m_vecpThreads[iThread] = NULL;
 
index 7ced875d3c5ab3ab044b2d6d8633c5f90c7aafee..9ca514c855a298103492e261e826429bcc0a498d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.56 2001/03/10 23:14:16 kevin Exp $
+**  $Id: ctsim.h,v 1.57 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -309,7 +309,9 @@ enum {
     PJMENU_RECONSTRUCT_FOURIER,
     PJMENU_CONVERT_POLAR,
     PJMENU_CONVERT_FFT_POLAR,
+    PJMENU_CONVERT_PARALLEL,
     PJMENU_PLOT_TTHETA_SAMPLING,
+    PJMENU_ARTIFACT_REDUCTION,
     
     IFMENU_FILE_EXPORT,
     IFMENU_FILE_PROPERTIES,
index 19d564ef84ecbd11f9d913623b2e4284cd1ada81..9a2eb3113b23ed9f9f3f6796c9e974a570a7e30c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.131 2001/03/10 23:56:58 kevin Exp $
+**  $Id: views.cpp,v 1.132 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -2277,9 +2277,12 @@ EVT_MENU(PJMENU_RECONSTRUCT_FBP, ProjectionFileView::OnReconstructFBP)
 EVT_MENU(PJMENU_RECONSTRUCT_FOURIER, ProjectionFileView::OnReconstructFourier)
 EVT_MENU(PJMENU_CONVERT_POLAR, ProjectionFileView::OnConvertPolar)
 EVT_MENU(PJMENU_CONVERT_FFT_POLAR, ProjectionFileView::OnConvertFFTPolar)
+EVT_MENU(PJMENU_CONVERT_PARALLEL, ProjectionFileView::OnConvertParallel)
 EVT_MENU(PJMENU_PLOT_TTHETA_SAMPLING, ProjectionFileView::OnPlotTThetaSampling)
+EVT_MENU(PJMENU_ARTIFACT_REDUCTION, ProjectionFileView::OnArtifactReduction)
 END_EVENT_TABLE()
 
+
 ProjectionFileView::ProjectionFileView() 
 : wxView(), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0)
 {
@@ -2344,13 +2347,12 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event)
     ImageFile* pIF = new ImageFile (m_iDefaultPolarNX, m_iDefaultPolarNY);
     m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str());
     
-  if (! rProj.convertPolar (*pIF, m_iDefaultPolarInterpolation)) {
+    if (! rProj.convertPolar (*pIF, m_iDefaultPolarInterpolation)) {
       delete pIF;
       *theApp->getLog() << "Error converting to Polar\n";
       return;
     }
 
-
     pPolarDoc = theApp->newImageDoc ();
     if (! pPolarDoc) {
       sys_error (ERR_SEVERE, "Unable to create image file");
@@ -2449,6 +2451,34 @@ ProjectionFileView::OnPlotTThetaSampling (wxCommandEvent& event)
     return;
 }
 
+void
+ProjectionFileView::OnConvertParallel (wxCommandEvent& event)
+{
+  Projections& rProj = GetDocument()->getProjections();
+  if (rProj.geometry() == Scanner::GEOMETRY_PARALLEL) {
+    wxMessageBox ("Projections are already parallel", "Error");
+    return;
+  }
+  Projections* pProjNew = rProj.interpolateToParallel();
+  ProjectionFileDocument* pProjDocNew = theApp->newProjectionDoc();
+  pProjDocNew->setProjections (pProjNew);  
+
+  if (ProjectionFileView* projView = pProjDocNew->getView()) {
+    projView->OnUpdate (projView, NULL);
+    if (projView->getCanvas())
+      projView->getCanvas()->SetClientSize (pProjNew->nDet(), pProjNew->nView());
+    if (wxFrame* pFrame = projView->getFrame()) {
+      pFrame->Show(true);
+      pFrame->SetFocus();
+      pFrame->Raise();
+    }
+    GetDocumentManager()->ActivateView (projView, true, false);
+  }
+  if (theApp->getAskDeleteNewDocs())
+    pProjDocNew-> Modify(true);
+  pProjDocNew->UpdateAllViews (this);
+}
+
 void
 ProjectionFileView::OnReconstructFourier (wxCommandEvent& event)
 {
@@ -2572,6 +2602,12 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
 }
 
 
+void
+ProjectionFileView::OnArtifactReduction (wxCommandEvent& event)
+{
+}
+
+
 ProjectionFileCanvas* 
 ProjectionFileView::CreateCanvas (wxFrame *parent)
 {
@@ -2631,6 +2667,11 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   wxMenu *convert_menu = new wxMenu;
   convert_menu->Append (PJMENU_CONVERT_POLAR, "&Polar Image...\tCtrl-L");
   convert_menu->Append (PJMENU_CONVERT_FFT_POLAR, "&FFT->Polar Image...\tCtrl-M");
+  convert_menu->AppendSeparator();
+  convert_menu->Append (PJMENU_CONVERT_PARALLEL, "&Interpolate to Parallel");
+
+  wxMenu* filter_menu = new wxMenu;
+  filter_menu->Append (PJMENU_ARTIFACT_REDUCTION, "&Artifact Reduction");
 
   wxMenu* analyze_menu = new wxMenu;
   analyze_menu->Append (PJMENU_PLOT_TTHETA_SAMPLING, "&Plot T-Theta Sampling\tCtrl-T");
@@ -2650,6 +2691,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   
   menu_bar->Append (m_pFileMenu, "&File");
   menu_bar->Append (convert_menu, "&Convert");
+  menu_bar->Append (filter_menu, "Fi&lter");
   menu_bar->Append (analyze_menu, "&Analyze");
   menu_bar->Append (reconstruct_menu, "&Reconstruct");
   menu_bar->Append (help_menu, "&Help");
index 38ea68519962de6a43f4eda0c4d117fe2c8b6bf3..1946806bb878dc9fa22972dea056f6df582405f8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.h,v 1.48 2001/03/10 23:14:16 kevin Exp $
+**  $Id: views.h,v 1.49 2001/03/11 06:34:37 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -241,7 +241,9 @@ public:
   void OnConvertPolar (wxCommandEvent& event);
   void OnConvertFFTPolar (wxCommandEvent& event);
   void OnPlotTThetaSampling (wxCommandEvent& event);
-  
+  void OnConvertParallel (wxCommandEvent& event);
+  void OnArtifactReduction (wxCommandEvent& event);
+
 #if CTSIM_MDI
   wxDocMDIChildFrame* getFrame() { return m_pFrame; }
 #else