iRoCS Toolbox  1.1.0
FastConvolutionFilter.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2015 Thorsten Falk
4  *
5  * Image Analysis Lab, University of Freiburg, Germany
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  **************************************************************************/
22 
23 /*======================================================================*/
28 /*======================================================================*/
29 
30 #ifndef ATBFASTCONVOLUTIONFILTER_HH
31 #define ATBFASTCONVOLUTIONFILTER_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
37 #include "Filter.hh"
38 
40 
41 namespace atb
42 {
43 
44 /*======================================================================*/
60 /*======================================================================*/
61  template<typename DataT, int Dim>
62  class FastConvolutionFilter : public Filter<DataT,Dim,DataT>
63  {
64 
65  public:
66 
67 /*======================================================================*/
77 /*======================================================================*/
80  DataT const &boundaryValue = traits<DataT>::zero);
81 
82 /*======================================================================*/
95 /*======================================================================*/
97  blitz::Array<DataT,Dim> const &kernel,
99  DataT const &boundaryValue = traits<DataT>::zero);
100 
101 /*======================================================================*/
105 /*======================================================================*/
107 
108 /*======================================================================*/
114 /*======================================================================*/
115  void setKernel(blitz::Array<DataT,Dim> const &kernel);
116 
117 /*======================================================================*/
123 /*======================================================================*/
124  blitz::Array<DataT,Dim> const &kernel() const;
125 
126 /*======================================================================*/
137 /*======================================================================*/
138  void apply(
139  blitz::Array<DataT,Dim> const &data,
140  blitz::TinyVector<double,Dim> const &elementSizeUm,
141  blitz::Array<DataT,Dim> &result,
142  iRoCS::ProgressReporter *pr = NULL) const;
143 
144  // Explicitly force the name mangler to also consider the base class
145  // implementation
147 
148 /*======================================================================*/
164 /*======================================================================*/
165  static void apply(
166  blitz::Array<DataT,Dim> const &data,
167  blitz::TinyVector<double,Dim> const &elementSizeUm,
168  blitz::Array<DataT,Dim> &result,
169  blitz::Array<DataT,Dim> const &kernel,
171  DataT const &boundaryValue = traits<DataT>::zero,
172  iRoCS::ProgressReporter *pr = NULL);
173 
174 /*======================================================================*/
189 /*======================================================================*/
190  static void apply(
191  Array<DataT,Dim> const &data, Array<DataT,Dim> &result,
192  blitz::Array<DataT,Dim> const &kernel,
194  DataT const &boundaryValue = traits<DataT>::zero,
195  iRoCS::ProgressReporter *pr = NULL);
196 
197  private:
198 
199  blitz::Array<DataT,Dim> const *p_kernel;
200  blitz::Array<std::complex<DataT>,Dim> _kernelFFTCache;
201 
202  };
203 
204 }
205 
206 #include "FastConvolutionFilter.icc"
207 
208 #endif
~FastConvolutionFilter()
Destructor.
Base class (Interface) for all Filter implementations.
The Filter class is the base class for all filter implementations.
Definition: Filter.hh:55
The Array class is an extension to the blitz++ Array class providing additional parameters element si...
Definition: Array.hh:85
BoundaryTreatmentType
BoundaryTreatment.hh "libArrayToolbox/BoundaryTreatment.hh".
The traits class provides means to query specific information about different data types...
Definition: TypeTraits.hh:73
void apply(blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &result, iRoCS::ProgressReporter *pr=NULL) const
Apply the filter to the given Array.
FastConvolutionFilter(BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.
The FastConvolutionFilter class provides n-D Array convolution using the Fast Fourier Transform...
blitz::Array< DataT, Dim > const & kernel() const
Get the convolution kernel.
void setKernel(blitz::Array< DataT, Dim > const &kernel)
Set the convolution kernel.
Treat positions beyond the Array domain as having a constant value.