aimsalgo 6.0.0
Neuroimaging image processing
filteringfunction_linear.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
35#ifndef AIMS_SIGNALFILTER_FILTERINGFUNCTION_LINEAR_H
36#define AIMS_SIGNALFILTER_FILTERINGFUNCTION_LINEAR_H
37
38//--- aims -------------------------------------------------------------------
39#include <aims/signalfilter/filteringfunction.h> // aims::FilteringFunction
40//--- cartodata --------------------------------------------------------------
41#include <cartodata/volume/volume.h>
42//--- std --------------------------------------------------------------------
43#include <set>
44#include <string>
45#include <map>
46#include <vector>
47//--- forward declarations ---------------------------------------------------
48namespace carto {
49 class Object;
50 Object none();
51}
52namespace aims {
54 namespace strel {
55 StructuringElementRef none();
56 }
57}
58//----------------------------------------------------------------------------
59
60namespace aims {
61
62 //==========================================================================
63 // LINEAR FILTERING FUNCTON
64 //==========================================================================
69 template <typename T>
71 {
72 public:
74 //----------------------------------------------------------------------
75 // interface
76 //----------------------------------------------------------------------
79 virtual T execute( const carto::VolumeRef<T> & in ) const = 0;
83 virtual const std::vector<int> & getAmplitude() const = 0;
85 virtual LinearFilteringFunction<T> *clone() const = 0;
86
87 protected:
88 //----------------------------------------------------------------------
89 // magic 3
90 //----------------------------------------------------------------------
94 };
95
96 //==========================================================================
97 // LINEAR FILTERING FUNCTIONS: FACTORY
98 //==========================================================================
99 template <typename T>
101 {
102 public:
103 static LinearFilteringFunction<T> * create( const std::string & name,
104 carto::Object options = carto::none() );
105 static void registerFunction( const std::string & name,
106 const LinearFilteringFunction<T> & func );
107 static std::set<std::string> names();
108 protected:
109 static void init();
110 static std::map<std::string,carto::rc_ptr<LinearFilteringFunction<T> > > & _map();
111 };
112
113} // namespace aims
114
115
116//============================================================================
117// LINEAR FILTERING FUNCTIONS: DERIVED CLASSES
118//============================================================================
119#define AIMS_DECLARE_LINFILTERUNC_CUSTOMIZED( NAME ) \
120 template <typename T> \
121 class NAME: public LinearFilteringFunction<T> \
122 { \
123 public: \
124 NAME( carto::Object options = carto::none() ) \
125 { setOptions( options ); } \
126 NAME( const NAME<T> & other ); \
127 NAME<T> & operator=( const NAME<T> & ); \
128 virtual ~NAME(); \
129 virtual NAME<T> *clone() const { return new NAME<T>(*this); } \
130 virtual void setOptions( const carto::Object & options ); \
131 virtual void updateOptions( const carto::Object & options ); \
132 const std::vector<int> & getAmplitude() const; \
133 virtual T execute( const carto::VolumeRef<T> & in ) const;
134
135#define AIMS_DECLARE_LINFILTERFUNC_BASIC( NAME ) \
136 AIMS_DECLARE_LINFILTERUNC_CUSTOMIZED(NAME) \
137 }; \
138 template <typename T> \
139 NAME<T>::NAME( const NAME<T> & other ) {} \
140 template <typename T> \
141 NAME<T>::~NAME() {} \
142 template <typename T> \
143 NAME<T> & NAME<T>::operator=( const NAME<T> & other ) {}
144
145
146namespace aims
147{
149 protected:
150 void setKernel();
151 double _sigma;
152 double _theta;
153 double _lambda;
154 double _psi;
155 double _gamma;
156 bool _real;
157 int _nstd;
158 bool _init;
159 std::vector<int> _amplitude;
160 std::vector<float> _voxelsize;
162 };
163} // namespace aims
164
165#endif
static std::map< std::string, carto::rc_ptr< LinearFilteringFunction< T > > > & _map()
static LinearFilteringFunction< T > * create(const std::string &name, carto::Object options=carto::none())
static void registerFunction(const std::string &name, const LinearFilteringFunction< T > &func)
Base class for linear filtering functions.
virtual T execute(const carto::VolumeRef< T > &in) const =0
virtual const std::vector< int > & getAmplitude() const =0
Return a vector fo size 6 describing the border needed in each direction (x-, x+, y-,...
LinearFilteringFunction(const LinearFilteringFunction< T > &)
virtual LinearFilteringFunction< T > * clone() const =0
clone
LinearFilteringFunction< T > & operator=(const LinearFilteringFunction< T > &)
#define AIMS_DECLARE_LINFILTERUNC_CUSTOMIZED(NAME)
StructuringElementRef none()
std::vector< int > _amplitude
void setKernel()
carto::VolumeRef< double > _kernel
std::vector< float > _voxelsize
Object none()