X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=8440bd49c9eac4c66b47846c9042764485b851cb;hp=968ee0ec48b1bdb807362ead34d0e187384da5bf;hb=5a6caa64e880f613b82e516031028d02fd127257;hpb=f90a2885fb7fa51e5c66a9a8b01f1fc6e1801b3c diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 968ee0e..8440bd4 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.71 2001/03/28 16:53:43 kevin Exp $ +** $Id: projections.cpp,v 1.73 2001/03/30 19:17:32 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 @@ -740,12 +740,12 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad if (! v || nx == 0 || ny == 0) return false; - if (m_geometry != Scanner::GEOMETRY_PARALLEL) { - sys_error (ERR_WARNING, "convertFFTPolar supports Parallel only"); - return false; - } + Projections* pProj = this; + if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR) + pProj = interpolateToParallel(); int iInterpDet = nx; +// int iInterpDet = pProj->m_nDet; int iNumInterpDetWithZeros = ProcessSignal::addZeropadFactor (iInterpDet, iZeropad); double dZeropadRatio = static_cast(iNumInterpDetWithZeros) / static_cast(iInterpDet); @@ -753,22 +753,24 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad fftw_plan plan = fftw_create_plan (iNumInterpDetWithZeros, FFTW_FORWARD, FFTW_IN_PLACE | FFTW_ESTIMATE | FFTW_USE_WISDOM); fftw_complex* pcIn = new fftw_complex [iNumInterpDetWithZeros]; - std::complex** ppcDetValue = new std::complex* [m_nView]; - double dInterpScale = (m_nDet-1) / static_cast(iInterpDet-1) / SQRT2; + std::complex** ppcDetValue = new std::complex* [pProj->m_nView]; + double dInterpScale = (pProj->m_nDet-1) / static_cast(iInterpDet-1) / SQRT2; double dFFTScale = 1. / static_cast(iInterpDet * iInterpDet); int iMidPoint = iInterpDet / 2; double dMidPoint = static_cast(iInterpDet) / 2.; int iZerosAdded = iNumInterpDetWithZeros - iInterpDet; + + // For each view, interpolate to nx length, shift to center at origin, and FFt transform for (unsigned int iView = 0; iView < m_nView; iView++) { - DetectorValue* detval = getDetectorArray(iView).detValues(); - LinearInterpolator projInterp (detval, m_nDet); + DetectorValue* detval = pProj->getDetectorArray(iView).detValues(); + LinearInterpolator projInterp (detval, pProj->m_nDet); for (unsigned int iDet = 0; iDet < iInterpDet; iDet++) { -// double dInterpPos = iInterpDet * dInterpScale; double dInterpPos = (m_nDet / 2.) + (iDet - dMidPoint) * dInterpScale; - pcIn[iDet].re = projInterp.interpolate (dInterpPos) * PI * SQRT2; + pcIn[iDet].re = projInterp.interpolate (dInterpPos) * dInterpScale; pcIn[iDet].im = 0; } + Fourier::shuffleFourierToNaturalOrder (pcIn, iInterpDet); if (iZerosAdded > 0) { for (unsigned int iDet1 = iMidPoint; iDet1 < iInterpDet; iDet1++) @@ -794,11 +796,14 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad Array2d adDet (nx, ny); double** ppdView = adView.getArray(); double** ppdDet = adDet.getArray(); - calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet, iNumInterpDetWithZeros, dZeropadRatio, - m_detInc * dInterpScale); + pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet, iNumInterpDetWithZeros, dZeropadRatio, + pProj->m_detInc * dInterpScale); + + pProj->interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, pProj->m_nView, pProj->m_nDet, + iNumInterpDetWithZeros, iInterpolationID); - interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iNumInterpDetWithZeros, - iInterpolationID); + if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR) + delete pProj; for (int i = 0; i < m_nView; i++) delete [] ppcDetValue[i];