X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=2d2592e62f8d9382d121d332c29b2cfaa9e42089;hb=79ef6dfda2cb12c01dbc60f2ccdcef3f72a911c4;hp=c55aa37a5fcc94b6292ac9b912f93e858bbb5b7f;hpb=999a754d1519a49ca062ee87b22bf601c1ee9f21;p=ctsim.git diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index c55aa37..2d2592e 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.57 2001/03/11 06:34:37 kevin Exp $ +** $Id: projections.cpp,v 1.61 2001/03/11 18:52:03 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 @@ -688,17 +688,16 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID) if (! v || nx == 0 || ny == 0) return false; - if (m_geometry != Scanner::GEOMETRY_PARALLEL) { - sys_error (ERR_WARNING, "convertPolar supports Parallel only"); - return false; - } + Projections* pProj = this; + if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR) + pProj = interpolateToParallel(); Array2d adView (nx, ny); Array2d adDet (nx, ny); double** ppdView = adView.getArray(); double** ppdDet = adDet.getArray(); - if (! calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet)) + if (! pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet)) return false; std::complex** ppcDetValue = new std::complex* [m_nView]; @@ -706,15 +705,18 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID) for (iView = 0; iView < m_nView; iView++) { ppcDetValue[iView] = new std::complex [m_nDet]; for (unsigned int iDet = 0; iDet < m_nDet; iDet++) - ppcDetValue[iView][iDet] = std::complex(getDetectorArray (iView).detValues()[iDet], 0); + ppcDetValue[iView][iDet] = std::complex(pProj->getDetectorArray (iView).detValues()[iDet], 0); } - interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iInterpolationID); + pProj->interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, pProj->m_nView, pProj->m_nDet, iInterpolationID); for (iView = 0; iView < m_nView; iView++) delete [] ppcDetValue[iView]; delete [] ppcDetValue; + if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR) + delete pProj; + return true; } @@ -885,15 +887,14 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag, } } - bool Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pData, unsigned long lDataLength) { init (iNViews, iNDets); m_geometry = Scanner::GEOMETRY_EQUIANGULAR; m_dFanBeamAngle = iNDets * convertDegreesToRadians (3.06976 / 60); - m_dFocalLength = 51; - m_dSourceDetectorLength = 89; + m_dFocalLength = 510; + m_dSourceDetectorLength = 890; m_detInc = convertDegreesToRadians (3.06976 / 60); m_detStart = -m_dFanBeamAngle / 2; m_rotInc = TWOPI / static_cast(iNViews); @@ -991,7 +992,11 @@ Projections::interpolateToParallel () 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; +#ifdef CONVERT_PARALLEL_PI pProjNew->m_rotInc = PI / nView;; +#else + pProjNew->m_rotInc = TWOPI / nView; +#endif pProjNew->m_detStart = -m_dViewDiameter / 2; pProjNew->m_detInc = m_dViewDiameter / nDet; if (nDet % 2 == 0) // even @@ -1086,10 +1091,12 @@ ParallelRaysums::ParallelRaysums (Projections* pProjections) pC->m_dTheta = normalizeAngle (dViewAngle + dDetPos); pC->m_dT = dFocalLength * sin (dDetPos); } +#ifdef CONVERT_PARALLEL_PI 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_dT = -pC->m_dT; } +#endif pC->m_dRaysum = detValues[iD]; dDetPos += dDetInc; }