Image Component Library (ICL)
ConvolutionKernel.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLFilter/src/ICLFilter/ConvolutionKernel.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Size.h>
35 #include <ICLUtils/Exception.h>
36 
37 
38 namespace icl{
39  namespace filter{
41 
48 
50 
118  enum fixedType {
119  gauss3x3=0,
120  gauss5x5=10,
121  sobelX3x3=1,
122  sobelX5x5=11,
123  sobelY3x3=2,
124  sobelY5x5=12,
125  laplace3x3=3,
126  laplace5x5=13,
128  };
129 
132 
134 
135  ConvolutionKernel(const ConvolutionKernel &other);
136 
138 
144  ConvolutionKernel(int *data, const utils::Size &size,int factor=1, bool deepCopy=true) ;
145 
147  ConvolutionKernel(float *data, const utils::Size &size, bool deepCopy=true) ;
148 
150  ConvolutionKernel(fixedType t, bool useFloats=false);
151 
154 
156 
157  ConvolutionKernel &operator=(const ConvolutionKernel &other);
158 
160  void toFloat();
161 
163 
164  void toInt(bool force=false);
165 
167  inline int getDim() const { return size.getDim(); }
168 
170  inline const utils::Size &getSize() const { return size; }
171 
173  inline int getWidth() const { return size.width; }
174 
176  inline int getHeight() const { return size.height; }
177 
179  inline bool isFloat() const { return !!fdata; }
180 
182  inline const float *getFloatData() const { return fdata; }
183 
185  inline float *getFloatData() { return fdata; }
186 
188  inline const int *getIntData() const { return idata; }
189 
191  inline int *getIntData() { return idata; }
192 
194  inline int getFactor() const { return factor; }
195 
197  inline bool isNull() const { return isnull; }
198 
200  inline fixedType getFixedType() const { return ft; }
201 
203  void detach();
204 
205  private:
207  float *fdata;
208  int *idata;
209  int factor;
210  bool isnull;
211  bool owned;
213  };
214  } // namespace filter
215 }
216 
fixedType getFixedType() const
returns the kernels fixed type (necessary for IPP-optimization)
Definition: ConvolutionKernel.h:200
Definition: ConvolutionKernel.h:127
undocument this line if you encounter any issues!
Definition: Any.h:37
utils::Size size
associated size
Definition: ConvolutionKernel.h:206
bool isFloat() const
returns whether this kernel has float data
Definition: ConvolutionKernel.h:179
float * fdata
float data pointer
Definition: ConvolutionKernel.h:207
int * idata
int data pointer
Definition: ConvolutionKernel.h:208
bool owned
is data owned
Definition: ConvolutionKernel.h:211
int factor
scaling factor for integer kernels
Definition: ConvolutionKernel.h:209
int getHeight() const
returns the kernels height
Definition: ConvolutionKernel.h:176
int getFactor() const
returns the kernels scaling factor (only used if its an integer kernel)
Definition: ConvolutionKernel.h:194
float * getFloatData()
returns the kernels float data pointer (which may be 0)
Definition: ConvolutionKernel.h:185
int getWidth() const
returns the kernels width
Definition: ConvolutionKernel.h:173
ICLQt_API ImgROI data(ImgQ &r)
creates full ROI ROI-struct
int getDim() const
returns kernels width * height
Definition: ConvolutionKernel.h:167
const float * getFloatData() const
returns the kernels float data pointer (const) (which may be 0)
Definition: ConvolutionKernel.h:182
Utility struct for managing convolution kernel data.
Definition: ConvolutionKernel.h:47
fixedType
this enum contains several predefined convolution kernel types
Definition: ConvolutionKernel.h:118
Size class of the ICL.
Definition: Size.h:61
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
bool isnull
is already initialized
Definition: ConvolutionKernel.h:210
#define ICLFilter_API
Definition: CompatMacros.h:175
const utils::Size & getSize() const
returns the kernels size
Definition: ConvolutionKernel.h:170
bool isNull() const
return whether idata or fdata is not null
Definition: ConvolutionKernel.h:197
fixedType ft
fixed type set
Definition: ConvolutionKernel.h:212
int * getIntData()
returns the kernels int data pointer (which may be 0)
Definition: ConvolutionKernel.h:191
const int * getIntData() const
returns the kernels int data pointer (const) (which may be 0)
Definition: ConvolutionKernel.h:188