iRoCS Toolbox  1.1.0
GaussianFilter.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 /*======================================================================*/
29 /*======================================================================*/
30 
31 #ifndef ATBGAUSSIANFILTER_HH
32 #define ATBGAUSSIANFILTER_HH
33 
34 #ifdef HAVE_CONFIG_H
35 #include <config.hh>
36 #endif
37 
39 
40 #include "ATBDataSynthesis.hh"
41 
42 namespace atb
43 {
44 
45 /*======================================================================*/
51 /*======================================================================*/
52  template<typename DataT, int Dim>
53  class GaussianFilter : public Filter<DataT,Dim,DataT>
54  {
55 
56  public:
57 
58  typedef DataT ResultT;
59 
60 /*======================================================================*/
68 /*======================================================================*/
71  DataT const &boundaryValue = traits<DataT>::zero);
72 
73 /*======================================================================*/
88 /*======================================================================*/
90  blitz::TinyVector<double,Dim> const &standardDeviationUm,
91  blitz::TinyVector<BlitzIndexT,Dim> const &minimumKernelShapePx =
93  DataT const &boundaryValue = traits<DataT>::zero);
94 
95 /*======================================================================*/
99 /*======================================================================*/
100  virtual ~GaussianFilter();
101 
102 /*======================================================================*/
109 /*======================================================================*/
110  blitz::TinyVector<double,Dim> standardDeviationUm() const;
111 
112 /*======================================================================*/
120 /*======================================================================*/
122  blitz::TinyVector<double,Dim> const &standardDeviationUm);
123 
124 /*======================================================================*/
131 /*======================================================================*/
132  blitz::TinyVector<BlitzIndexT,Dim> minimumKernelShapePx() const;
133 
134 /*======================================================================*/
141 /*======================================================================*/
143  blitz::TinyVector<BlitzIndexT,Dim> const &minimumKernelShapePx);
144 
145 /*======================================================================*/
158 /*======================================================================*/
159  virtual void apply(
160  blitz::Array<DataT,Dim> const &data,
161  blitz::TinyVector<double,Dim> const &elementSizeUm,
162  blitz::Array<ResultT,Dim> &filtered,
163  iRoCS::ProgressReporter *pr = NULL) const;
164 
165  // Explicitly force the name mangler to also consider the base class
166  // implementation
168 
169 /*======================================================================*/
188 /*======================================================================*/
189  static void apply(
190  blitz::Array<DataT,Dim> const &data,
191  blitz::TinyVector<double,Dim> const &elementSizeUm,
192  blitz::Array<ResultT,Dim> &filtered,
193  blitz::TinyVector<double,Dim> const &standardDeviationUm,
194  blitz::TinyVector<BlitzIndexT,Dim>
195  const &minimumKernelShapePx = BlitzIndexT(0),
197  DataT const &boundaryValue = traits<DataT>::zero,
198  iRoCS::ProgressReporter *pr = NULL);
199 
200 /*======================================================================*/
221 /*======================================================================*/
222  static void apply(
223  Array<DataT,Dim> const &data, Array<ResultT,Dim> &filtered,
224  blitz::TinyVector<double,Dim> const &standardDeviationUm,
225  blitz::TinyVector<BlitzIndexT,Dim>
226  const &minimumKernelShapePx = BlitzIndexT(0),
228  DataT const &boundaryValue = traits<DataT>::zero,
229  iRoCS::ProgressReporter *pr = NULL);
230 
231  private:
232 
233  static void _gaussian(
234  atb::Array<DataT,1> &gauss, double sigmaUm, BlitzIndexT minExtent);
235 
236  blitz::TinyVector<double,Dim> _standardDeviationUm;
237  blitz::TinyVector<BlitzIndexT,Dim> _minimumKernelShapePx;
238 
239  };
240 
241 }
242 
243 #include "GaussianFilter.icc"
244 
245 #endif
Classes and functions for n-D separable convolution.
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 GaussianFilter class implements the Filter interface and provides a Gaussian smoothing filter...
blitz::TinyVector< double, Dim > standardDeviationUm() const
Get the standard deviation of the Gaussian in micrometers for all dimensions.
virtual ~GaussianFilter()
Destructor.
void setMinimumKernelShapePx(blitz::TinyVector< BlitzIndexT, Dim > const &minimumKernelShapePx)
Set the minimum kernel shape of the Gaussian in pixels for all dimensions.
void setStandardDeviationUm(blitz::TinyVector< double, Dim > const &standardDeviationUm)
Set the standard deviation of the Gaussian in micrometers for all dimensions.
int BlitzIndexT
The native integer type for indexing blitz++ Arrays.
Definition: TypeTraits.hh:56
virtual void apply(blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< ResultT, Dim > &filtered, iRoCS::ProgressReporter *pr=NULL) const
Apply the filter to the given Array.
Treat positions beyond the Array domain as having a constant value.
blitz::TinyVector< BlitzIndexT, Dim > minimumKernelShapePx() const
Get the minimum kernel shape of the Gaussian in pixels for all dimensions.
GaussianFilter(BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.