From efbcfaa2fd1ae55b27b1826e7cd84ee007e7ecb9 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 22 Mar 2001 02:30:00 +0000 Subject: [PATCH] r642: no message --- include/interpolator.h | 49 +++++++++++++++--------- libctsim/projections.cpp | 20 +++++----- msvc/ctsim/ctsim.plg | 80 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 115 insertions(+), 34 deletions(-) diff --git a/include/interpolator.h b/include/interpolator.h index cea4961..d807ff8 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.2 2001/03/21 21:45:31 kevin Exp $ +** $Id: interpolator.h,v 1.3 2001/03/22 02:30:00 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 @@ -91,17 +91,18 @@ public: template class LinearInterpolator { private: - T* const m_pY; T* const m_pX; + T* const m_pY; const unsigned int m_n; + const bool m_bZeroOutsideRange; public: - LinearInterpolator (T* pY, unsigned int n) - : m_pY(pY), m_pX(0), m_n(n) + LinearInterpolator (T* pY, unsigned int n, bool bZeroOutside = true) + : m_pX(0), m_pY(pY), m_n(n), m_bZeroOutsideRange(bZeroOutside) {} - LinearInterpolator (T* pY, T* pX, unsigned int n) - : m_pY(pY), m_pX(pX), m_n(n) + LinearInterpolator (T* pX, T* pY, unsigned int n, bool bZeroOutside = true) + : m_pX(pX), m_pY(pY), m_n(n), m_bZeroOutsideRange(bZeroOutside) {} double interpolate (double dX, int* piLastFloor = NULL) @@ -111,13 +112,19 @@ public: if (! m_pX) { if (dX == 0) result = m_pY[0]; - else if (dX < 0) - result = 0; - else if (dX == m_n - 1) + else if (dX < 0) { + if (m_bZeroOutsideRange) + result = 0; + else + result = m_pY[0]; + } else if (dX == m_n - 1) result = m_pY[m_n-1]; - else if (dX > m_n - 1) - result = 0; - else { + else if (dX > m_n - 1) { + if (m_bZeroOutsideRange) + result = 0; + else + result = m_pY[m_n - 1]; + } else { int iFloor = floor(dX); result = m_pY[iFloor] + (m_pY[iFloor+1] - m_pY[iFloor]) * (dX - iFloor); } @@ -136,13 +143,19 @@ public: } if (dX == m_pX[0]) result = m_pY[0]; - else if (dX < m_pX[0]) - result = 0; - else if (dX == m_pX[m_n-1]) + else if (dX < m_pX[0]) { + if (m_bZeroOutsideRange) + result = 0; + else + result = m_pY[0]; + } else if (dX == m_pX[m_n-1]) result = m_pY[m_n-1]; - else if (dX > m_pX[m_n-1]) - result = 0; - else { + else if (dX > m_pX[m_n - 1]) { + if (m_bZeroOutsideRange) + result = 0; + else + result = m_pY[m_n - 1]; + } else { if (iLower < 0 || iLower >= m_n) { sys_error (ERR_SEVERE, "Coordinate out of range [linearInterpolate]"); return 0; diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 4d4a02d..d50582d 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.68 2001/03/21 21:45:31 kevin Exp $ +** $Id: projections.cpp,v 1.69 2001/03/22 02:30:00 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 @@ -697,21 +697,21 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID) double** ppdView = adView.getArray(); double** ppdDet = adDet.getArray(); - std::complex** ppcDetValue = new std::complex* [m_nView]; + std::complex** ppcDetValue = new std::complex* [pProj->m_nView]; unsigned int iView; - for (iView = 0; iView < m_nView; iView++) { - ppcDetValue[iView] = new std::complex [m_nDet]; + for (iView = 0; iView < pProj->m_nView; iView++) { + ppcDetValue[iView] = new std::complex [pProj->m_nDet]; DetectorValue* detval = pProj->getDetectorArray (iView).detValues(); - for (unsigned int iDet = 0; iDet < m_nDet; iDet++) + for (unsigned int iDet = 0; iDet < pProj->m_nDet; iDet++) ppcDetValue[iView][iDet] = std::complex(detval[iDet], 0); } - pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet, m_nDet, 1., m_detInc); + pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet, pProj->m_nDet, 1., pProj->m_detInc); pProj->interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, pProj->m_nView, pProj->m_nDet, pProj->m_nDet, iInterpolationID); - for (iView = 0; iView < m_nView; iView++) + for (iView = 0; iView < pProj->m_nView; iView++) delete [] ppcDetValue[iView]; delete [] ppcDetValue; @@ -1038,7 +1038,7 @@ Projections::interpolateToParallel () const int iLastFloor = -1; for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) { DetectorValue* detValues = pProjNew->getDetectorArray (iV).detValues(); - LinearInterpolator interp (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView()); + LinearInterpolator interp (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView(), false); detValues[iD] = interp.interpolate (dViewAngle, &iLastFloor); } } @@ -1057,11 +1057,11 @@ Projections::interpolateToParallel () const detArray.setViewAngle (dViewAngle); for (int i = 0; i < pProjNew->nDet(); i++) - pdDetValueCopy[i] = detValues[i]; + pdDetValueCopy[i] = detValues[i]; double dDetPos = pProjNew->m_detStart; int iLastFloor = -1; - LinearInterpolator interp (pdOriginalDetPositions, pdDetValueCopy, pProjNew->nDet()); + LinearInterpolator interp (pdOriginalDetPositions, pdDetValueCopy, pProjNew->nDet(), false); for (int iD = 0; iD < pProjNew->nDet(); iD++, dDetPos += pProjNew->m_detInc) detValues[iD] = interp.interpolate (dDetPos, &iLastFloor); } diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index f45aeea..81cc5d3 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,13 +6,29 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP16.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP45.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\RSP16.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP17.tmp" with contents +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 [ /nologo /out:"Debug\libctsim.lib" .\Debug\array2dfile.obj @@ -48,16 +64,54 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP17.tmp" with content .\Debug\transformmatrix.obj .\Debug\xform.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP17.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP46.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\RSP18.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP47.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" +"C:\ctsim\src\backgroundsupr.cpp" +"C:\ctsim\src\graph3dview.cpp" +"C:\ctsim\src\threadproj.cpp" +"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 +[ +/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" +"C:\ctsim\src\dialogs.cpp" +"C:\ctsim\src\dlgprojections.cpp" +"C:\ctsim\src\dlgreconstruct.cpp" +"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 [ 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,8 +138,22 @@ 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\RSP18.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP49.tmp"

Output Window

+Compiling... +backgroundmgr.cpp +backgroundsupr.cpp +graph3dview.cpp +threadproj.cpp +threadraster.cpp +threadrecon.cpp +Compiling... +ctsim.cpp +dialogs.cpp +dlgprojections.cpp +dlgreconstruct.cpp +docs.cpp +views.cpp Linking... -- 2.34.1