iRoCS Toolbox  1.1.0
FastCorrelationFilter.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 ATBFASTCORRELATIONFILTER_HH
31 #define ATBFASTCORRELATIONFILTER_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
37 #include "Filter.hh"
38 
40 
41 #include <omp.h>
42 
43 namespace atb
44 {
45 
46 /*======================================================================*/
62 /*======================================================================*/
63  template<typename DataT, int Dim>
64  class FastCorrelationFilter : public Filter<DataT,Dim,DataT>
65  {
66 
67  public:
68 
69 /*======================================================================*/
79 /*======================================================================*/
82  DataT const &boundaryValue = traits<DataT>::zero);
83 
84 /*======================================================================*/
97 /*======================================================================*/
99  blitz::Array<DataT,Dim> const &kernel,
101  DataT const &boundaryValue = traits<DataT>::zero);
102 
103 /*======================================================================*/
107 /*======================================================================*/
109 
110 /*======================================================================*/
116 /*======================================================================*/
117  void setKernel(blitz::Array<DataT,Dim> const &kernel);
118 
119 /*======================================================================*/
125 /*======================================================================*/
126  blitz::Array<DataT,Dim> const &kernel() const;
127 
128 /*======================================================================*/
139 /*======================================================================*/
140  void apply(
141  blitz::Array<DataT,Dim> const &data,
142  blitz::TinyVector<double,Dim> const &elementSizeUm,
143  blitz::Array<DataT,Dim> &result,
144  iRoCS::ProgressReporter *pr = NULL) const;
145 
146  // Explicitly force the name mangler to also consider the base class
147  // implementation
149 
150 /*======================================================================*/
166 /*======================================================================*/
167  static void apply(
168  blitz::Array<DataT,Dim> const &data,
169  blitz::TinyVector<double,Dim> const &elementSizeUm,
170  blitz::Array<DataT,Dim> &result,
171  blitz::Array<DataT,Dim> const &kernel,
173  DataT const &boundaryValue = traits<DataT>::zero,
174  iRoCS::ProgressReporter *pr = NULL);
175 
176 /*======================================================================*/
191 /*======================================================================*/
192  static void apply(
193  Array<DataT,Dim> const &data, Array<DataT,Dim> &result,
194  blitz::Array<DataT,Dim> const &kernel,
196  DataT const &boundaryValue = traits<DataT>::zero,
197  iRoCS::ProgressReporter *pr = NULL);
198 
199  private:
200 
201  blitz::Array<DataT,Dim> const *p_kernel;
202  mutable blitz::Array<std::complex<DataT>,Dim> _kernelFFTCache;
203 
204  };
205 
206 }
207 
208 #include "FastCorrelationFilter.icc"
209 
210 #endif
blitz::Array< DataT, Dim > const & kernel() const
Get the correlation kernel.
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
The FastCorrelationFilter class provides n-D Array correlation using the Fast Fourier Transform...
~FastCorrelationFilter()
Destructor.
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.
Treat positions beyond the Array domain as having a constant value.
void setKernel(blitz::Array< DataT, Dim > const &kernel)
Set the correlation kernel.
FastCorrelationFilter(BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.