aimsalgo 6.0.0
Neuroimaging image processing
movingaveragefilter.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34#ifndef AIMS_SIGNALFILTER_MOVINGAVERAGEFILTER_H
35#define AIMS_SIGNALFILTER_MOVINGAVERAGEFILTER_H
36
37//============================================================================
38//
39// MOVING AVERAGE KERNEL
40//
41//============================================================================
42
44#include <aims/vector/vector.h>
45#include <vector>
46
47namespace aims {
48
61 {
62 public:
63
64 //------------------------------------------------------------------------
66 //------------------------------------------------------------------------
75
76 //------------------------------------------------------------------------
78 //------------------------------------------------------------------------
80 double operator() ( int x ) const;
81 double at( int x ) const;
82 const Point2di & support() const;
84
85 //------------------------------------------------------------------------
87 //------------------------------------------------------------------------
94 void reset( unsigned length = 3,
96 void setLength( unsigned length );
99
100 //------------------------------------------------------------------------
102 //------------------------------------------------------------------------
104 unsigned length() const;
107
108 protected:
112 std::vector<double> _values;
113 };
114
115} // namespace aims
116
117//============================================================================
118//
119// MOVING AVERAGE CASCADE KERNEL
120//
121//============================================================================
122
123#include <aims/vector/vector.h>
124#include <vector>
125
126namespace aims {
127
137 {
138 public:
139 //------------------------------------------------------------------------
141 //------------------------------------------------------------------------
144 MovingAverageCascadeKernel( unsigned length = 3, unsigned n = 2,
150
151 //------------------------------------------------------------------------
153 //------------------------------------------------------------------------
155 double operator() ( int x ) const;
156 double at( int x ) const;
157 const Point2di & support() const;
159
160 //------------------------------------------------------------------------
162 //------------------------------------------------------------------------
170 void reset( unsigned length = 3, unsigned n = 2,
172 void setLength( unsigned length );
173 void setCascade( unsigned n );
176
177 //------------------------------------------------------------------------
179 //------------------------------------------------------------------------
181 unsigned length() const;
182 unsigned cascade() const;
185
186 protected:
187 void setValues( unsigned length, unsigned n, FilterType::Direction symtype );
188 unsigned _n;
190 std::vector<double> _values;
191 };
192
193} // namespace aims
194
195
196//============================================================================
197//
198// MOVING AVERAGE FILTER
199//
200//============================================================================
201
203
204namespace aims {
205
210 class MovingAverageFilter: public ConvolutionFilter<MovingAverageKernel>
211 {
212 public:
213 //------------------------------------------------------------------------
215 //------------------------------------------------------------------------
223
224 //------------------------------------------------------------------------
226 //------------------------------------------------------------------------
228 void setLength( unsigned length );
229 void setLength( const Point4du & length );
232
233 //------------------------------------------------------------------------
235 //------------------------------------------------------------------------
240
241 protected:
242 // Make some inherited functions private
244 };
245
246} // namespace aims
247
248//============================================================================
249//
250// MOVING AVERAGE CASCADE FILTER
251//
252//============================================================================
253
255
256namespace aims {
257
262 class MovingAverageCascadeFilter: public ConvolutionFilter<MovingAverageCascadeKernel>
263 {
264 public:
265 //------------------------------------------------------------------------
267 //------------------------------------------------------------------------
269 MovingAverageCascadeFilter( unsigned length = 3, unsigned n = 2,
279
280 //------------------------------------------------------------------------
282 //------------------------------------------------------------------------
284 void setLength( unsigned length );
285 void setLength( const Point4du & length );
286 void setCascade( unsigned n );
287 void setCascade( const Point4du & n );
290
297
298 protected:
299 // Make some inherited functions private
301 };
302
303} // namespace aims
304
305#endif // AIMS_SIGNALFILTER_MOVINGAVERAGEFILTER_H
void setBasisFunction(const MovingAverageKernel &func)
ConvolutionFilter(const MovingAverageKernel &bfunc)
MovingAverageCascadeFilter(const Point4du &length, const Point4du &n, FilterType::Direction symtype=FilterType::Symmetrical)
void setType(FilterType::Direction symtype)
void setLength(const Point4du &length)
MovingAverageCascadeFilter(const MovingAverageCascadeFilter &other)
MovingAverageCascadeFilter(const Point4du &length, unsigned n=2, FilterType::Direction symtype=FilterType::Symmetrical)
MovingAverageCascadeFilter & operator=(const MovingAverageCascadeFilter &other)
FilterType::Direction type() const
Point4du length() const
Get parameters.
void setCascade(const Point4du &n)
MovingAverageCascadeFilter(unsigned length=3, unsigned n=2, FilterType::Direction symtype=FilterType::Symmetrical)
Constructor / Copy.
void setLength(unsigned length)
Set parameters.
1D Cascade of Moving Average Kernel
unsigned length() const
Get parameters.
FilterType::Direction type() const
void setValues(unsigned length, unsigned n, FilterType::Direction symtype)
const Point2di & support() const
MovingAverageCascadeKernel(const MovingAverageCascadeKernel &other)
double operator()(int x) const
Get value.
void setLength(unsigned length)
void setType(FilterType::Direction symtype)
MovingAverageCascadeKernel & operator=(const MovingAverageCascadeKernel &other)
MovingAverageCascadeKernel(unsigned length=3, unsigned n=2, FilterType::Direction symtype=FilterType::Symmetrical)
Constructor/Destructor/Copy.
void reset(unsigned length=3, unsigned n=2, FilterType::Direction symtype=FilterType::Symmetrical)
Set parameters.
FilterType::Direction type() const
MovingAverageFilter & operator=(const MovingAverageFilter &other)
MovingAverageFilter(const Point4du &length, FilterType::Direction symtype=FilterType::Symmetrical)
void setType(FilterType::Direction symtype)
void setLength(const Point4du &length)
MovingAverageFilter(unsigned length=3, FilterType::Direction symtype=FilterType::Symmetrical)
Constructor / Copy.
MovingAverageFilter(const MovingAverageFilter &other)
void setLength(unsigned length)
Set parameters.
Point4du length() const
Get parameters.
1D Moving Average Kernel
MovingAverageKernel & operator=(const MovingAverageKernel &other)
FilterType::Direction type() const
MovingAverageKernel(const MovingAverageKernel &other)
void reset(unsigned length=3, FilterType::Direction symtype=FilterType::Symmetrical)
Set parameters.
unsigned length() const
Get parameters.
void setLength(unsigned length)
FilterType::Direction _type
void setType(FilterType::Direction symtype)
std::vector< double > _values
MovingAverageKernel(unsigned length=3, FilterType::Direction symtype=FilterType::Symmetrical)
Constructor/Destructor/Copy.
const Point2di & support() const
void setSupport(FilterType::Direction symtype)
double operator()(int x) const
Get value.
double at(int x) const
AimsVector< int32_t, 2 > Point2di
AimsVector< uint32_t, 4 > Point4du