X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=612ab6bf9161663dd42d6894e3bb1cfc371fc5de;hb=ab78de6e33fff94c37847621458db3ad430a8bb3;hp=b2d3c4aabc39cfcc37cc1eea20887322a5c9eebf;hpb=27baab81972b095035e92f958843f86bf2632f68;p=ctsim.git diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index b2d3c4a..612ab6b 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.76 2001/09/24 11:29:41 kevin Exp $ +** $Id: projections.cpp,v 1.80 2002/06/27 03:19:23 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 @@ -25,6 +25,7 @@ ******************************************************************************/ #include "ct.h" +#include const kuint16 Projections::m_signature = ('P'*256 + 'J'); @@ -650,7 +651,7 @@ Projections::read (const char* filename) #ifdef MSVC frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary); #else - frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary | std::ios::nocreate); + frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary); // | std::ios::nocreate); #endif if (fileRead.fail()) @@ -970,11 +971,11 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID) double** ppdDet = adDet.getArray(); std::complex** ppcDetValue = new std::complex* [pProj->m_nView]; - unsigned int iView; + int iView; 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 < pProj->m_nDet; iDet++) + for (int iDet = 0; iDet < pProj->m_nDet; iDet++) ppcDetValue[iView][iDet] = std::complex(detval[iDet], 0); } @@ -1033,10 +1034,10 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad 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++) { + for (int iView = 0; iView < m_nView; iView++) { DetectorValue* detval = pProj->getDetectorArray(iView).detValues(); LinearInterpolator projInterp (detval, pProj->m_nDet); - for (unsigned int iDet = 0; iDet < iInterpDet; iDet++) { + for (int iDet = 0; iDet < iInterpDet; iDet++) { double dInterpPos = (m_nDet / 2.) + (iDet - dMidPoint) * dInterpScale; pcIn[iDet].re = projInterp.interpolate (dInterpPos) * dInterpScale; pcIn[iDet].im = 0; @@ -1044,16 +1045,16 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad Fourier::shuffleFourierToNaturalOrder (pcIn, iInterpDet); if (iZerosAdded > 0) { - for (unsigned int iDet1 = iMidPoint; iDet1 < iInterpDet; iDet1++) + for (int iDet1 = iMidPoint; iDet1 < iInterpDet; iDet1++) pcIn[iDet1+iZerosAdded] = pcIn[iDet1]; - for (unsigned int iDet2 = iMidPoint; iDet2 < iMidPoint + iZerosAdded; iDet2++) + for (int iDet2 = iMidPoint; iDet2 < iMidPoint + iZerosAdded; iDet2++) pcIn[iDet2].re = pcIn[iDet2].im = 0; } fftw_one (plan, pcIn, NULL); ppcDetValue[iView] = new std::complex [iNumInterpDetWithZeros]; - for (unsigned int iD = 0; iD < iNumInterpDetWithZeros; iD++) { + for (int iD = 0; iD < iNumInterpDetWithZeros; iD++) { ppcDetValue[iView][iD] = std::complex (pcIn[iD].re * dFFTScale, pcIn[iD].im * dFFTScale); } @@ -1139,7 +1140,7 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag, { typedef std::complex complexValue; - BilinearInterpolator* pBilinear; + BilinearInterpolator* pBilinear = NULL; if (iInterpolationID == POLAR_INTERP_BILINEAR) pBilinear = new BilinearInterpolator (ppcDetValue, nView, nDetWithZeros); @@ -1206,22 +1207,22 @@ Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pDa for (int iv = 0; iv < iNViews; iv++) { unsigned char* pArgBase = pData + lDataPos; unsigned char* p = pArgBase+0; SwapBytes4IfLittleEndian (p); - long lProjNumber = *reinterpret_cast(p); + // long lProjNumber = *reinterpret_cast(p); p = pArgBase+20; SwapBytes4IfLittleEndian (p); long lEscale = *reinterpret_cast(p); p = pArgBase+28; SwapBytes4IfLittleEndian (p); - long lTime = *reinterpret_cast(p); + // long lTime = *reinterpret_cast(p); p = pArgBase + 4; SwapBytes4IfLittleEndian (p); double dAlpha = *reinterpret_cast(p) + HALFPI; p = pArgBase+12; SwapBytes4IfLittleEndian (p); - double dAlign = *reinterpret_cast(p); + // double dAlign = *reinterpret_cast(p); p = pArgBase + 16; SwapBytes4IfLittleEndian (p); - double dMaxValue = *reinterpret_cast(p); + // double dMaxValue = *reinterpret_cast(p); DetectorArray& detArray = getDetectorArray (iv); detArray.setViewAngle (dAlpha); @@ -1292,9 +1293,9 @@ Projections::interpolateToParallel () const double dViewAngle = m_rotStart; int iLastFloor = -1; + LinearInterpolator interp (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView(), false); for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) { DetectorValue* detValues = pProjNew->getDetectorArray (iV).detValues(); - LinearInterpolator interp (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView(), false); detValues[iD] = interp.interpolate (dViewAngle, &iLastFloor); } } @@ -1337,8 +1338,8 @@ Projections::interpolateToParallel () const /////////////////////////////////////////////////////////////////////////////// ParallelRaysums::ParallelRaysums (const Projections* pProjections, int iThetaRange) -: m_iNumCoordinates(0), m_iNumView(pProjections->nView()), m_iNumDet(pProjections->nDet()), - m_iThetaRange (iThetaRange), m_pCoordinates(NULL) +: m_pCoordinates(NULL), m_iNumCoordinates(0), m_iNumView(pProjections->nView()), m_iNumDet(pProjections->nDet()), + m_iThetaRange (iThetaRange) { int iGeometry = pProjections->geometry(); double dDetInc = pProjections->detInc();