OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fourier_filters.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  authors: Valerio Mariani, Andreas Schenk
23 */
24 
25 
26 #ifndef IMG_ALG_FILTER_FOURIER_FILTERS_H
27 #define IMG_ALG_FILTER_FOURIER_FILTERS_H
28 
29 #include <ost/img/algorithm.hh>
30 #include <ost/img/image_state.hh>
31 #include <ost/img/image_state.hh>
32 
33 namespace ost { namespace img { namespace alg {
34 
36 
38 {
39  public:
40 
41  LowPassFilter(Real limit=1.0):
42  ConstModIPAlgorithm("LowPassFilter"),
43  limit_(1.0/limit)
44  {if(limit_==0.0)throw("Invalid limit");}
45 
46  virtual void Visit(ImageHandle& ih) const ;
47 
48  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
49  Real GetLimit() {return 1.0/limit_;}
50 
51  private:
52 
53  Real limit_;
54 };
55 
57 
59 {
60  public:
61 
62  HighPassFilter(Real limit=1.0):
63  ConstModIPAlgorithm("HighPassFilter"),
64  limit_(1.0/limit)
65  {if(limit_==0.0)throw("Invalid limit");}
66 
67  virtual void Visit(ImageHandle& ih) const ;
68 
69  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
70  Real GetLimit() {return 1.0/limit_;}
71 
72  private:
73 
74  Real limit_;
75 };
76 
78 
79 class DLLEXPORT_IMG_ALG GaussianLowPassFilter : public ConstModIPAlgorithm
81 {
82  public:
83 
85  ConstModIPAlgorithm("GaussianLowPassFilter"),
86  limit_(1.0/limit)
87  {if(limit_==0.0)throw("Invalid limit");}
88 
89  virtual void Visit(ImageHandle& ih) const ;
90 
91  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
92  Real GetLimit() {return 1.0/limit_;}
93 
94  private:
95 
96  Real limit_;
97 };
98 
100 
102 {
103  public:
104 
106  ConstModIPAlgorithm("GaussianHighPassFilter"),
107  limit_(1.0/limit)
108  {if(limit_==0.0)throw("Invalid limit");}
109 
110  virtual void Visit(ImageHandle& ih) const ;
111 
112  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
113  Real GetLimit() {return 1.0/limit_;}
114 
115  private:
116 
117  Real limit_;
118 };
119 
120 
122 
125 {
126  public:
127 
128  FermiLowPassFilter(Real limit=1.0, Real t=1.0):
129  ConstModIPAlgorithm("FermiLowPassFilter"),
130  limit_(1.0/limit),
131  t_(1.0/t)
132  {if(limit_==0.0)throw("Invalid limit");if(t_==0.0)throw("Invalid t");}
133 
134  virtual void Visit(ImageHandle& ih) const ;
135 
136  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
137  Real GetLimit() {return 1.0/limit_;}
138 
139  void SetT(Real t) {if(t_==0.0)throw("Invalid t");t_=1.0/t;}
140  Real GetT() {return 1.0/t_;}
141 
142  private:
143 
144  Real limit_;
145  Real t_;
146 };
147 
149 
152 {
153  public:
154 
155  FermiHighPassFilter(Real limit=1.0, Real t=1.0):
156  ConstModIPAlgorithm("FermiLowPassFilter"),
157  limit_(1.0/limit),
158  t_(-1.0/t)
159  {if(limit_==0.0)throw("Invalid limit");if(t_==0.0)throw("Invalid t");}
160 
161  virtual void Visit(ImageHandle& ih) const ;
162 
163  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
164  Real GetLimit() {return 1.0/limit_;}
165 
166  void SetT(Real t) {if(t_==0.0)throw("Invalid t");t_=-1.0/t;}
167  Real GetT() {return -1.0/t_;}
168 
169  private:
170 
171  Real limit_;
172  Real t_;
173 };
174 
176 
179 {
180  public:
181 
183  ConstModIPAlgorithm("ButterworthLowPassFilter"),
184  limit_(1.0/limit),
185  stop_(1.0/stop),
186  eps_(0.882),
187  a_(10.624)
188  {if(limit_==0.0)throw("Invalid limit");if(stop==0.0)throw("Invalid stop");}
189 
190  virtual void Visit(ImageHandle& ih) const ;
191 
192  void SetLimit(Real limit) {if(limit_==0.0)throw("Invalid limit");limit_=1.0/limit;}
193  Real GetLimit() {return 1.0/limit_;}
194 
195  void SetStop(Real stop) {if(stop==0.0)throw("Invalid stop");stop_=1.0/stop;}
196  Real GetStop() {return 1.0/stop_;}
197 
198  void SetEps(Real eps) {eps_=eps;}
199  Real GetEps() {return eps_;}
200 
201  void SetA(Real a) {a_=a;}
202  Real GetA() {return a_;}
203 
204  private:
205 
206  Real limit_;
207  Real stop_;
208  Real eps_;
209  Real a_;
210 };
211 
213 
216 {
217 public:
220 
221 };
222 
223 }}} //ns
224 
225 #endif // IPLT_ALG_FILTER_FOURIER_FILTERS_H
226 
FermiLowPassFilter(Real limit=1.0, Real t=1.0)
ButterworthLowPassFilter(Real limit=1.0, Real stop=1.0)
float Real
Definition: base.hh:44
ButterworthHighPassFilter(Real limit=1.0, Real stop=1.0)
Butterworth Low Pass Filter.
#define DLLEXPORT_IMG_ALG
In-place modification const algorithm.
FermiHighPassFilter(Real limit=1.0, Real t=1.0)
Manage shared instances of images.
Butterworth High Pass Filter.