ICF 3.0.5.47
Technical documentation of ICF Libraries
CMorphologicalProcessorComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iipr_CMorphologicalProcessorComp_included
7#define iipr_CMorphologicalProcessorComp_included
8
9
10// ICF includes
12#include <imod/TModelWrap.h>
14
15
16namespace iipr
17{
18
20{
21public:
23
24 I_BEGIN_BASE_COMPONENT(CMorphologicalProcessorAttr);
25 I_ASSIGN(m_erosionEnableAttrPtr, "ErosionEnable", "If this attribute is true then erosion filter is available", false, true);
26 I_ASSIGN(m_dilatationEnableAttrPtr, "DilatationEnable", "If this attribute is true then dilatation filter is available", false, true);
27 I_ASSIGN(m_openingEnableAttrPtr, "OpeningEnable", "If this attribute is true then opening filter is available", false, true);
28 I_ASSIGN(m_closingEnableAttrPtr, "ClosingEnable", "If this attribute is true then closing filter is available", false, true);
29 I_ASSIGN(m_whiteTopEnableAttrPtr, "WhiteTopEnable", "If this attribute is true then white-top filter is available", false, true);
30 I_ASSIGN(m_blackTopEnableAttrPtr, "BlackTopEnable", "If this attribute is true then black-top filter is available", false, true);
31 I_ASSIGN(m_morthoGradientEnableAttrPtr, "MorthoGradientEnable", "If this attribute is true then morthological-gradient filter is available", false, true);
32 I_ASSIGN(m_rectangleFormEnableAttrPtr, "RectangleFormEnable", "If this attribute is true then rectangle filter form is available", false, true);
33 I_ASSIGN(m_circleFormEnableAttrPtr, "CircleFormEnable", "If this attribute is true then circle filter form is available", false, true);
34 I_END_COMPONENT;
35protected:
36 I_ATTR(bool, m_erosionEnableAttrPtr);
37 I_ATTR(bool, m_dilatationEnableAttrPtr);
38 I_ATTR(bool, m_openingEnableAttrPtr);
39 I_ATTR(bool, m_closingEnableAttrPtr);
40 I_ATTR(bool, m_whiteTopEnableAttrPtr);
41 I_ATTR(bool, m_blackTopEnableAttrPtr);
42 I_ATTR(bool, m_morthoGradientEnableAttrPtr);
43 I_ATTR(bool, m_rectangleFormEnableAttrPtr);
44 I_ATTR(bool, m_circleFormEnableAttrPtr);
45};
46
51{
52public:
54
67
75
76 I_BEGIN_COMPONENT(CMorphologicalProcessorComp);
77 I_REGISTER_SUBELEMENT(ProcessingModes);
78 I_REGISTER_SUBELEMENT_INTERFACE(ProcessingModes, istd::IChangeable, ExtractProcessingModes);
79 I_REGISTER_SUBELEMENT_INTERFACE(ProcessingModes, iprm::IOptionsList, ExtractProcessingModes);
80 I_REGISTER_SUBELEMENT(FilterForms);
81 I_REGISTER_SUBELEMENT_INTERFACE(FilterForms, istd::IChangeable, ExtractFilterForms);
82 I_REGISTER_SUBELEMENT_INTERFACE(FilterForms, iprm::IOptionsList, ExtractFilterForms);
83 I_ASSIGN(m_filterSizeParamsIdAttrPtr, "FilterSizeParamsId", "ID of the filter dimension parameter in the processing parameter set", true, "FilterSizeParamsId");
84 I_ASSIGN(m_defaultProcessingModeAttrPtr, "ProcessingMode", "Filter processing mode\n0 - Erosion\n1 - Dilatation\n2 - Opening\n3 - Closing\n4 - White Top Hat\n5 - Black Top Hat\n6 - Morphological Gradient", true, PM_FIRST);
85 I_ASSIGN(m_processingModeIdAttrPtr, "ProcessingModeId", "ID of the the procesing mode parameter in the processing parameter set", false, "ProcessingMode");
86 I_ASSIGN(m_defaultFilterFormTypeAttrPtr, "FilterFormType", "Type of filter form:\n0 - Rectangular([n, m])\n1 - Circular([n, n])", true, 0);
87 I_ASSIGN(m_filterFormTypeIdAttrPtr, "FilterFormTypeParamId", "ID of the filter form type parameter in the processing parameter set", false, "FilterFormType");
88 I_END_COMPONENT;
89
90protected:
91 // reimplemented (CImageRegionProcessorCompBase)
92 virtual bool ProcessImageRegion(
93 const iimg::IBitmap& inputBitmap,
94 const iprm::IParamsSet* paramsPtr,
95 const i2d::IObject2d* aoiPtr,
96 istd::IChangeable* outputPtr) const override;
97
98 // reimplemented (icomp::CComponentBase)
99 void OnComponentCreated() override;
100
101private:
102 ProcessingMode GetProcessingMode(const iprm::IParamsSet* paramsPtr) const;
103 KernelType GetKernelType(const iprm::IParamsSet* paramsPtr) const;
104
105 template <class InterfaceType>
106 static InterfaceType* ExtractProcessingModes(CMorphologicalProcessorComp& component)
107 {
108 return &component.m_processingModes;
109 }
110
111 template <class InterfaceType>
112 static InterfaceType* ExtractFilterForms(CMorphologicalProcessorComp& component)
113 {
114 return &component.m_filterForms;
115 }
116
117private:
118 I_ATTR(QByteArray, m_filterSizeParamsIdAttrPtr);
119 I_ATTR(int, m_defaultProcessingModeAttrPtr);
120 I_ATTR(QByteArray, m_processingModeIdAttrPtr);
121
122 I_ATTR(int, m_defaultFilterFormTypeAttrPtr);
123 I_ATTR(QByteArray, m_filterFormTypeIdAttrPtr);
124
127
128 QMap<int, ProcessingMode> m_processingModeIndexMap;
129 QMap<int, KernelType> m_filterFormIndexMap;
130};
131
132
133} // namespace iipr
134
135
136#endif // !iipr_CMorphologicalProcessorComp_included
137
Common interface for describing the 2D-objects.
Definition IObject2d.h:30
Definition of single plane bitmap.
Definition IBitmap.h:24
Basic implementation for a image region processor.
virtual bool ProcessImageRegion(const iimg::IBitmap &inputBitmap, const iprm::IParamsSet *paramsPtr, const i2d::IObject2d *aoiPtr, istd::IChangeable *outputPtr) const override
Process the defined image region.
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
Constraints of selection from set of possibilities.
Set of general parameters.
Definition IParamsSet.h:29
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy