IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BaseMeasure.h
1 // BaseMeasure.h:
3 // --------------
4 //
14 
15 #ifndef __IPSDKBASESHAPEANALYSIS_BASEMEASURE_H__
16 #define __IPSDKBASESHAPEANALYSIS_BASEMEASURE_H__
17 
18 // suppression warnings
19 // warning C4251: 'boost::enable_shared_from_this<T>::weak_this_' : class 'boost::weak_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::enable_shared_from_this<T>'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
26 #include <IPSDKSerialization/Engine/BaseObjectWithSkeleton.h>
27 #include <IPSDKUtil/Tools/ProcessingResult.h>
28 #include <boost/enable_shared_from_this.hpp>
29 
30 namespace ipsdk {
31 namespace shape {
32 namespace analysis {
33 
36 
38  public boost::enable_shared_from_this<BaseMeasure>
39 {
40  // declare serial class
42 
43  // friend class for protected members access
44  friend class MeasureSet;
45  friend class BaseMeasureInfo;
46 
47 protected:
49  BaseMeasure();
50 
51 public:
53  virtual ~BaseMeasure() = 0;
54 
55 // methods
56 public:
58  bool isInit() const;
59 
63  const BaseMeasureInfo& getMeasureInfo() const;
64 
68  const std::string& getToolTip() const;
69 
73  const std::string& getDefaultName() const;
74 
78  const std::string& getMeasureName() const;
79 
83  bool is2dMode() const;
84 
88  virtual bool isColorMsr() const = 0;
89 
90  //------------------------------------------------
93  //------------------------------------------------
94 
98  eMsrProcessingPolicy getMsrProcessingPolicy() const;
99 
103  bool is2dMsr() const;
104 
108  bool is3dMsr() const;
110 
114  eMsrShapeRequirements getMsrShapeRequirements() const;
115 
119  bool requiresRowIntersections() const;
120 
124  bool requiresBoundaryApproximation() const;
125 
130  const GeometricCalibrationConstPtr& getGeometricCalibration() const;
131 
137  ipReal32 getCalibrationXScale() const;
138  ipReal32 getCalibrationYScale() const;
139  ipReal32 getCalibrationZScale() const;
141 
145  std::string getMsrUnitStr() const;
146 
147  //------------------------------------------------
150  //------------------------------------------------
151 
155  const eMsrProcessingStatus& getMsrProcessingStatus() const;
156 
160  bool hasMsrGlobalInfo() const;
161 
165  const MeasureGlobalInfo& getMsrGlobalInfo() const;
166 
170  ipUInt64 getNbColorPlans() const;
171 
175  ipUInt64 getNbEntities() const;
176 
181  bool isReadyToProcess() const;
182 
186  const BaseMeasureResult& getMeasureResult() const;
188 
189 protected:
191  virtual MeasureResultPtr startProcessingDerived(const ipUInt64 defaultNbColorPlans,
192  const ipUInt64 nbEntities,
193  const bool bForceNbColorPlans,
194  const bool bWithIgnoredFirstElement) = 0;
195 
197  virtual BoolResult validateMsrParams(const DataItemConstPtr& pMeasureParams) const {return true;}
198 
203  const BaseMeasureResult& accessMeasureResult() const;
204  BaseMeasureResult& accessMeasureResult();
206 
210  MeasureConstPtr getDependency(const std::string& dependencyName) const;
211 
213  virtual bool hasColorDependency() const;
214 
217  virtual void endProcessingDerived() {}
218  virtual void endProcessingDerived(const geom::Shape2dConstVector& shape2dColl) {}
219  virtual void endProcessingDerived(const geom::Shape3dConstVector& shape3dColl) {}
221 
224  virtual void copyAdditionalResults(const BaseMeasure& subMeasure) {}
225 
227  virtual void clearProcessingDerived() {}
228 
229 private:
235  void init(const MeasureInfoConstPtr& pMeasureInfo);
236 
241  BoolResult startProcessing(const ipUInt64 nbColorPlans,
242  const ipUInt64 nbEntities);
243 
247  void setMsrGlobalInfo(const MsrGlobalInfoConstPtr& pMsrGlobalInfo);
248 
255  MeasurePtr createSubMeasure(const ipUInt64 subDataStartOffset,
256  const ipUInt64 nbSubData) const;
257  MeasurePtr createSubMeasure(const UInt64Vector& subDataIdxColl) const;
259 
265  void endProcessing(const geom::Shape2dConstVector& shape2dColl);
266 
269  void endProcessing(const geom::Shape3dConstVector& shape3dColl);
270 
274  void clearProcessing();
275 
276 // attributes
277 private:
279  MeasureInfoConstPtr _pMeasureInfo;
280 
282  MeasureColl _dependencyMsrColl;
283 
285  MsrGlobalInfoConstPtr _pMsrGlobalInfo;
286 
288  MeasureResultPtr _pMeasureResult;
289 
291  eMsrProcessingStatus _msrProcessingStatus;
292 };
293 
296 
297 inline bool
299 {
300  return _pMeasureInfo.get() != 0;
301 }
302 
305 
306 } // end of namespace analysis
307 } // end of namespace shape
308 } // end of namespace ipsdk
309 
310 #pragma warning (pop)
311 
312 #endif // __IPSDKBASESHAPEANALYSIS_BASEMEASURE_H__
boost::shared_ptr< const MeasureGlobalInfo > MsrGlobalInfoConstPtr
shared pointer to const measure global information object
Definition: MeasureGlobalInfoTypes.h:35
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
virtual void endProcessingDerived()
end measure processing in derived class
Definition: BaseMeasure.h:217
boost::shared_ptr< BaseMeasure > MeasurePtr
shared pointer to shape measure object
Definition: MeasureTypes.h:65
boost::shared_ptr< const BaseMeasureInfo > MeasureInfoConstPtr
shared pointer to const shape measure information object
Definition: MeasureInfoTypes.h:142
boost::shared_ptr< const BaseDataItem > DataItemConstPtr
shared pointer to const DataItem
Definition: DataItemTypes.h:149
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
boost::shared_ptr< BaseMeasureResult > MeasureResultPtr
shared pointer to MeasureResult
Definition: MeasureResultTypes.h:69
boost::shared_ptr< const BaseMeasure > MeasureConstPtr
shared pointer to const shape measure object
Definition: MeasureTypes.h:82
boost::shared_ptr< const ipsdk::GeometricCalibration > GeometricCalibrationConstPtr
shared pointer to const ipsdk::GeometricCalibration
Definition: GeometricCalibrationTypes.h:31
std::vector< ipUInt64 > UInt64Vector
stl vector collections
Definition: BaseCollections.h:35
Definition of import/export macro for library.
virtual BoolResult validateMsrParams(const DataItemConstPtr &pMeasureParams) const
method allowing to validate measure parameters in derived class
Definition: BaseMeasure.h:197
#define IPSDK_DECLARE_ABSTRACT_SERIAL_WITH_COPY(libraryName, className)
macro enabling serialization on abstract class
Definition: SerializationHdrMacro.h:91
Predefined types for measure results management.
#define IPSDKBASESHAPEANALYSIS_API
Import/Export macro for library IPSDKBaseShapeAnalysis.
Definition: IPSDKBaseShapeAnalysisExports.h:25
Object allowing to agregate a collection of measure.
Definition: MeasureSet.h:38
virtual void clearProcessingDerived()
method allowing to clear processing data in derived class
Definition: BaseMeasure.h:227
eMsrProcessingStatus
Enumerate describing measure processing status.
Definition: MeasureTypes.h:48
Base class for measure results.
Definition: BaseMeasureResult.h:29
eMsrShapeRequirements
Enumerate describing shape data requirement for measure computation.
Definition: MeasureInfoTypes.h:86
eMsrProcessingPolicy
Enumerate describing measure processing policy.
Definition: MeasureInfoTypes.h:42
virtual void endProcessingDerived(const geom::Shape3dConstVector &shape3dColl)
end measure processing in derived class
Definition: BaseMeasure.h:219
bool isInit() const
check for object initialization
Definition: BaseMeasure.h:298
virtual void endProcessingDerived(const geom::Shape2dConstVector &shape2dColl)
end measure processing in derived class
Definition: BaseMeasure.h:218
Base class for serialization object with three serialization modes :
Definition: BaseObjectWithSkeleton.h:33
std::vector< Shape2dConstPtr > Shape2dConstVector
collection of shape 2d const shared pointers
Definition: Shape2dTypes.h:45
virtual void copyAdditionalResults(const BaseMeasure &subMeasure)
copy additionnal results from derived class while creating a sub measure
Definition: BaseMeasure.h:224
Base class for shape analysis measurement informations.
Definition: BaseMeasureInfo.h:39
Predefined types for measures management.
std::map< std::string, MeasurePtr > MeasureColl
collection of shared pointer to shape measure object
Definition: MeasureTypes.h:91
std::vector< Shape3dConstPtr > Shape3dConstVector
collection of const standard shape
Definition: Shape3dTypes.h:43
Base class for shape analysis measurement.
Definition: BaseMeasure.h:37
Predefined types for shape measurement operations global informations.
Definition: MeasureGlobalInfo.h:36
float ipReal32
Base types definition.
Definition: BaseTypes.h:56