ConvolutionKernel.hpp
1 #ifndef OPALS_CONVOLUTION_KERNEL_HPP_INCLUDED
2 #define OPALS_CONVOLUTION_KERNEL_HPP_INCLUDED
3 
4 #pragma once
5 
6 
7 //OPALS
8 #include "opals/config.hpp"
9 #include "opals/Array.hpp"
10 #include "opals/Path.hpp"
11 #include "opals/Vector.hpp"
12 
13 //boost
14 //#include <boost/numeric/ublas/matrix.hpp>
15 
16 namespace opals {
17 
18  /// Class describing different kernels for convolution filtering
19  class OPALS_API ConvolutionKernel
20  {
21  public:
22  typedef Array<unsigned,2> ArrayU2; ///< size array
23  //typedef boost::numeric::ublas::matrix<float> KMatrix; ///< kernel matrix
24  typedef Vector<float> KMatrix; ///< kernel matrix as vector of floats
25  enum KernelType{
26  average = 0,
27  gaussian,
28  fromFile,
29  userDefined };
30 
31  public:
32 
34 
35  virtual ~ConvolutionKernel();
36 
37  void setType( const unsigned& type ) { _type = (KernelType) type; };
38  unsigned getType() const { return _type; };
39 
40  void setSize( const ArrayU2& size ) { _size = size; };
41  ArrayU2 getSize() const { return _size; };
42 
43  void setKernelMatrix( const KMatrix& kmat ) { _kmatrix = kmat; };
44  KMatrix getKernelMatrix() const;
45 
46  void setImageFilename( const Path& imgfile );
47  opals::Path getImageFilename() const { return _imgfile;};
48 
49  void setParam( const Vector<float>& pars ) { _pars = pars; };
50  Vector<float> getParam() const { return _pars; };
51 
52  protected:
53  KernelType _type;
54  ArrayU2 _size;
55  KMatrix _kmatrix;
56  Path _imgfile;
57  Vector<float> _pars;
58  };
59 }
60 
61 #endif //OPALS_CONVOLUTION_KERNEL_HPP_INCLUDED