summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-07-13 16:31:12 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-07-17 11:30:05 +0200
commitdb631e6cd00303c04ba5541ddf98a90d588a10c4 (patch)
tree41bbe8d7905e8160d9b01725b59afc877436bacd
parentfa83c8a76fa19862de5c68914a5ef81397ae89a2 (diff)
downloadastra-db631e6cd00303c04ba5541ddf98a90d588a10c4.tar.gz
astra-db631e6cd00303c04ba5541ddf98a90d588a10c4.tar.bz2
astra-db631e6cd00303c04ba5541ddf98a90d588a10c4.tar.xz
astra-db631e6cd00303c04ba5541ddf98a90d588a10c4.zip
Add SINOGRAM/PROJECTION filter modes to CPU FBP
-rw-r--r--src/FilteredBackProjectionAlgorithm.cpp23
1 files changed, 17 insertions, 6 deletions
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;
}
}