iRoCS Toolbox  1.1.0
FastNormalizedCorrelationFilter.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 ATBFASTNORMALIZEDCORRELATIONFILTER_HH
31 #define ATBFASTNORMALIZEDCORRELATIONFILTER_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
37 #include "Filter.hh"
38 #include "LocalSumFilter.hh"
39 
41 
42 #include <omp.h>
43 
44 
45 namespace atb
46 {
47 
48 /*======================================================================*/
61 /*======================================================================*/
62  template<typename DataT, int Dim>
63  class FastNormalizedCorrelationFilter : public Filter<DataT,Dim,DataT>
64  {
65 
66  public:
67 
68 /*======================================================================*/
76 /*======================================================================*/
79  DataT const &boundaryValue = traits<DataT>::zero);
80 
81 /*======================================================================*/
92 /*======================================================================*/
94  blitz::Array<DataT,Dim> const &kernel,
96  DataT const &boundaryValue = traits<DataT>::zero);
97 
98 /*======================================================================*/
102 /*======================================================================*/
104 
105 /*======================================================================*/
111 /*======================================================================*/
112  void setKernel(blitz::Array<DataT,Dim> const &kernel);
113 
114 /*======================================================================*/
120 /*======================================================================*/
121  blitz::Array<DataT,Dim> const &kernel() const;
122 
123 /*======================================================================*/
136 /*======================================================================*/
137  void apply(
138  blitz::Array<DataT,Dim> const &data,
139  blitz::TinyVector<double,Dim> const &elementSizeUm,
140  blitz::Array<DataT,Dim> &result,
141  iRoCS::ProgressReporter *pr = NULL) const;
142 
143  // Explicitly force the name mangler to also consider the base class
144  // implementation
146 
147 /*======================================================================*/
165 /*======================================================================*/
166  static void apply(
167  blitz::Array<DataT,Dim> const &data,
168  blitz::TinyVector<double,Dim> const &elementSizeUm,
169  blitz::Array<DataT,Dim> &result,
170  blitz::Array<DataT,Dim> const &kernel,
172  DataT const &boundaryValue = traits<DataT>::zero,
173  iRoCS::ProgressReporter *pr = NULL);
174 
175 /*======================================================================*/
192 /*======================================================================*/
193  static void apply(
194  Array<DataT,Dim> const &data, Array<DataT,Dim> &result,
195  blitz::Array<DataT,Dim> const &kernel,
197  DataT const &boundaryValue = traits<DataT>::zero,
198  iRoCS::ProgressReporter *pr = NULL);
199 
200  private:
201 
202  blitz::Array<DataT,Dim> _kernel;
203 
204  mutable blitz::Array<std::complex<DataT>,Dim> _kernelFFTCache;
205 
206  };
207 
208 }
209 
210 #include "FastNormalizedCorrelationFilter.icc"
211 
212 #endif
Base class (Interface) for all Filter implementations.
The Filter class is the base class for all filter implementations.
Definition: Filter.hh:55
blitz::Array< DataT, Dim > const & kernel() const
Get the normalized correlation kernel.
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
FastNormalizedCorrelationFilter(BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.
Implementation of the local sum filter.
void setKernel(blitz::Array< DataT, Dim > const &kernel)
Set the correlation kernel.
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.
The FastNormalizedCorrelationFilter class provides normalized cross-correlation for n-D Arrays employ...