void CConeProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ, int iAngleIndex, float32 &fU, float32 &fV) const { ASTRA_ASSERT(iAngleIndex >= 0); ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount); float alpha = m_pfProjectionAngles[iAngleIndex]; // Project point onto optical axis // Projector direction is (cos(alpha), sin(alpha)) // Vector source->origin is (-sin(alpha), cos(alpha)) // Distance from source, projected on optical axis float fD = -sin(alpha) * fX + cos(alpha) * fY + m_fOriginSourceDistance; // Scale fZ to detector plane fV = detectorOffsetYToRowIndexFloat( (fZ * (m_fOriginSourceDistance + m_fOriginDetectorDistance)) / fD ); // Orthogonal distance in XY-plane to optical axis float fS = cos(alpha) * fX + sin(alpha) * fY; // Scale fS to detector plane fU = detectorOffsetXToColIndexFloat( (fS * (m_fOriginSourceDistance + m_fOriginDetectorDistance)) / fD ); ASTRA_DEBUG("alpha: %f, D: %f, V: %f, S: %f, U: %f", alpha, fD, fV, fS, fU); }
//---------------------------------------------------------------------------------------- // Run void CCudaForwardProjectionAlgorithm3D::run(int) { // check initialized assert(m_bIsInitialized); #if 1 CCompositeGeometryManager cgm; cgm.doFP(m_pProjector, m_pVolume, m_pProjections); #else const CProjectionGeometry3D* projgeom = m_pProjections->getGeometry(); const CVolumeGeometry3D& volgeom = *m_pVolume->getGeometry(); Cuda3DProjectionKernel projKernel = ker3d_default; if (m_pProjector) { CCudaProjector3D* projector = dynamic_cast<CCudaProjector3D*>(m_pProjector); projKernel = projector->getProjectionKernel(); } #if 0 // Debugging code that gives the coordinates of the corners of the volume // projected on the detector. { float fX[] = { volgeom.getWindowMinX(), volgeom.getWindowMaxX() }; float fY[] = { volgeom.getWindowMinY(), volgeom.getWindowMaxY() }; float fZ[] = { volgeom.getWindowMinZ(), volgeom.getWindowMaxZ() }; for (int a = 0; a < projgeom->getProjectionCount(); ++a) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int k = 0; k < 2; ++k) { float fU, fV; projgeom->projectPoint(fX[i], fY[j], fZ[k], a, fU, fV); ASTRA_DEBUG("%3d %c1,%c1,%c1 -> %12f %12f", a, i ? ' ' : '-', j ? ' ' : '-', k ? ' ' : '-', fU, fV); } } #endif astraCudaFP(m_pVolume->getDataConst(), m_pProjections->getData(), &volgeom, projgeom, m_iGPUIndex, m_iDetectorSuperSampling, projKernel); #endif }