projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r632: Added Clipboard functions to image files
[ctsim.git]
/
libctsim
/
projections.cpp
diff --git
a/libctsim/projections.cpp
b/libctsim/projections.cpp
index c55aa37a5fcc94b6292ac9b912f93e858bbb5b7f..27d5b69ffa7516d5435ce0406068b61fd94bbeea 100644
(file)
--- 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
**
** 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.
60 2001/03/11 17:55:29
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
**
** 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 (! 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<double> adView (nx, ny);
Array2d<double> adDet (nx, ny);
double** ppdView = adView.getArray();
double** ppdDet = adDet.getArray();
Array2d<double> adView (nx, ny);
Array2d<double> 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<double>** ppcDetValue = new std::complex<double>* [m_nView];
return false;
std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
@@
-709,12
+708,15
@@
Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
ppcDetValue[iView][iDet] = std::complex<double>(getDetectorArray (iView).detValues()[iDet], 0);
}
ppcDetValue[iView][iDet] = std::complex<double>(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, m_nView, m_nDet, iInterpolationID);
for (iView = 0; iView < m_nView; iView++)
delete [] ppcDetValue[iView];
delete [] ppcDetValue;
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;
}
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);
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 = 51
0
;
+ m_dSourceDetectorLength = 89
0
;
m_detInc = convertDegreesToRadians (3.06976 / 60);
m_detStart = -m_dFanBeamAngle / 2;
m_rotInc = TWOPI / static_cast<double>(iNViews);
m_detInc = convertDegreesToRadians (3.06976 / 60);
m_detStart = -m_dFanBeamAngle / 2;
m_rotInc = TWOPI / static_cast<double>(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;
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;;
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
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);
}
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;
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;
}
pC->m_dRaysum = detValues[iD];
dDetPos += dDetInc;
}