summaryrefslogtreecommitdiffstats
path: root/include/astra
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-07-12 12:11:52 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-07-17 11:30:05 +0200
commitd32df3bcd1910f56195e828a0f7fba8fc04b90ab (patch)
tree56963d80f825af10639dee0e1c7c439bbffd1f76 /include/astra
parentd58f6b51493c7931cbc02feb3ffeb0eca6ea3a4e (diff)
downloadastra-d32df3bcd1910f56195e828a0f7fba8fc04b90ab.tar.gz
astra-d32df3bcd1910f56195e828a0f7fba8fc04b90ab.tar.bz2
astra-d32df3bcd1910f56195e828a0f7fba8fc04b90ab.tar.xz
astra-d32df3bcd1910f56195e828a0f7fba8fc04b90ab.zip
Refactor filter config
Diffstat (limited to 'include/astra')
-rw-r--r--include/astra/CudaFilteredBackProjectionAlgorithm.h6
-rw-r--r--include/astra/Filters.h21
-rw-r--r--include/astra/cuda/2d/fbp.h4
-rw-r--r--include/astra/cuda/2d/fft.h4
4 files changed, 23 insertions, 12 deletions
diff --git a/include/astra/CudaFilteredBackProjectionAlgorithm.h b/include/astra/CudaFilteredBackProjectionAlgorithm.h
index 974914a..8ef5a57 100644
--- a/include/astra/CudaFilteredBackProjectionAlgorithm.h
+++ b/include/astra/CudaFilteredBackProjectionAlgorithm.h
@@ -46,11 +46,7 @@ public:
static std::string type;
private:
- E_FBPFILTER m_eFilter;
- float * m_pfFilter;
- int m_iFilterWidth; // number of elements per projection direction in filter
- float m_fFilterParameter; // some filters allow for parameterization (value < 0.0f -> no parameter)
- float m_fFilterD; // frequency cut-off
+ SFilterConfig m_filterConfig;
bool m_bShortScan; // short-scan mode for fan beam
public:
diff --git a/include/astra/Filters.h b/include/astra/Filters.h
index ff3f5c8..eec2ba2 100644
--- a/include/astra/Filters.h
+++ b/include/astra/Filters.h
@@ -30,6 +30,9 @@ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
namespace astra {
+struct Config;
+class CAlgorithm;
+
enum E_FBPFILTER
{
FILTER_ERROR, //< not a valid filter
@@ -58,14 +61,28 @@ enum E_FBPFILTER
};
+struct SFilterConfig {
+ E_FBPFILTER m_eType;
+ float m_fD;
+ float m_fParameter;
+
+ float *m_pfCustomFilter;
+ int m_iCustomFilterWidth;
+
+ SFilterConfig() : m_eType(FILTER_ERROR), m_fD(1.0f), m_fParameter(-1.0f),
+ m_pfCustomFilter(0), m_iCustomFilterWidth(0) { };
+};
+
// Generate filter of given size and parameters. Returns newly allocated array.
-float *genFilter(E_FBPFILTER _eFilter, float _fD, int _iProjectionCount,
+float *genFilter(const SFilterConfig &_cfg, int _iProjectionCount,
int _iFFTRealDetectorCount,
- int _iFFTFourierDetectorCount, float _fParameter = -1.0f);
+ int _iFFTFourierDetectorCount);
// Convert string to filter type. Returns FILTER_ERROR if unrecognized.
E_FBPFILTER convertStringToFilter(const char * _filterType);
+SFilterConfig getFilterConfigForAlgorithm(const Config& _cfg, CAlgorithm *_alg);
+
}
#endif
diff --git a/include/astra/cuda/2d/fbp.h b/include/astra/cuda/2d/fbp.h
index 7febe69..1adf3b1 100644
--- a/include/astra/cuda/2d/fbp.h
+++ b/include/astra/cuda/2d/fbp.h
@@ -75,9 +75,7 @@ public:
// FILTER_COSINE, FILTER_HAMMING, and FILTER_HANN)
// have a D variable, which gives the cutoff point in the frequency domain.
// Setting this value to 1.0 will include the whole filter
- bool setFilter(astra::E_FBPFILTER _eFilter,
- const float * _pfHostFilter = NULL,
- int _iFilterWidth = 0, float _fD = 1.0f, float _fFilterParameter = -1.0f);
+ bool setFilter(const astra::SFilterConfig &_cfg);
bool setShortScan(bool ss) { m_bShortScan = ss; return true; }
diff --git a/include/astra/cuda/2d/fft.h b/include/astra/cuda/2d/fft.h
index f5f8477..33612a0 100644
--- a/include/astra/cuda/2d/fft.h
+++ b/include/astra/cuda/2d/fft.h
@@ -60,9 +60,9 @@ void applyFilter(int _iProjectionCount, int _iFreqBinCount,
int calcFFTFourierSize(int _iFFTRealSize);
-void genCuFFTFilter(astra::E_FBPFILTER _eFilter, float _fD, int _iProjectionCount,
+void genCuFFTFilter(const astra::SFilterConfig &_cfg, int _iProjectionCount,
cufftComplex * _pFilter, int _iFFTRealDetectorCount,
- int _iFFTFourierDetectorCount, float _fParameter = -1.0f);
+ int _iFFTFourierDetectorCount);
void genIdenFilter(int _iProjectionCount, cufftComplex * _pFilter,
int _iFFTRealDetectorCount, int _iFFTFourierDetectorCount);