iRoCS Toolbox  1.1.0
LaplacianOfGaussianFilter.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 ATBLAPLACIANFILTER_HH
31 #define ATBLAPLACIANFILTER_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
38 
39 #include "ATBDataSynthesis.hh"
40 
41 namespace atb
42 {
43 
44 /*======================================================================*/
51 /*======================================================================*/
52  template<typename DataT, int Dim>
54  public Filter< DataT,Dim,DataT >
55  {
56 
57  public:
58 
59  typedef DataT ResultT;
60 
61 /*======================================================================*/
69 /*======================================================================*/
72  DataT const &boundaryValue = traits<DataT>::zero);
73 
74 /*======================================================================*/
89 /*======================================================================*/
91  double standardDeviationUm,
92  blitz::TinyVector<BlitzIndexT,Dim> const &minimumKernelShapePx =
94  DataT const &boundaryValue = traits<DataT>::zero);
95 
96 /*======================================================================*/
100 /*======================================================================*/
101  virtual ~LaplacianOfGaussianFilter();
102 
103 /*======================================================================*/
109 /*======================================================================*/
110  double standardDeviationUm() const
111  {
112  return _standardDeviationUm;
113  }
114 
115 /*======================================================================*/
122 /*======================================================================*/
123  void setStandardDeviationUm(double standardDeviationUm)
124  {
125  _standardDeviationUm = standardDeviationUm;
126  }
127 
128 /*======================================================================*/
135 /*======================================================================*/
136  blitz::TinyVector<BlitzIndexT,Dim> minimumKernelShapePx() const
137  {
138  return _minimumKernelShapePx;
139  }
140 
141 /*======================================================================*/
148 /*======================================================================*/
150  blitz::TinyVector<BlitzIndexT,Dim> const &minimumKernelShapePx) const
151  {
152  _minimumKernelShapePx = minimumKernelShapePx;
153  }
154 
155 /*======================================================================*/
164 /*======================================================================*/
165  void renderKernel(atb::Array<DataT,Dim> &kernel) const;
166 
167 /*======================================================================*/
178 /*======================================================================*/
179  virtual void apply(
180  blitz::Array<DataT,Dim> const &data,
181  blitz::TinyVector<double,Dim> const &elementSizeUm,
182  blitz::Array<ResultT,Dim> &filtered,
183  iRoCS::ProgressReporter *pr = NULL) const;
184 
185  // Explicitly force the name mangler to also consider the base class
186  // implementation
188 
189 /*======================================================================*/
204 /*======================================================================*/
205  static void apply(
206  blitz::Array<DataT,Dim> const &data,
207  blitz::TinyVector<double,Dim> const &elementSizeUm,
208  blitz::Array<ResultT,Dim> &filtered,
209  double standardDeviationUm,
210  blitz::TinyVector<BlitzIndexT,Dim>
211  const &minimumKernelShapePx = BlitzIndexT(0),
213  DataT const &boundaryValue = traits<DataT>::zero,
214  iRoCS::ProgressReporter *pr = NULL);
215 
216 /*======================================================================*/
233 /*======================================================================*/
234  static void apply(
235  Array<DataT,Dim> const &data, Array<ResultT,Dim> &filtered,
236  double standardDeviationUm,
237  blitz::TinyVector<BlitzIndexT,Dim>
238  const &minimumKernelShapePx = BlitzIndexT(0),
240  DataT const &boundaryValue = traits<DataT>::zero,
241  iRoCS::ProgressReporter *pr = NULL);
242 
243  private:
244 
245  static void _gaussian(
246  atb::Array<DataT,1> &gauss, double sigmaUm, BlitzIndexT minExtent);
247  static void _laplacianOfGaussian(
248  atb::Array<DataT,1> &laplacian, double sigmaUm, BlitzIndexT minExtent);
249 
250  double _standardDeviationUm;
251  blitz::TinyVector<BlitzIndexT,Dim> _minimumKernelShapePx;
252 
253  };
254 
255 }
256 
257 #include "LaplacianOfGaussianFilter.icc"
258 
259 #endif
The LaplacianOfGaussianFilter class implements the Filter interface and provides Laplacian of Gaussia...
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
void setMinimumKernelShapePx(blitz::TinyVector< BlitzIndexT, Dim > const &minimumKernelShapePx) const
Set the minimum kernel shape of the Gaussian in pixels for all dimensions.
void setStandardDeviationUm(double standardDeviationUm)
Set the standard deviation of the Gaussian.
BoundaryTreatmentType
BoundaryTreatment.hh "libArrayToolbox/BoundaryTreatment.hh".
The traits class provides means to query specific information about different data types...
Definition: TypeTraits.hh:73
LaplacianOfGaussianFilter(BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.
double standardDeviationUm() const
Get the standard deviation of the Gaussian.
int BlitzIndexT
The native integer type for indexing blitz++ Arrays.
Definition: TypeTraits.hh:56
virtual ~LaplacianOfGaussianFilter()
Destructor.
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.
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.
void renderKernel(atb::Array< DataT, Dim > &kernel) const
Render the used kernel into the given Array.