IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BaseGridPartition.h
1 // BaseGridPartition.h:
3 // --------------------
4 //
15 
16 #ifndef __IPSDKMATH_BASEGRIDPARTITION_H__
17 #define __IPSDKMATH_BASEGRIDPARTITION_H__
18 
19 // suppression warnings
20 // warning C4251: 'ipsdk::math::BaseGridPartition::_bucketHistogram': class 'std::map<ipsdk::ipReal64,ipsdk::math::BaseGridPartition::DataIds,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' needs to have dll-interface to be used by clients of class 'ipsdk::math::BaseGridPartition'
21 #pragma warning (push)
22 #pragma warning (disable : 4251)
23 
24 #include <IPSDKMath/Estimation/DataPartition/BaseDataPartition.h>
25 #include <vector>
26 #include <map>
27 
28 namespace ipsdk {
29 namespace math {
30 
33 
35 {
36  // declare serial class
38 
39 public:
43  virtual ~BaseGridPartition() = 0;
45 
46 // methods
47 public:
54  void setNbBucketsByAxis(const ipUInt32 nbBucketsByAxis);
55 
57  ipUInt32 getNbBucketsByAxis() const;
58 
59 protected:
62  BoolResult initDerived(const DataSet& fullDataSet,
63  const ipUInt32 subSetRequestedSize);
64 
66  void clearDerived();
67 
69  Indexes randomSubSet(const ipUInt32 subSetRequestedSize);
70 
72  typedef std::vector<ipUInt32> BucketId;
73 
74  // collection of data indexes
75  typedef std::vector<ipUInt32> DataIdColl;
76 
78  typedef std::map<BucketId, DataIdColl> BucketPopulation;
79 
82  virtual BoolResult populateBuckets(const DataSet& fullDataSet,
83  BucketPopulation& bucketPopulation) = 0;
84 
85 // attributes
86 private:
88  ipUInt32 _nbBucketsByAxis;
89 
91  typedef std::map<ipReal64, DataIdColl> BucketHistogram;
92 
94  BucketHistogram _bucketHistogram;
95 };
96 
99 
100 inline ipUInt32
102 {
103  return _nbBucketsByAxis;
104 }
105 
108 
109 } // end of namespace math
110 } // end of namespace ipsdk
111 
112 #pragma warning (pop)
113 
114 #endif // __IPSDKMATH_BASEGRIDPARTITION_H__
std::vector< ipUInt32 > BucketId
id for a bucket of data
Definition: BaseGridPartition.h:72
ipUInt32 getNbBucketsByAxis() const
retrieve number of buckets by axis
Definition: BaseGridPartition.h:101
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
std::vector< DataType > DataSet
collection of data associated to estimation
Definition: EstimationTypes.h:67
#define IPSDK_DECLARE_ABSTRACT_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on abstract class
Definition: SerializationHdrMacro.h:97
#define IPSDKMATH_API
Import/Export macro for library IPSDKMath.
Definition: IPSDKMathExports.h:27
Base class for object allowing to create data partition based on grid.
Definition: BaseGridPartition.h:34
std::map< BucketId, DataIdColl > BucketPopulation
map associating a bucket if to a collection of data ids
Definition: BaseGridPartition.h:78
Base class for data partitioning.
Definition: BaseDataPartition.h:35
std::set< ipUInt32 > Indexes
collection of unique indexes
Definition: BaseDataPartition.h:87
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53