STIR 6.4.0
ArrayFilterUsingRealDFTWithPadding.h
Go to the documentation of this file.
1
8/*
9 Copyright (C) 2004-2009, Hammersmith Imanet Ltd
10 This file is part of STIR.
11
12 SPDX-License-Identifier: Apache-2.0
13
14 See STIR/LICENSE.txt for details
15*/
16
17#ifndef __stir_ArrayFilterUsingRealDFTWithPadding_H__
18#define __stir_ArrayFilterUsingRealDFTWithPadding_H__
19
20#include "stir/Array.h"
23#include "stir/IndexRange.h"
24#include <complex>
25
26START_NAMESPACE_STIR
27class Succeeded;
28
44template <int num_dimensions, typename elemT>
46{
47public:
51
55
57
61 ArrayFilterUsingRealDFTWithPadding(const Array<num_dimensions, std::complex<elemT>>& kernel_in_frequency_space);
62
64 /*
65 The kernel can be given with arbitrary (but regular) index range,
66 but will be wrapped-around,
67 assuming that it is periodic outside the indexrange of the kernel. So,
68 normally, the 0- index corresponds to the middle of the PSF.
69
70 Input data will be zero-padded to the same range as this kernel before
71 DFT. If you want to avoid aliasing, make sure that the kernel is at least
72 twice as long as the input and output arrays.
73
74 As this function uses fourier_for_real_data(), see there for restrictions
75 on the possible kernel length, but at time of writing, it has to be a power of 2.
76 */
77 Succeeded set_kernel(const Array<num_dimensions, elemT>& real_filter_kernel);
78
80 /* The kernel has to be given with index ranges starting from 0.
81 So, the 0- index corresponds to the DC component of the filter.
82
83 \see fourier_for_real_data() for more info on the range of frequencies
84 Input data will be zero-padded to the index range as the corresponding
85 'real' kernel before DFT. If you want to avoid aliasing, make sure that the kernel is at least
86 twice as long as the input and output arrays.
87
88 See fourier() for restrictions on the possible
89 kernel length, but at time of writing, it has to be a power of 2.
90 */
91 Succeeded set_kernel_in_frequency_space(const Array<num_dimensions, std::complex<elemT>>& kernel_in_frequency_space);
92
94
97 bool is_trivial() const override;
98
99protected:
100 Array<num_dimensions, std::complex<elemT>> kernel_in_frequency_space;
101
103
108 void do_it(Array<num_dimensions, elemT>& out_array, const Array<num_dimensions, elemT>& in_array) const override;
109
110private:
111 IndexRange<num_dimensions> padding_range;
113 Succeeded set_padding_range();
114};
115
116END_NAMESPACE_STIR
117
118#endif // ArrayFilterUsingRealDFTWithPadding
Declaration of class stir::ArrayFunctionObject_2ArgumentImplementation.
defines the stir::Array class for multi-dimensional (numeric) arrays
defines additional numerical operations for arrays of complex numbers
This file defines the stir::IndexRange class.
Succeeded set_kernel(const Array< num_dimensions, elemT > &real_filter_kernel)
set the real kernel coefficients
Definition ArrayFilterUsingRealDFTWithPadding.cxx:75
void do_it(Array< num_dimensions, elemT > &out_array, const Array< num_dimensions, elemT > &in_array) const override
Performs the convolution.
Definition ArrayFilterUsingRealDFTWithPadding.cxx:119
Succeeded set_kernel_in_frequency_space(const Array< num_dimensions, std::complex< elemT > > &kernel_in_frequency_space)
set the complex kernel coefficients
Definition ArrayFilterUsingRealDFTWithPadding.cxx:102
bool is_trivial() const override
checks if the kernel corresponds to a trivial filter operation
Definition ArrayFilterUsingRealDFTWithPadding.cxx:111
ArrayFilterUsingRealDFTWithPadding()
Default constructor (trivial kernel)
Definition ArrayFilterUsingRealDFTWithPadding.cxx:33
A convenience class for children of ArrayFunctionObject. It implements the in-place operator() in ter...
Definition ArrayFunctionObject_2ArgumentImplementation.h:42
This class defines multi-dimensional (numeric) arrays.
Definition Array.h:78
class BasicCoordinate<int num_dimensions, typename coordT> defines num_dimensions -dimensional coordi...
Definition BasicCoordinate.h:57
This class defines ranges which can be 'irregular'.
Definition IndexRange.h:69
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44