CDifferenceBitmapSupplierComp.h
Go to the documentation of this file.
1 #ifndef iipr_CDifferenceBitmapSupplierComp_included
2 #define iipr_CDifferenceBitmapSupplierComp_included
3 
4 
5 // ACF includes
7 #include <iproc/IProcessor.h>
9 
10 // ACF-Solutions includes
11 #include <iimg/IBitmapProvider.h>
13 
14 
15 namespace iipr
16 {
17 
18 
23  public iinsp::TSupplierCompWrap< QPair<i2d::ICalibration2d*, istd::TDelPtr<iimg::IBitmap> > >,
24  virtual public iimg::IBitmapProvider,
25  virtual public i2d::ICalibrationProvider
26 {
27 public:
29 
30  I_BEGIN_COMPONENT(CDifferenceBitmapSupplierComp);
31  I_REGISTER_SUBELEMENT(OffsetContraints);
32  I_REGISTER_SUBELEMENT_INTERFACE(OffsetContraints, imeas::INumericConstraints, ExtractOffsetContraints);
33  I_REGISTER_SUBELEMENT_INTERFACE(OffsetContraints, istd::IChangeable, ExtractOffsetContraints);
34  I_REGISTER_INTERFACE(iimg::IBitmapProvider);
35  I_REGISTER_INTERFACE(i2d::ICalibrationProvider);
36  I_ASSIGN(m_bitmapCompFact, "BitmapFactory", "Use to create bitmap object", true, "BitmapFactory");
37  I_ASSIGN(m_firstBitmapProviderCompPtr, "FirstBitmapSupplier", "Provide fist input image", true, "FirstBitmapSupplier");
38  I_ASSIGN_TO(m_firstBitmapSupplierCompPtr, m_firstBitmapProviderCompPtr, false);
39  I_ASSIGN_TO(m_firstBitmapProviderModelCompPtr, m_firstBitmapProviderCompPtr, false);
40  I_ASSIGN(m_secondBitmapProviderCompPtr, "SecondBitmapSupplier", "Provide second input image", true, "SecondBitmapSupplier");
41  I_ASSIGN_TO(m_secondBitmapSupplierCompPtr, m_secondBitmapProviderCompPtr, false);
42  I_ASSIGN_TO(m_secondBitmapProviderModelCompPtr, m_secondBitmapProviderCompPtr, false);
43  I_ASSIGN(m_offsetParamIdAttrPtr, "OffsetParamId", "ID of offset value added to each pixel by difference calculation (imeas::INumericValue)", false, "Threshold");
44  I_ASSIGN(m_defaultOffsetCompPtr, "DefaultOffset", "Offset value used if not specified in parameters", false, "DefaultThreshold");
45  I_END_COMPONENT;
46 
48 
49  // reimplemented (iimg::IBitmapProvider)
50  virtual const iimg::IBitmap* GetBitmap() const;
51 
52  // reimplemented (i2d::ICalibrationProvider)
53  virtual const i2d::ICalibration2d* GetCalibration() const;
54 
55 protected:
56  bool EnsureBitmapCreated(ProductType& result) const;
57 
58  // reimplemented (iinsp::TSupplierCompWrap)
59  virtual int ProduceObject(ProductType& result) const;
60 
61  // reimplemented (icomp::CComponentBase)
62  virtual void OnComponentCreated();
63 
64 private:
65  I_FACT(iimg::IBitmap, m_bitmapCompFact);
66 
67  I_REF(iimg::IBitmapProvider, m_firstBitmapProviderCompPtr);
68  I_REF(iinsp::ISupplier, m_firstBitmapSupplierCompPtr);
69  I_REF(imod::IModel, m_firstBitmapProviderModelCompPtr);
70 
71  I_REF(iimg::IBitmapProvider, m_secondBitmapProviderCompPtr);
72  I_REF(iinsp::ISupplier, m_secondBitmapSupplierCompPtr);
73  I_REF(imod::IModel, m_secondBitmapProviderModelCompPtr);
74 
75  I_ATTR(QByteArray, m_offsetParamIdAttrPtr);
76  I_REF(imeas::INumericValue, m_defaultOffsetCompPtr);
77 
78  // static template methods for subelement access
79  template <class InterfaceType>
80  static InterfaceType* ExtractOffsetContraints(CDifferenceBitmapSupplierComp& component)
81  {
82  return &component.m_offsetContraints;
83  }
84 
85  imeas::CGeneralNumericConstraints m_offsetContraints;
86 };
87 
88 
89 } // namespace iipr
90 
91 
92 #endif // !iipr_CDifferenceBitmapSupplierComp_included
93 
94 
Supplier of bitmap built on difference of two images.
virtual const i2d::ICalibration2d * GetCalibration() const
iinsp::TSupplierCompWrap< QPair< i2d::ICalibration2d *, istd::TDelPtr< iimg::IBitmap > > > BaseClass
Standard implementation of interface iinsp::ISupplier with preparation for component implementation...
Describe additional meta information for set of numeric values.
bool EnsureBitmapCreated(ProductType &result) const
virtual const iimg::IBitmap * GetBitmap() const
General parameter set containing list of numeric values.
Definition: INumericValue.h:20
virtual int ProduceObject(ProductType &result) const
Produce single object.
Base interface for suppliers providing calculating of objects on demand ("pull data" model)...
Definition: ISupplier.h:22
QPair< i2d::ICalibration2d *, istd::TDelPtr< iimg::IBitmap > > ProductType
Simple implementation of imeas::INumericConstraints interface.

© 2007-2017 Witold Gantzke and Kirill Lepskiy