r643: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 24 Mar 2001 05:28:28 +0000 (05:28 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 24 Mar 2001 05:28:28 +0000 (05:28 +0000)
include/interpolator.h
libctsim/phantom.cpp
libctsim/projections.cpp
msvc/ctsim/ctsim.plg

index d807ff805f08748c94c7610784cbd50de0f7f3ab..1b1fc484b2fc24b63f382dff5cd522e10ecce587 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: interpolator.h,v 1.3 2001/03/22 02:30:00 kevin Exp $
+**  $Id: interpolator.h,v 1.4 2001/03/24 05:28:28 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
@@ -34,6 +34,7 @@ public:
   double interpolate (double x);
 };
 
+
 class CubicPolyInterpolator {
 private:
   const double* const m_pdY;
@@ -88,6 +89,34 @@ public:
 };
 
 
+template<class T>
+class BicubicPolyInterpolator {
+private:
+  T** const m_ppMatrix;
+  const unsigned int m_nx;
+  const unsigned int m_ny;
+
+public:
+  BicubicPolyInterpolator (T** ppMatrix, unsigned int nx, unsigned int ny)
+  : m_ppMatrix(ppMatrix), m_nx(nx), m_ny(ny)
+  {}
+  
+  T interpolate (double dXPos, double dYPos)
+  {
+    int iFloorX = floor (dXPos);
+    int iFloorY = floor (dYPos);
+    double dXFrac = dXPos - iFloorX;
+    double dYFrac = dYPos - iFloorY;
+
+    T result = 0;
+
+    // Need to add code
+
+    return result;
+  }
+};
+
+
 template<class T>
 class LinearInterpolator {
 private:
index dff1d0ee6bcc137ab1257d31d828921ffc937f96..4d2cc28fbbc03896eaed2f6bfbcb72e331640dc8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: phantom.cpp,v 1.30 2001/02/27 03:59:30 kevin Exp $
+**  $Id: phantom.cpp,v 1.31 2001/03/24 05:28:28 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
@@ -28,7 +28,8 @@
 #include "ct.h"
 
 const int PhantomElement::POINTS_PER_CIRCLE = 360;
-const double PhantomElement::SCALE_PELEM_EXTENT=0.005;  // increase pelem limits by 0.5% 
+const double PhantomElement::SCALE_PELEM_EXTENT=0.000;  // increase pelem limits by 0.5% 
+//const double PhantomElement::SCALE_PELEM_EXTENT=0.005;  // increase pelem limits by 0.5% 
 
 const int Phantom::PHM_INVALID = -1;
 const int Phantom::PHM_HERMAN = 0;
index d50582d5fd7bde8fc8bf447b0aa625e927f2ddee..2a80405a43dc1eb0356f1ddaf6d2d9bb6c58ed7e 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.69 2001/03/22 02:30:00 kevin Exp $
+**  $Id: projections.cpp,v 1.70 2001/03/24 05:28:28 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
@@ -755,6 +755,8 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad
   std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
   double dInterpScale = (m_nDet-1) / static_cast<double>(iInterpDet-1) / SQRT2;
   
+  double dFFTScale = 1. / static_cast<double>(iInterpDet * iInterpDet);
+  dFFTScale /= 2; // Not sure why this scaling is necessary
   for (unsigned int iView = 0; iView < m_nView; iView++) {
     DetectorValue* detval = getDetectorArray(iView).detValues();
     LinearInterpolator<DetectorValue> projInterp (detval, m_nDet);
@@ -771,7 +773,7 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad
 
     ppcDetValue[iView] = new std::complex<double> [iNumInterpDetWithZeros];
     for (unsigned int iD = 0; iD < iNumInterpDetWithZeros; iD++)
-      ppcDetValue[iView][iD] = std::complex<double> (pcIn[iD].re / iInterpDet / (iInterpDet/2), pcIn[iD].im / iInterpDet / (iInterpDet/2)); 
+      ppcDetValue[iView][iD] = std::complex<double> (pcIn[iD].re * dFFTScale, pcIn[iD].im * dFFTScale); 
 
     Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], iNumInterpDetWithZeros);
   }
@@ -834,7 +836,6 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double
 
       if (phi < 0)
         phi += TWOPI;
