IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
KernelXYZ.h
1 // KernelXYZ.h:
3 // ------------
4 //
15 
16 #ifndef __IPSDKBASEDATA_KERNELXYZ_H__
17 #define __IPSDKBASEDATA_KERNELXYZ_H__
18 
19 // suppression warnings
20 // warning C4251: 'ipsdk::KernelXYZ::_dataColl' : class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'ipsdk::KernelXYZ'
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 OffsetXYZ;
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  KernelXYZ();
54  ~KernelXYZ();
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;
100  const ipUInt32 getSizeZ() const;
102 
105  const ipInt32 getMinX() const;
106  const ipInt32 getMinY() const;
107  const ipInt32 getMinZ() const;
109 
112  const ipInt32 getMaxX() const;
113  const ipInt32 getMaxY() const;
114  const ipInt32 getMaxZ() const;
116 
120  const ipUInt32 getStartingSizeX() const;
121  const ipUInt32 getStartingSizeY() const;
122  const ipUInt32 getStartingSizeZ() const;
124 
128  const ipUInt32 getEndingSizeX() const;
129  const ipUInt32 getEndingSizeY() const;
130  const ipUInt32 getEndingSizeZ() const;
132 
134  const ValueType getCoefSum() const;
136 
138  const ValueType getCoefAbsSum() const;
139 
140  // methods
141 protected:
142  const ValueType computeAbsCoefSum();
143 
145  void clear();
146 
147 // attributes
148 protected:
151 
158 
165 
168  ValueType _absCoefSum;
169 };
170 
173 
174 inline eKernelType
176 {
177  return eKernelType::eKT_XYZ;
178 }
179 
180 inline const ipUInt32
182 {
183  return _sizeX;
184 }
185 
186 inline const ipUInt32
188 {
189  return _sizeY;
190 }
191 
192 inline const ipUInt32
194 {
195  return _sizeZ;
196 }
197 
198 inline const ipInt32
200 {
201  return _minX;
202 }
203 
204 inline const ipInt32
206 {
207  return _minY;
208 }
209 
210 inline const ipInt32
212 {
213  return _minZ;
214 }
215 
216 inline const ipInt32
218 {
219  if (_sizeX != 0)
220  return _minX + static_cast<ipInt32>(_sizeX-1);
221  else
222  return 0;
223 }
224 
225 inline const ipInt32
227 {
228  if (_sizeY != 0)
229  return _minY + static_cast<ipInt32>(_sizeY-1);
230  else
231  return 0;
232 }
233 
234 inline const ipInt32
236 {
237  if (_sizeZ != 0)
238  return _minZ + static_cast<ipInt32>(_sizeZ-1);
239  else
240  return 0;
241 }
242 
243 inline const ipUInt32
245 {
246  if (_minX < 0)
247  return static_cast<ipUInt32>(-_minX);
248  else
249  return 0;
250 }
251 
252 inline const ipUInt32
254 {
255  if (_minY < 0)
256  return static_cast<ipUInt32>(-_minY);
257  else
258  return 0;
259 }
260 
261 inline const ipUInt32
263 {
264  if (_minZ < 0)
265  return static_cast<ipUInt32>(-_minZ);
266  else
267  return 0;
268 }
269 
270 inline const ipUInt32
272 {
273  ipInt32 maxX = getMaxX();
274  if (maxX > 0)
275  return maxX;
276  else
277  return 0;
278 }
279 
280 inline const ipUInt32
282 {
283  ipInt32 maxY = getMaxY();
284  if (maxY > 0)
285  return maxY;
286  else
287  return 0;
288 }
289 
290 inline const ipUInt32
292 {
293  ipInt32 maxZ = getMaxZ();
294  if (maxZ > 0)
295  return maxZ;
296  else
297  return 0;
298 }
299 
300 inline const KernelXYZ::ValueType
302 {
303  return _coefSum;
304 }
305 
306 inline const KernelXYZ::ValueType
308 {
309  return _absCoefSum;
310 }
311 
314 
315 } // end of namespace ipsdk
316 
317 #pragma warning (pop)
318 
319 #endif // __IPSDKBASEDATA_KERNELXYZ_H__
#define IPSDK_DECLARE_SERIAL_WITH_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:73
const ipUInt32 getEndingSizeY() const
retrieve ending size for kernel along x, y and z axis (upper positive offset or 0) ...
Definition: KernelXYZ.h:281
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
ipReal32 ValueType
value type associated to object
Definition: KernelXYZ.h:45
const ipUInt32 getEndingSizeZ() const
retrieve ending size for kernel along x, y and z axis (upper positive offset or 0) ...
Definition: KernelXYZ.h:291
const ipUInt32 getStartingSizeX() const
retrieve starting size for kernel along x, y and z axis (absolute value of lower negative offset or 0...
Definition: KernelXYZ.h:244
eKernelType getKernelType() const
retrieve kernel type associated to object
Definition: KernelXYZ.h:175
const ipInt32 getMinY() const
retrieve kernel minimum offsets along x, y and z axis
Definition: KernelXYZ.h:205
std::map< OffsetType, ValueType > DataColl
collection of offsets associated to values
Definition: KernelXYZ.h:48
const ipInt32 getMaxY() const
retrieve kernel maximum offsets along x, y and z axis
Definition: KernelXYZ.h:226
const ValueType getCoefAbsSum() const
retrieve sum of absolute values of coefficients associated to kernel
Definition: KernelXYZ.h:307
int32_t ipInt32
Base types definition.
Definition: BaseTypes.h:52
OffsetXYZ OffsetType
offset type associated to object
Definition: KernelXYZ.h:42
const ipInt32 getMinX() const
retrieve kernel minimum offsets along x, y and z axis
Definition: KernelXYZ.h:199
eKernelType
Enumerate describing kernel type.
Definition: KernelTypes.h:34
const ipUInt32 getStartingSizeZ() const
retrieve starting size for kernel along x, y and z axis (absolute value of lower negative offset or 0...
Definition: KernelXYZ.h:262
3d kernel type spanning x, y and z direction
Definition: KernelTypes.h:38
const ipUInt32 getSizeY() const
retrieve kernel size along x, y and z axis
Definition: KernelXYZ.h:187
ipUInt32 _sizeZ
Definition: KernelXYZ.h:163
ipUInt32 _sizeX
Definition: KernelXYZ.h:161
ValueType _coefSum
sum of kernel coefficients and absolute values of kernel coefficients
Definition: KernelXYZ.h:167
ipInt32 _minX
Definition: KernelXYZ.h:154
const ipUInt32 getSizeZ() const
retrieve kernel size along x, y and z axis
Definition: KernelXYZ.h:193
DataColl _dataColl
collection of data associated to kernel
Definition: KernelXYZ.h:150
Class encapsulating a 3d offset along x, y and z axis.
Definition: OffsetXYZ.h:26
const ipUInt32 getStartingSizeY() const
retrieve starting size for kernel along x, y and z axis (absolute value of lower negative offset or 0...
Definition: KernelXYZ.h:253
const ipInt32 getMaxX() const
retrieve kernel maximum offsets along x, y and z axis
Definition: KernelXYZ.h:217
ipInt32 _minY
Definition: KernelXYZ.h:155
const ipInt32 getMinZ() const
retrieve kernel minimum offsets along x, y and z axis
Definition: KernelXYZ.h:211
ipInt32 _minZ
Definition: KernelXYZ.h:156
const ipUInt32 getSizeX() const
retrieve kernel size along x, y and z axis
Definition: KernelXYZ.h:181
const ipUInt32 getEndingSizeX() const
retrieve ending size for kernel along x, y and z axis (upper positive offset or 0) ...
Definition: KernelXYZ.h:271
const ValueType getCoefSum() const
retrieve sum of coefficients associated to kernel
Definition: KernelXYZ.h:301
Base class for kernel objects.
Definition: BaseKernel.h:29
#define IPSDKBASEDATA_API
Import/Export macro for library IPSDKUtil.
Definition: IPSDKBaseDataExports.h:27
ipUInt32 _sizeY
Definition: KernelXYZ.h:162
const ipInt32 getMaxZ() const
retrieve kernel maximum offsets along x, y and z axis
Definition: KernelXYZ.h:235
Class encapsulating a 3d kernel spanning along x, y and z axis.
Definition: KernelXYZ.h:34
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53