iRoCS Toolbox  1.1.0
LocalSumFilter.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 /*======================================================================*/
31 /*======================================================================*/
32 
33 #ifndef ATBLOCALSUMFILTER_HH
34 #define ATBLOCALSUMFILTER_HH
35 
36 #ifdef HAVE_CONFIG_H
37 #include <config.hh>
38 #endif
39 
40 #include "SeparableFilter.hh"
41 
42 namespace atb
43 {
44 
45 /*======================================================================*/
57 /*======================================================================*/
58  template<typename DataT, int Dim>
59  class LocalSumFilter : public SeparableFilter<DataT,Dim,DataT>
60  {
61 
62  public:
63 
64 /*======================================================================*/
74 /*======================================================================*/
77  DataT const &boundaryValue = traits<DataT>::zero);
78 
79 /*======================================================================*/
92 /*======================================================================*/
94  blitz::TinyVector<BlitzIndexT,Dim> const &kernelShapePx,
96  DataT const &boundaryValue = traits<DataT>::zero);
97 
98 /*======================================================================*/
102 /*======================================================================*/
103  ~LocalSumFilter();
104 
105 /*======================================================================*/
113 /*======================================================================*/
114  BlitzIndexT kernelSizePxInDim(int dim) const;
115 
116 /*======================================================================*/
124 /*======================================================================*/
125  void setKernelSizePxInDim(int dim, BlitzIndexT kernelSizePx);
126 
127 /*======================================================================*/
133 /*======================================================================*/
134  blitz::TinyVector<BlitzIndexT,Dim> const &kernelShapePx() const;
135 
136 /*======================================================================*/
144 /*======================================================================*/
145  void setKernelShapePx(
146  blitz::TinyVector<BlitzIndexT,Dim> const &kernelShapePx);
147 
148 /*======================================================================*/
158 /*======================================================================*/
159  void applyAlongDim(
160  blitz::Array<DataT,Dim> const &data,
161  blitz::TinyVector<double,Dim> const &elementSizeUm,
162  blitz::Array<DataT,Dim> &filtered, int dim,
163  iRoCS::ProgressReporter *pr = NULL) const;
164 
165  // Explicitly force the name mangler to also consider the base class
166  // implementation
168 
169 /*======================================================================*/
177 /*======================================================================*/
178  void apply(
179  blitz::Array<DataT,Dim> const &data,
180  blitz::TinyVector<double,Dim> const &elementSizeUm,
181  blitz::Array<DataT,Dim> &filtered,
182  iRoCS::ProgressReporter *pr = NULL) const;
183 
184  // Explicitly force the name mangler to also consider the base class
185  // implementation
187 
188 /*======================================================================*/
203 /*======================================================================*/
204  static void apply(
205  blitz::Array<DataT,Dim> const &data,
206  blitz::TinyVector<double,Dim> const &elementSizeUm,
207  blitz::Array<DataT,Dim> &filtered,
208  blitz::TinyVector<BlitzIndexT,Dim> const &kernelShapePx,
210  DataT const &boundaryValue = traits<DataT>::zero,
211  iRoCS::ProgressReporter *pr = NULL);
212 
213 /*======================================================================*/
227 /*======================================================================*/
228  static void apply(
229  Array<DataT,Dim> const &data, Array<DataT,Dim> &filtered,
230  blitz::TinyVector<BlitzIndexT,Dim> const &kernelShapePx,
232  DataT const &boundaryValue = traits<DataT>::zero,
233  iRoCS::ProgressReporter *pr = NULL);
234 
235  private:
236 
237  blitz::TinyVector<BlitzIndexT,Dim> _kernelShapePx;
238 
239  };
240 
241 }
242 
243 #include "LocalSumFilter.icc"
244 
245 #endif
~LocalSumFilter()
Destructor.
BlitzIndexT kernelSizePxInDim(int dim) const
Get the box width in the specified dimension.
void applyAlongDim(blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &filtered, int dim, iRoCS::ProgressReporter *pr=NULL) const
Application of the local sum filter onto the data Array along the specified dimension.
The Filter class is the base class for all filter implementations.
Definition: Filter.hh:55
The SeparableFilter class specifies methods a separable filter provides additionally to the filter me...
The Array class is an extension to the blitz++ Array class providing additional parameters element si...
Definition: Array.hh:85
The LocalSumFilter class is a box filter with a filter kernel containing only ones.
void setKernelShapePx(blitz::TinyVector< BlitzIndexT, Dim > const &kernelShapePx)
Set the box kernel shape.
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 > &filtered, iRoCS::ProgressReporter *pr=NULL) const
Application of the local sum filter onto the data Array.
Filter Interface additions that apply to separable filters.
int BlitzIndexT
The native integer type for indexing blitz++ Arrays.
Definition: TypeTraits.hh:56
void setKernelSizePxInDim(int dim, BlitzIndexT kernelSizePx)
Set the box width in the specified dimension.
LocalSumFilter(BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
Default Constructor.
Treat positions beyond the Array domain as having a constant value.
blitz::TinyVector< BlitzIndexT, Dim > const & kernelShapePx() const
Get the box kernel shape.