iRoCS Toolbox  1.1.0
MedianFilter.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 ATBMEDIANFILTER_HH
31 #define ATBMEDIANFILTER_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
37 #include "Filter.hh"
38 
39 namespace atb
40 {
41 
42 /*======================================================================*/
47 /*======================================================================*/
48  template<typename DataT, int Dim>
49  class MedianFilter : public Filter<DataT,Dim,DataT>
50  {
51 
52  public:
53 
54  typedef DataT ResultT;
55 
56 /*======================================================================*/
65 /*======================================================================*/
67  blitz::TinyVector<BlitzIndexT,Dim> const &extentsPx =
68  blitz::TinyVector<BlitzIndexT,Dim>(BlitzIndexT(1)));
69 
70 /*======================================================================*/
74 /*======================================================================*/
75  virtual ~MedianFilter();
76 
77 /*======================================================================*/
83 /*======================================================================*/
84  blitz::TinyVector<BlitzIndexT,Dim> const &filterExtentsPx() const;
85 
86 /*======================================================================*/
92 /*======================================================================*/
93  void setFilterExtentsPx(
94  blitz::TinyVector<BlitzIndexT,Dim> const &extentsPx);
95 
96 /*======================================================================*/
107 /*======================================================================*/
108  virtual void apply(
109  blitz::Array<DataT,Dim> const &data,
110  blitz::TinyVector<double,Dim> const &elementSizeUm,
111  blitz::Array<ResultT,Dim> &result,
112  iRoCS::ProgressReporter *pr = NULL) const;
113 
114  // Explicitly force the name mangler to also consider the base class
115  // implementation
117 
118 /*======================================================================*/
129 /*======================================================================*/
130  static void apply(
131  blitz::Array<DataT,Dim> const &data,
132  blitz::Array<ResultT,Dim> &filtered,
133  blitz::TinyVector<BlitzIndexT,Dim> const &extentsPx,
134  iRoCS::ProgressReporter *pr = NULL);
135 
136  private:
137 
138  blitz::TinyVector<BlitzIndexT,Dim> _filterExtentsPx;
139 
140  };
141 
142 }
143 
144 #include "MedianFilter.icc"
145 
146 #endif
Base class (Interface) for all Filter implementations.
The MedianFilter class implements the n-dimensional median filter.
Definition: MedianFilter.hh:49
The Filter class is the base class for all filter implementations.
Definition: Filter.hh:55
virtual ~MedianFilter()
Destructor.
void setFilterExtentsPx(blitz::TinyVector< BlitzIndexT, Dim > const &extentsPx)
Set the filter extents in pixels.
blitz::TinyVector< BlitzIndexT, Dim > const & filterExtentsPx() const
Get the filter extents in pixels.
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 > &result, iRoCS::ProgressReporter *pr=NULL) const
Apply the filter to the given Array.
MedianFilter(blitz::TinyVector< BlitzIndexT, Dim > const &extentsPx=blitz::TinyVector< BlitzIndexT, Dim >(BlitzIndexT(1)))
Constructor.