| MikroCAD SDK Library

- Home
- All Types
- Files

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DataFilter.h
Go to the documentation of this file.
1 /**
2 * @file DataFilter.h
3 * @brief Filter definitions
4 *
5 * @author LMI Technologies
6 */
7
8 #ifndef _DataFilter_h
9 #define _DataFilter_h
10
11 #include "Windows.h"
12 #include "MeasurementDefs.h"
13 #include "IniFiles.h"
14 #include <vector>
15 #include <string>
16
17 using namespace std;
18
19 /**
20 Data structure - Standard filter
21 */
22 struct TFilterData
23 {
24 MeasurementPreFilterType m_Type; /**< Filter type */
25 long m_lFilterLengthX; /**< Filter length X direction */
26 long m_lFilterLengthY; /**< Filter length Y direction */
27 eMC3DFilterDirection m_Direction; /**< Filter direction */
28
29 TFilterData()
30 {
31 m_Type = MeasurementPreFilterType_None;
32 m_lFilterLengthX = m_lFilterLengthY = 3;
33 m_Direction = MC3DFilterDirection_XY;
34 };
35 TFilterData(MeasurementPreFilterType Type)
36 {
37 Init(Type);
38 };
39
40 virtual void Init(MeasurementPreFilterType Type)
41 {
42 m_Type = Type;
43 m_lFilterLengthX = m_lFilterLengthY = 3;
44 m_Direction = MC3DFilterDirection_XY;
45 };
46
47 virtual void Assign(TFilterData* pFilterData)
48 {
49 if (!pFilterData || pFilterData == this)
50 return;
51
52 m_Type = pFilterData->m_Type;
53 m_lFilterLengthX = pFilterData->m_lFilterLengthX;
54 m_lFilterLengthY = pFilterData->m_lFilterLengthY;
55 m_Direction = pFilterData->m_Direction;
56 };
57
58 virtual bool FromBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
59
60 virtual bool ToBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
61
62 virtual unsigned long GetBufferSize()
63 {
64 return 2 * sizeof(unsigned long)+2 * sizeof(long);
65 };
66
67 virtual bool FromIniFile(CIniFile *pIniFile, wstring stSec, int nIndex);
68
69 virtual bool ToIniFile(CIniFile *pIniFile, wstring stSec, int nIndex);
70
71 virtual bool IsEqual(TFilterData* pFilterData);
72 };
73
74 /**
75 Data structure - Filter "remove invalid"
76 */
77 struct TFilterRemoveInvalidData : public TFilterData
78 {
79 long m_lMaximalRadius; /**< Maximum radius of invalid range (in pixel) */
80 bool m_bUseEdges; /**< Include areas on the edge? */
81 long m_lEnlargeInvalid; /**< Increase invalid area (in pixel) */
82
83 TFilterRemoveInvalidData() : TFilterData()
84 {
85 m_Type = MeasurementPreFilterType_RemoveInvalid;
86 m_lMaximalRadius = 10;
87 m_bUseEdges = false;
88 m_lEnlargeInvalid = 2;
89 m_lFilterLengthX = m_lFilterLengthY = 9;
90 m_Direction = MC3DFilterDirection_X;
91 };
92
93 virtual void Init(MeasurementPreFilterType Type)
94 {
95 TFilterData::Init(Type);
96 m_lMaximalRadius = 10;
97 m_bUseEdges = false;
98 m_lEnlargeInvalid = 2;
99 m_lFilterLengthX = m_lFilterLengthY = 9;
100 m_Direction = MC3DFilterDirection_X;
101 };
102
103 virtual void Assign(TFilterData* pFilterData)
104 {
105 TFilterRemoveInvalidData* pData = dynamic_cast<TFilterRemoveInvalidData*>(pFilterData);
106 if (!pData || pData == this)
107 return;
108
109 m_Type = pData->m_Type;
110 m_lFilterLengthX = pData->m_lFilterLengthX;
111 m_lFilterLengthY = pData->m_lFilterLengthY;
112 m_Direction = pData->m_Direction;
113 m_lMaximalRadius = pData->m_lMaximalRadius;
114 m_bUseEdges = pData->m_bUseEdges;
115 m_lEnlargeInvalid = pData->m_lEnlargeInvalid;
116 };
117
118 virtual bool FromBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
119
120 virtual bool ToBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
121
122 virtual unsigned long GetBufferSize()
123 {
124 return 2 * sizeof(unsigned long)+4 * sizeof(long)+sizeof(bool);
125 };
126
127 virtual bool FromIniFile(CIniFile *pIniFile, wstring stSec, int nIndex);
128
129 virtual bool ToIniFile(CIniFile *pIniFile, wstring stSec, int nIndex);
130
131 virtual bool IsEqual(TFilterData* pFilterData);
132 };
133
134 typedef vector<TFilterData*> TFilterDataList;
135
136 /**
137 Data structure for prefilter set for data acquisition
138 */
139 struct TDataAcquPreFilterSetData
140 {
141 TFilterDataList m_pFilterList; /**< Filter list */
142
143 virtual ~TDataAcquPreFilterSetData()
144 {
145 Clear();
146 };
147
148 /**
149 Clears the filter list
150 */
151 void Clear();
152
153 void Assign(TDataAcquPreFilterSetData* pData);
154
155 /**
156 Initialize the filter list
157
158 @param pFilterList Pointer to the filter list
159 @param nNumFilter Filterlist size
160 */
161 void Initialize(TFilterData* pFilterList, int nNumFilter);
162
163 /**
164 Read from buffer
165
166 @param pbyBuffer Pointer to buffer (Pointer will incremented !!!)
167 @param dwCurrBufferSize Current buffer size (will decremented)
168 @return: Success
169 */
170 bool FromBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
171
172 /**
173 Write to buffer
174
175 @param pbyBuffer Pointer to buffer (Pointer will incremented)
176 @param dwCurrBufferSize Current buffer size (will decremented)
177 @return Success
178 */
179 bool ToBuffer(PBYTE& pbyBuffer, DWORD& dwCurrBufferSize);
180
181 /**
182 Returns the buffer size in byte
183
184 @return Buffer size
185 */
186 unsigned long GetBufferSize();
187
188 /**
189 Read settings from INI file
190
191 @param pIniFile Pointer to INI file structure
192 @param stSec Sector
193 @return Success
194 */
195 bool FromIniFile(CIniFile *pIniFile, wstring stSec);
196
197 /**
198 Write settings to INI file
199
200 @param pIniFile Pointer to INI file structure
201 @param stSec Sector
202 @return Success
203 */
204 bool ToIniFile(CIniFile *pIniFile, wstring stSec);
205
206 /**
207 Is equal to an other data set?
208
209 @param pFilterDataSet Pointer to an other data set
210 @return True if equal, otherwise false
211 */
212 bool IsEqual(TDataAcquPreFilterSetData* pFilterDataSet);
213
214 TDataAcquPreFilterSetData& operator =(const TDataAcquPreFilterSetData& Data);
215 };
216
217 #endif // _DataFilter_h
TFilterData::m_Type
MeasurementPreFilterType m_Type
Filter type.
Definition: DataFilter.h:24
MeasurementPreFilterType_None
No type.
Definition: MeasurementDefs.h:244
TDataAcquPreFilterSetData::m_pFilterList
TFilterDataList m_pFilterList
Filter list.
Definition: DataFilter.h:141
MeasurementPreFilterType
MeasurementPreFilterType
Prefilter type.
Definition: MeasurementDefs.h:242
TDataAcquPreFilterSetData
Data structure for prefilter set for data acquisition.
Definition: DataFilter.h:139
TFilterRemoveInvalidData::m_lEnlargeInvalid
long m_lEnlargeInvalid
Increase invalid area (in pixel)
Definition: DataFilter.h:81
TFilterRemoveInvalidData
Data structure - Filter "remove invalid".
Definition: DataFilter.h:77
std
IniFiles.h
Ini File functions.
MeasurementPreFilterType_RemoveInvalid
Remove invalid values.
Definition: MeasurementDefs.h:245
TFilterData::m_lFilterLengthX
long m_lFilterLengthX
Filter length X direction.
Definition: DataFilter.h:25
MeasurementDefs.h
Defines for measurement module for sensors with 1 projector and 1 camera.
CIniFile
Ini file class.
Definition: IniFiles.h:20
TFilterRemoveInvalidData::m_lMaximalRadius
long m_lMaximalRadius
Maximum radius of invalid range (in pixel)
Definition: DataFilter.h:79
TFilterData::m_Direction
eMC3DFilterDirection m_Direction
Filter direction.
Definition: DataFilter.h:27
TFilterData
Data structure - Standard filter.
Definition: DataFilter.h:22
eMC3DFilterDirection
eMC3DFilterDirection
The direction of filter.
Definition: MC3DDefs.h:19
TFilterData::m_lFilterLengthY
long m_lFilterLengthY
Filter length Y direction.
Definition: DataFilter.h:26
TFilterRemoveInvalidData::m_bUseEdges
bool m_bUseEdges
Include areas on the edge?
Definition: DataFilter.h:80