From: Kevin M. Rosenberg Date: Sat, 24 Mar 2001 05:28:28 +0000 (+0000) Subject: r643: no message X-Git-Tag: debian-4.5.3-3~374 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=320062d4d1e53ab9da799c77e9886b1e36cddcf5 r643: no message --- diff --git a/include/interpolator.h b/include/interpolator.h index d807ff8..1b1fc48 100644 --- a/include/interpolator.h +++ b/include/interpolator.h @@ -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 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 LinearInterpolator { private: diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index dff1d0e..4d2cc28 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -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; diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index d50582d..2a80405 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -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** ppcDetValue = new std::complex* [m_nView]; double dInterpScale = (m_nDet-1) / static_cast(iInterpDet-1) / SQRT2; + double dFFTScale = 1. / static_cast(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 projInterp (detval, m_nDet); @@ -771,7 +773,7 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad ppcDetValue[iView] = new std::complex [iNumInterpDetWithZeros]; for (unsigned int iD = 0; iD < iNumInterpDetWithZeros; iD++) - ppcDetValue[iView][iD] = std::complex (pcIn[iD].re / iInterpDet / (iInterpDet/2), pcIn[iD].im / iInterpDet / (iInterpDet/2)); + ppcDetValue[iView][iD] = std::complex (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 complexValue; - BilinearInterpolator bilinear (ppcDetValue, nView, nDetWithZeros); + + BilinearInterpolator* pBilinear; + if (iInterpolationID == POLAR_INTERP_BILINEAR) + pBilinear = new BilinearInterpolator (ppcDetValue, nView, nDetWithZeros); + + BicubicPolyInterpolator* pBicubic; + if (iInterpolationID == POLAR_INTERP_BICUBIC) + pBicubic = new BicubicPolyInterpolator (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 vInterp = bilinear.interpolate (ppdView[ix][iy], ppdDet[ix][iy]); + std::complex 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 v1 = ppcDetValue[iFloorView][iFloorDet]; - std::complex 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 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 vInterp = pBicubic->interpolate (ppdView[ix][iy], ppdDet[ix][iy]); + v[ix][iy] = vInterp.real(); + if (vImag) + vImag[ix][iy] = vInterp.imag(); } } } diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 81cc5d3..1150d39 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,29 +6,13 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-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"

Output Window

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...

--------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-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"

Output Window

Compiling... backgroundmgr.cpp