STIR  6.3.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 
44 template <int num_dimensions, typename elemT>
46 {
47 public:
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 
99 protected:
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 
110 private:
111  IndexRange<num_dimensions> padding_range;
113  Succeeded set_padding_range();
114 };
115 
116 END_NAMESPACE_STIR
117 
118 #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:31
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.
This class implements convolution of an array of real numbers with an arbitrary (i.e. potentially non-symmetric) kernel using DFTs.
Definition: ArrayFilterUsingRealDFTWithPadding.h:45
This class defines multi-dimensional (numeric) arrays.
Definition: Array.h:77
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43