-
       if (phi >= PI) {
         phi -= PI;
         r = -r;
@@ -852,7 +853,14 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag,
      double** ppdDet, unsigned int nView, unsigned int nDet, unsigned int nDetWithZeros, int iInterpolationID)
 {
   typedef std::complex<double> complexValue;
-  BilinearInterpolator<complexValue> bilinear (ppcDetValue, nView, nDetWithZeros);
+
+  BilinearInterpolator<complexValue>* pBilinear;  
+  if (iInterpolationID == POLAR_INTERP_BILINEAR)
+    pBilinear = new BilinearInterpolator<complexValue> (ppcDetValue, nView, nDetWithZeros);
+
+  BicubicPolyInterpolator<complexValue>* pBicubic;  
+  if (iInterpolationID == POLAR_INTERP_BICUBIC)
+    pBicubic = new BicubicPolyInterpolator<complexValue> (ppcDetValue, nView, nDetWithZeros);
 
   for (unsigned int ix = 0; ix < ny; ix++) {
     for (unsigned int iy = 0; iy < ny; iy++) {
@@ -872,52 +880,15 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag,
           v[ix][iy] = 0;
 
       } else if (iInterpolationID == POLAR_INTERP_BILINEAR) {
-#if 1
-        std::complex<double> vInterp = bilinear.interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
+        std::complex<double> vInterp = pBilinear->interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
         v[ix][iy] = vInterp.real();
         if (vImag)
           vImag[ix][iy] = vInterp.imag();
-#else
-        int iFloorView = ::floor (ppdView[ix][iy]);
-        double dFracView = ppdView[ix][iy] - iFloorView;
-        int iFloorDet = ::floor (ppdDet[ix][iy]);
-        double dFracDet = ppdDet[ix][iy] - iFloorDet;
-
-        if (iFloorDet >= 0 && iFloorView >= 0) { 
-          std::complex<double> v1 = ppcDetValue[iFloorView][iFloorDet];
-          std::complex<double> v2, v3, v4;
-          if (iFloorView < nView - 1)
-            v2 = ppcDetValue[iFloorView + 1][iFloorDet];
-          else 
-            v2 = ppcDetValue[0][iFloorDet];
-          if (iFloorDet < nDetWithZeros - 1) 
-            v4 = ppcDetValue[iFloorView][iFloorDet+1];
-          else
-            v4 = v1;
-          if (iFloorView < nView - 1 && iFloorDet < nDetWithZeros - 1)
-            v3 = ppcDetValue [iFloorView+1][iFloorDet+1];
-          else if (iFloorView < nView - 1)
-            v3 = v2;
-          else 
-            v3 = ppcDetValue[0][iFloorDet+1];
-
-          std::complex<double> vInterp = (1 - dFracView) * (1 - dFracDet) * v1 +
-            dFracView * (1 - dFracDet) * v2 + dFracView * dFracDet * v3 +
-            dFracDet * (1 - dFracView) * v4;
-          v[ix][iy] = vInterp.real();
-          if (vImag)
-            vImag[ix][iy] = vInterp.imag();
-        } else {
-     //     sys_error (ERR_SEVERE, "Can't find projection data for ix=%d,iy=%d with radView=%f and radDet=%f", ix, iy, ppdView[ix][iy], ppdDet[ix][iy]);
-          v[ix][iy] = 0;
-          if (vImag)
-            vImag[ix][iy] = 0;
-        }
-#endif
       } else if (iInterpolationID == POLAR_INTERP_BICUBIC) {
-        v[ix][iy] =0;
-          if (vImag)
-            vImag[ix][iy] = 0;
+        std::complex<double> vInterp = pBicubic->interpolate (ppdView[ix][iy], ppdDet[ix][iy]);
+        v[ix][iy] = vInterp.real();
+        if (vImag)
+          vImag[ix][iy] = vInterp.imag();
       }
     }
   }
index 81cc5d34784c1cc307e4544377fff54705a35324..1150d39d77421364df4b0a7c926984cfca8a683a 100644 (file)
@@ -6,29 +6,13 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBD.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\backprojectors.cpp"
-"C:\ctsim\libctgraphics\dlgezplot.cpp"
-"C:\ctsim\libctsim\filter.cpp"
-"C:\ctsim\libctsim\fourier.cpp"
-"C:\ctsim\libctsim\globalvars.cpp"
-"C:\ctsim\libctsupport\hashtable.cpp"
-"C:\ctsim\libctsim\imagefile.cpp"
-"C:\ctsim\libctsupport\interpolator.cpp"
-"C:\ctsim\libctsim\phantom.cpp"
-"C:\ctsim\libctsupport\plotfile.cpp"
-"C:\ctsim\libctgraphics\pol.cpp"
-"C:\ctsim\libctsim\procsignal.cpp"
 "C:\ctsim\libctsim\projections.cpp"
-"C:\ctsim\libctsim\reconstruct.cpp"
-"C:\ctsim\libctsim\scanner.cpp"
-"C:\ctsim\libctsupport\syserror.cpp"
-"C:\ctsim\libctsim\trace.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBD.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBE.tmp" with contents
 [
 /nologo /out:"Debug\libctsim.lib" 
 .\Debug\array2dfile.obj
@@ -64,32 +48,16 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.tmp" with content
 .\Debug\transformmatrix.obj
 .\Debug\xform.obj
 ]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.tmp"
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBE.tmp"
 <h3>Output Window</h3>
 Compiling...
 projections.cpp
-backprojectors.cpp
-dlgezplot.cpp
-filter.cpp
-fourier.cpp
-globalvars.cpp
-hashtable.cpp
-imagefile.cpp
-interpolator.cpp
-phantom.cpp
-plotfile.cpp
-pol.cpp
-procsignal.cpp
-reconstruct.cpp
-scanner.cpp
-syserror.cpp
-trace.cpp
 Creating library...
 <h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP47.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBF.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX"ctsim.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
 "C:\ctsim\src\backgroundmgr.cpp"
@@ -99,8 +67,8 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP47.tmp" with content
 "C:\ctsim\src\threadraster.cpp"
 "C:\ctsim\src\threadrecon.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP47.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP48.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPBF.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPC0.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX"ctsim.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
 "C:\ctsim\src\ctsim.cpp"
@@ -110,8 +78,8 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP48.tmp" with content
 "C:\ctsim\src\docs.cpp"
 "C:\ctsim\src\views.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP48.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP49.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPC0.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPC1.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
@@ -138,7 +106,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\RSP49.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPC1.tmp"
 <h3>Output Window</h3>
 Compiling...
 backgroundmgr.cpp