STIR  6.2.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 
26 START_NAMESPACE_STIR
27 class Succeeded;
28 template <int num_dimensions, typename elemT>
29 class Array;
30 
46 template <int num_dimensions, typename elemT>
48 {
49 public:
53 
57 
59 
63  ArrayFilterUsingRealDFTWithPadding(const Array<num_dimensions, std::complex<elemT>>& kernel_in_frequency_space);
64 
66  /*
67  The kernel can be given with arbitrary (but regular) index range,
68  but will be wrapped-around,
69  assuming that it is periodic outside the indexrange of the kernel. So,
70  normally, the 0- index corresponds to the middle of the PSF.
71 
72  Input data will be zero-padded to the same range as this kernel before
73  DFT. If you want to avoid aliasing, make sure that the kernel is at least
74  twice as long as the input and output arrays.
75 
76  As this function uses fourier_for_real_data(), see there for restrictions
77  on the possible kernel length, but at time of writing, it has to be a power of 2.
78  */
79  Succeeded set_kernel(const Array<num_dimensions, elemT>& real_filter_kernel);
80 
82  /* The kernel has to be given with index ranges starting from 0.
83  So, the 0- index corresponds to the DC component of the filter.
84 
85  \see fourier_for_real_data() for more info on the range of frequencies
86  Input data will be zero-padded to the index range as the corresponding
87  'real' kernel before DFT. If you want to avoid aliasing, make sure that the kernel is at least
88  twice as long as the input and output arrays.
89 
90  See fourier() for restrictions on the possible
91  kernel length, but at time of writing, it has to be a power of 2.
92  */
93  Succeeded set_kernel_in_frequency_space(const Array<num_dimensions, std::complex<elemT>>& kernel_in_frequency_space);
94 
96 
99  bool is_trivial() const override;
100 
101 protected:
102  Array<num_dimensions, std::complex<elemT>> kernel_in_frequency_space;
103 
105 
110  void do_it(Array<num_dimensions, elemT>& out_array, const Array<num_dimensions, elemT>& in_array) const override;
111 
112 private:
113  IndexRange<num_dimensions> padding_range;
115  Succeeded set_padding_range();
116 };
117 
118 END_NAMESPACE_STIR
119 
120 #endif // ArrayFilterUsingRealDFTWithPadding
A convenience class for children of ArrayFunctionObject. It implements the in-place operator() in ter...
Definition: ArrayFunctionObject_2ArgumentImplementation.h:41
This class defines ranges which can be &#39;irregular&#39;.
Definition: ArrayFunctionObject.h:32
Declaration of class stir::ArrayFunctionObject_2ArgumentImplementation.
defines the Array class for multi-dimensional (numeric) arrays
defines additional numerical operations for arrays of complex numbers
This file defines the stir::IndexRange class.
This class implements convolution of an array of real numbers with an arbitrary (i.e. potentially non-symmetric) kernel using DFTs.
Definition: ArrayFilterUsingRealDFTWithPadding.h:47
This class defines multi-dimensional (numeric) arrays.
Definition: Array.h:73
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43