IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
KernelXY.h
1 // KernelXY.h:
3 // -----------
4 //
15 
16 #ifndef __IPSDKBASEDATA_KERNELXY_H__
17 #define __IPSDKBASEDATA_KERNELXY_H__
18 
19 // suppression warnings
20 // warning C4251: 'ipsdk::KernelXY::_dataColl' : class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'ipsdk::KernelXY'
21 #pragma warning (push)
22 #pragma warning (disable : 4251)
23 
24 #include <IPSDKBaseData/Pattern/Kernel/BaseKernel.h>
25 #include <map>
26 
27 namespace ipsdk {
28 
29 class OffsetXY;
30 
33 
35 {
36  // declare serial class
38 
39 // predefined public types
40 public:
43 
46 
48  typedef std::map<OffsetType, ValueType> DataColl;
49 
50 public:
53  KernelXY();
54  ~KernelXY();
56 
57 // methods
58 public:
60  eKernelType getKernelType() const;
61 
63  ipUInt32 getNbData() const;
64 
66  bool exists(const OffsetType& offset) const;
67 
71  void insert(const OffsetType& offset,
72  const ValueType& value);
73 
77  void replace(const OffsetType& offset,
78  const ValueType& value);
79 
83  void remove(const OffsetType& offset);
84 
86  void multiply(const ValueType value);
87 
91  ValueType getValue(const OffsetType& offset) const;
92 
94  const DataColl& getDataColl() const;
95 
98  const ipUInt32 getSizeX() const;
99  const ipUInt32 getSizeY() const;
101 
104  const ipInt32 getMinX() const;
105  const ipInt32 getMinY() const;
107 
110  const ipInt32 getMaxX() const;
111  const ipInt32 getMaxY() const;
113 
117  const ipUInt32 getStartingSizeX() const;
118  const ipUInt32 getStartingSizeY() const;
120 
124  const ipUInt32 getEndingSizeX() const;
125  const ipUInt32 getEndingSizeY() const;
127 
129  const ValueType getCoefSum() const;
131 
133  const ValueType getCoefAbsSum() const;
134 
136  void clear();
137 
138 // methods
139 protected:
140  const ValueType computeAbsCoefSum();
141 
142 // attributes
143 protected:
146 
152 
158 
161  ValueType _absCoefSum;
162 };
163 
166 
167 inline eKernelType
169 {
170  return eKernelType::eKT_XY;
171 }
172 
173 inline const ipUInt32
175 {
176  return _sizeX;
177 }
178 
179 inline const ipUInt32
181 {
182  return _sizeY;
183 }
184 
185 inline const ipInt32
187 {
188  return _minX;
189 }
190 
191 inline const ipInt32
193 {
194  return _minY;
195 }
196 
197 inline const ipInt32
199 {
200  if (_sizeX != 0)
201  return _minX + static_cast<ipInt32>(_sizeX-1);
202  else
203  return 0;
204 }
205 
206 inline const ipInt32
208 {
209  if (_sizeY != 0)
210  return _minY + static_cast<ipInt32>(_sizeY-1);
211  else
212  return 0;
213 }
214 
215 inline const ipUInt32
217 {
218  if (_minX < 0)
219  return static_cast<ipUInt32>(-_minX);
220  else
221  return 0;
222 }
223 
224 inline const ipUInt32
226 {
227  if (_minY < 0)
228  return static_cast<ipUInt32>(-_minY);
229  else
230  return 0;
231 }
232 
233 inline const ipUInt32
235 {
236  ipInt32 maxX = getMaxX();
237  if (maxX > 0)
238  return maxX;
239  else
240  return 0;
241 }
242 
243 inline const ipUInt32
245 {
246  ipInt32 maxY = getMaxY();
247  if (maxY > 0)
248  return maxY;
249  else
250  return 0;
251 }
252 
253 inline const KernelXY::ValueType
255 {
256  return _coefSum;
257 }
258 
259 inline const KernelXY::ValueType
261 {
262  return _absCoefSum;
263 }
264 
267 
268 } // end of namespace ipsdk
269 
270 #pragma warning (pop)
271 
272 #endif // __IPSDKBASEDATA_KERNELXY_H__
#define IPSDK_DECLARE_SERIAL_WITH_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:73
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Class encapsulating a 2d kernel spanning along x and y axis.
Definition: KernelXY.h:34
ValueType _coefSum
sum of kernel coefficients and absolute values of kernel coefficients
Definition: KernelXY.h:160
ipInt32 _minX
Definition: KernelXY.h:149
Class encapsulating a 2d offset along x and y axis.
Definition: OffsetXY.h:26
DataColl _dataColl
collection of data associated to kernel
Definition: KernelXY.h:145
const ipUInt32 getSizeY() const
retrieve kernel size along x and y axis
Definition: KernelXY.h:180
int32_t ipInt32
Base types definition.
Definition: BaseTypes.h:52
const ipUInt32 getStartingSizeY() const
retrieve starting size for kernel along x and y axis (absolute value of lower negative offset or 0) ...
Definition: KernelXY.h:225
const ipUInt32 getStartingSizeX() const
retrieve starting size for kernel along x and y axis (absolute value of lower negative offset or 0) ...
Definition: KernelXY.h:216
const ipUInt32 getEndingSizeY() const
retrieve ending size for kernel along x and y axis (upper positive offset or 0)
Definition: KernelXY.h:244
eKernelType
Enumerate describing kernel type.
Definition: KernelTypes.h:34
2d kernel type spanning x and y direction
Definition: KernelTypes.h:36
ipInt32 _minY
Definition: KernelXY.h:150
ipUInt32 _sizeX
Definition: KernelXY.h:155
const ipUInt32 getEndingSizeX() const
retrieve ending size for kernel along x and y axis (upper positive offset or 0)
Definition: KernelXY.h:234
std::map< OffsetType, ValueType > DataColl
collection of offsets associated to values
Definition: KernelXY.h:48
ipUInt32 _sizeY
Definition: KernelXY.h:156
const ipInt32 getMaxX() const
retrieve kernel maximum offsets along x and y axis
Definition: KernelXY.h:198
const ipInt32 getMinX() const
retrieve kernel minimum offsets along x and y axis
Definition: KernelXY.h:186
eKernelType getKernelType() const
retrieve kernel type associated to object
Definition: KernelXY.h:168
const ipInt32 getMinY() const
retrieve kernel minimum offsets along x and y axis
Definition: KernelXY.h:192
ipReal32 ValueType
value type associated to object
Definition: KernelXY.h:45
const ipUInt32 getSizeX() const
retrieve kernel size along x and y axis
Definition: KernelXY.h:174
const ValueType getCoefSum() const
retrieve sum of coefficients associated to kernel
Definition: KernelXY.h:254
Base class for kernel objects.
Definition: BaseKernel.h:29
#define IPSDKBASEDATA_API
Import/Export macro for library IPSDKUtil.
Definition: IPSDKBaseDataExports.h:27
const ValueType getCoefAbsSum() const
retrieve sum of absolute values of coefficients associated to kernel
Definition: KernelXY.h:260
OffsetXY OffsetType
offset type associated to object
Definition: KernelXY.h:42
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
const ipInt32 getMaxY() const
retrieve kernel maximum offsets along x and y axis
Definition: KernelXY.h:207
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53