CTL  0.6.1
Computed Tomography Library
oclprojectionfilters.h
1 #ifndef CTL_OCLPROJECTIONFILTERS_H
2 #define CTL_OCLPROJECTIONFILTERS_H
3 
4 #include "genericoclprojectionfilter.h"
5 #include <algorithm>
6 #include <complex>
7 
8 namespace CTL {
9 class AcquisitionSetup;
10 class FullGeometry;
11 
12 namespace OCL {
13 
30 {
32 
33 public:
35  void filter(ProjectionData& projections, const FullGeometry& pMats);
36  void filter(ProjectionData& projections, const AcquisitionSetup& setup);
37 
38 protected:
39  bool autoCombine() const override;
40  cl::NDRange globalWorksize(const ProjectionData& projections) const override;
41 
42 private:
43  void filter(ProjectionData&) override{};
44 };
45 
86 {
88 
89 public:
90  explicit ParkerWeightingRev(float q = 1.0f);
91  void filter(ProjectionData& projections, const FullGeometry& pMats);
92  void filter(ProjectionData& projections, const AcquisitionSetup& setup);
93 
94  float lastAngularRange() const;
95 
96 private:
97  void filter(ProjectionData&) override{};
98  float _q = 1.0f;
99  float _lastAngularRange = 0.0f;
100 };
101 
120 {
122  Q_GADGET
123 
124 public:
125  void filter(ProjectionData& projections) override;
126 
127 public:
129  Q_ENUM(FilterType)
130 
131  explicit ApodizationFilter(FilterType filterType, float frequencyScaling = 1.0f);
132 
133  // AbstractProjectionFilter interface
134  QVariant parameter() const override;
135  void setParameter(const QVariant& parameter) override;
136 
137 private:
138  FilterType _filterType;
139  float _frequencyScaling = 1.0f;
140  std::vector<float> _filter;
141 
143  std::vector<float> generateCoefficients(unsigned filterSize) const;
144 
145  static QMetaEnum metaEnum();
146 };
147 
161 {
163 
164 public:
165  explicit RamLakFilter(float scaling = 1.0f);
166 };
167 
179 {
181 
182 public:
183  explicit HilbertFilter(float scaling = 1.0f);
184 };
185 
241 } // namespace OCL
242 
243 namespace assist {
244 
245 // shifts the zero-frequency component to the center of the spectrum
246 template <typename T>
247 void fftshift(std::vector<T>& v)
248 {
249  std::rotate(v.rbegin(), v.rbegin() + v.size() / 2, v.rend());
250 }
251 
252 // inverse of fftshift
253 template <typename T>
254 void ifftshift(std::vector<T>& v)
255 {
256  std::rotate(v.begin(), v.begin() + v.size() / 2, v.end());
257 }
258 
259 std::vector<std::complex<double>> dft(const std::vector<float>& image);
260 std::vector<float> idft(const std::vector<std::complex<double>>& fourier);
261 
262 } // namespace assist
263 } // namespace CTL
264 
265 #endif // CTL_OCLPROJECTIONFILTERS_H
The ApodizationFilter class is an OpenCL implementation of several apodization functions.
Definition: oclprojectionfilters.h:119
void filter(ProjectionData &projections) override
Applies the apodization filter operation to projections.
Definition: oclprojectionfilters.cpp:349
bool autoCombine() const override
Returns false, since this class does not use automated combining.
Definition: oclprojectionfilters.cpp:89
Multiplies the Ram-Lak filter by the sinc function.
Definition: oclprojectionfilters.h:128
The HilbertFilter class is an OpenCL implementation of the discrete Hilbert transform.
Definition: oclprojectionfilters.h:178
FilterType
Definition: oclprojectionfilters.h:128
The GenericOCLProjectionFilter class is a facility class that allows easy construction of a projectio...
Definition: genericoclprojectionfilter.h:129
ApodizationFilter()
Default ctor; private. Used for purpose of deserialization only.
Definition: oclprojectionfilters.cpp:341
void filter(ProjectionData &projections, const FullGeometry &pMats)
Applies (revised) Parker weighting to projections assuming the (pre-encoded) geometry of pMats.
Definition: oclprojectionfilters.cpp:123
The ParkerWeightingRev class is an OpenCL implementation of the revised Parker weighting.
Definition: oclprojectionfilters.h:85
QVariant parameter() const override
Returns the parameters of this instance as a QVariant.
Definition: oclprojectionfilters.cpp:288
Holds a CTSystem together with the information about the system settings for all views from which pro...
Definition: acquisitionsetup.h:175
float lastAngularRange() const
Returns the angular range (in radiants) that has been determined for the last projection dataset that...
Definition: oclprojectionfilters.cpp:259
Holds a list of SingleViewGeometry instances to represent the acquisition geometry of a full CT scan.
Definition: viewgeometry.h:71
The ProjectionData class is the container class used to store all projections from all views.
Definition: projectiondata.h:19
No apodization.
Definition: oclprojectionfilters.h:128
The CosineWeighting class is an OpenCL implementation of cosine weighting.
Definition: oclprojectionfilters.h:29
std::vector< float > generateCoefficients(unsigned filterSize) const
Generates the coefficients for a filter of size filterSize.
Definition: oclprojectionfilters.cpp:377
cl::NDRange globalWorksize(const ProjectionData &projections) const override
Returns the global worksize for the kernel call.
Definition: oclprojectionfilters.cpp:100
static QMetaEnum metaEnum()
QMetaEnum object used to decode/encode subset order enum values.
Definition: oclprojectionfilters.cpp:458
Multiplies the Ram-Lak filter by the Hann window.
Definition: oclprojectionfilters.h:128
The RamLakFilter class is an OpenCL implementation of the Ram-Lak filter.
Definition: oclprojectionfilters.h:160
#define CTL_TYPE_ID(newIndex)
Definition: serializationinterface.h:189
void filter(ProjectionData &projections, const FullGeometry &pMats)
Applies cosine weighting to projections assuming the (pre-encoded) geometry of pMats.
Definition: oclprojectionfilters.cpp:48
Multiplies the Ram-Lak filter by the cosine function.
Definition: oclprojectionfilters.h:128
void setParameter(const QVariant &parameter) override
Sets the parameters of this instance based on the passed QVariant parameter.
Definition: oclprojectionfilters.cpp:311