From db631e6cd00303c04ba5541ddf98a90d588a10c4 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 13 Jul 2018 16:31:12 +0200 Subject: Add SINOGRAM/PROJECTION filter modes to CPU FBP --- src/FilteredBackProjectionAlgorithm.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/FilteredBackProjectionAlgorithm.cpp b/src/FilteredBackProjectionAlgorithm.cpp index ed72aa6..49494d0 100644 --- a/src/FilteredBackProjectionAlgorithm.cpp +++ b/src/FilteredBackProjectionAlgorithm.cpp @@ -279,15 +279,22 @@ void CFilteredBackProjectionAlgorithm::performFiltering(CFloat32ProjectionData2D int iHalfFFTSize = astra::calcFFTFourierSize(zpDetector); // Create filter + bool bFilterMultiAngle = false; float *pfFilter = 0; + float *pfFilter_delete = 0; switch (m_filterConfig.m_eType) { case FILTER_ERROR: case FILTER_NONE: // Should have been handled before ASTRA_ASSERT(false); return; - case FILTER_SINOGRAM: case FILTER_PROJECTION: + pfFilter = m_filterConfig.m_pfCustomFilter; + break; + case FILTER_SINOGRAM: + bFilterMultiAngle = true; + pfFilter = m_filterConfig.m_pfCustomFilter; + break; case FILTER_RSINOGRAM: case FILTER_RPROJECTION: // TODO @@ -296,6 +303,7 @@ void CFilteredBackProjectionAlgorithm::performFiltering(CFloat32ProjectionData2D default: pfFilter = genFilter(m_filterConfig, zpDetector, iHalfFFTSize); + pfFilter_delete = pfFilter; } float32* pf = new float32[2 * iAngleCount * zpDetector]; @@ -326,13 +334,16 @@ void CFilteredBackProjectionAlgorithm::performFiltering(CFloat32ProjectionData2D // Filter for (int iAngle = 0; iAngle < iAngleCount; ++iAngle) { float32* pfRow = pf + iAngle * 2 * zpDetector; + float *pfFilterRow = pfFilter; + if (bFilterMultiAngle) + pfFilterRow += iAngle * iHalfFFTSize; for (int iDetector = 0; iDetector < iHalfFFTSize; ++iDetector) { - pfRow[2*iDetector] *= pfFilter[iDetector]; - pfRow[2*iDetector+1] *= pfFilter[iDetector]; + pfRow[2*iDetector] *= pfFilterRow[iDetector]; + pfRow[2*iDetector+1] *= pfFilterRow[iDetector]; } for (int iDetector = iHalfFFTSize; iDetector < zpDetector; ++iDetector) { - pfRow[2*iDetector] *= pfFilter[zpDetector - iDetector]; - pfRow[2*iDetector+1] *= pfFilter[zpDetector - iDetector]; + pfRow[2*iDetector] *= pfFilterRow[zpDetector - iDetector]; + pfRow[2*iDetector+1] *= pfFilterRow[zpDetector - iDetector]; } } @@ -353,7 +364,7 @@ void CFilteredBackProjectionAlgorithm::performFiltering(CFloat32ProjectionData2D delete[] pf; delete[] w; delete[] ip; - delete[] pfFilter; + delete[] pfFilter_delete; } } -- cgit v1.2.3