HMetrologyModel.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HMETROLOGYMODEL
  8. #define HCPP_HMETROLOGYMODEL
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a metrology model.
  12. class LIntExport HMetrologyModel : public HHandle
  13. {
  14. public:
  15. // Copy constructor
  16. HMetrologyModel(const HMetrologyModel& source) : HHandle(source) {}
  17. // Copy constructor
  18. HMetrologyModel(const HHandle& handle);
  19. // Create HMetrologyModel from handle, taking ownership
  20. explicit HMetrologyModel(Hlong handle);
  21. bool operator==(const HHandle& obj) const
  22. {
  23. return HHandleBase::operator==(obj);
  24. }
  25. bool operator!=(const HHandle& obj) const
  26. {
  27. return HHandleBase::operator!=(obj);
  28. }
  29. protected:
  30. // Verify matching semantic type ('metrology_model')!
  31. virtual void AssertType(Hphandle handle) const;
  32. public:
  33. // Deep copy of all data represented by this object instance
  34. HMetrologyModel Clone() const;
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // read_metrology_model: Read a metrology model from a file.
  39. explicit HMetrologyModel(const HString& FileName);
  40. // read_metrology_model: Read a metrology model from a file.
  41. explicit HMetrologyModel(const char* FileName);
  42. #ifdef _WIN32
  43. // read_metrology_model: Read a metrology model from a file.
  44. explicit HMetrologyModel(const wchar_t* FileName);
  45. #endif
  46. // create_metrology_model: Create the data structure that is needed to measure geometric shapes.
  47. explicit HMetrologyModel();
  48. /***************************************************************************
  49. * Operators *
  50. ***************************************************************************/
  51. // Query the model contour of a metrology object in image coordinates.
  52. HXLDCont GetMetrologyObjectModelContour(const HTuple& Index, double Resolution) const;
  53. // Query the model contour of a metrology object in image coordinates.
  54. HXLDCont GetMetrologyObjectModelContour(Hlong Index, double Resolution) const;
  55. // Query the result contour of a metrology object.
  56. HXLDCont GetMetrologyObjectResultContour(const HTuple& Index, const HTuple& Instance, double Resolution) const;
  57. // Query the result contour of a metrology object.
  58. HXLDCont GetMetrologyObjectResultContour(Hlong Index, const HString& Instance, double Resolution) const;
  59. // Query the result contour of a metrology object.
  60. HXLDCont GetMetrologyObjectResultContour(Hlong Index, const char* Instance, double Resolution) const;
  61. #ifdef _WIN32
  62. // Query the result contour of a metrology object.
  63. HXLDCont GetMetrologyObjectResultContour(Hlong Index, const wchar_t* Instance, double Resolution) const;
  64. #endif
  65. // Alignment of a metrology model.
  66. void AlignMetrologyModel(const HTuple& Row, const HTuple& Column, const HTuple& Angle) const;
  67. // Alignment of a metrology model.
  68. void AlignMetrologyModel(double Row, double Column, double Angle) const;
  69. // Add a metrology object to a metrology model.
  70. Hlong AddMetrologyObjectGeneric(const HTuple& Shape, const HTuple& ShapeParam, const HTuple& MeasureLength1, const HTuple& MeasureLength2, const HTuple& MeasureSigma, const HTuple& MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  71. // Add a metrology object to a metrology model.
  72. Hlong AddMetrologyObjectGeneric(const HString& Shape, const HTuple& ShapeParam, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  73. // Add a metrology object to a metrology model.
  74. Hlong AddMetrologyObjectGeneric(const char* Shape, const HTuple& ShapeParam, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  75. #ifdef _WIN32
  76. // Add a metrology object to a metrology model.
  77. Hlong AddMetrologyObjectGeneric(const wchar_t* Shape, const HTuple& ShapeParam, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  78. #endif
  79. // Get parameters that are valid for the entire metrology model.
  80. HTuple GetMetrologyModelParam(const HString& GenParamName) const;
  81. // Get parameters that are valid for the entire metrology model.
  82. HTuple GetMetrologyModelParam(const char* GenParamName) const;
  83. #ifdef _WIN32
  84. // Get parameters that are valid for the entire metrology model.
  85. HTuple GetMetrologyModelParam(const wchar_t* GenParamName) const;
  86. #endif
  87. // Set parameters that are valid for the entire metrology model.
  88. void SetMetrologyModelParam(const HString& GenParamName, const HTuple& GenParamValue) const;
  89. // Set parameters that are valid for the entire metrology model.
  90. void SetMetrologyModelParam(const HString& GenParamName, const HString& GenParamValue) const;
  91. // Set parameters that are valid for the entire metrology model.
  92. void SetMetrologyModelParam(const char* GenParamName, const char* GenParamValue) const;
  93. #ifdef _WIN32
  94. // Set parameters that are valid for the entire metrology model.
  95. void SetMetrologyModelParam(const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  96. #endif
  97. // Deserialize a serialized metrology model.
  98. void DeserializeMetrologyModel(const HSerializedItem& SerializedItemHandle);
  99. // Serialize a metrology model.
  100. HSerializedItem SerializeMetrologyModel() const;
  101. // Transform metrology objects of a metrology model, e.g. for alignment.
  102. void TransformMetrologyObject(const HTuple& Index, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Mode) const;
  103. // Transform metrology objects of a metrology model, e.g. for alignment.
  104. void TransformMetrologyObject(const HString& Index, double Row, double Column, double Phi, const HString& Mode) const;
  105. // Transform metrology objects of a metrology model, e.g. for alignment.
  106. void TransformMetrologyObject(const char* Index, double Row, double Column, double Phi, const char* Mode) const;
  107. #ifdef _WIN32
  108. // Transform metrology objects of a metrology model, e.g. for alignment.
  109. void TransformMetrologyObject(const wchar_t* Index, double Row, double Column, double Phi, const wchar_t* Mode) const;
  110. #endif
  111. // Write a metrology model to a file.
  112. void WriteMetrologyModel(const HString& FileName) const;
  113. // Write a metrology model to a file.
  114. void WriteMetrologyModel(const char* FileName) const;
  115. #ifdef _WIN32
  116. // Write a metrology model to a file.
  117. void WriteMetrologyModel(const wchar_t* FileName) const;
  118. #endif
  119. // Read a metrology model from a file.
  120. void ReadMetrologyModel(const HString& FileName);
  121. // Read a metrology model from a file.
  122. void ReadMetrologyModel(const char* FileName);
  123. #ifdef _WIN32
  124. // Read a metrology model from a file.
  125. void ReadMetrologyModel(const wchar_t* FileName);
  126. #endif
  127. // Copy a metrology model.
  128. Hlong CopyMetrologyModel(const HTuple& Index) const;
  129. // Copy a metrology model.
  130. Hlong CopyMetrologyModel(const HString& Index) const;
  131. // Copy a metrology model.
  132. Hlong CopyMetrologyModel(const char* Index) const;
  133. #ifdef _WIN32
  134. // Copy a metrology model.
  135. Hlong CopyMetrologyModel(const wchar_t* Index) const;
  136. #endif
  137. // Copy metrology metrology objects of a metrology model.
  138. HTuple CopyMetrologyObject(const HTuple& Index) const;
  139. // Copy metrology metrology objects of a metrology model.
  140. Hlong CopyMetrologyObject(const HString& Index) const;
  141. // Copy metrology metrology objects of a metrology model.
  142. Hlong CopyMetrologyObject(const char* Index) const;
  143. #ifdef _WIN32
  144. // Copy metrology metrology objects of a metrology model.
  145. Hlong CopyMetrologyObject(const wchar_t* Index) const;
  146. #endif
  147. // Get the number of instances of the metrology objects of a metrology model.
  148. HTuple GetMetrologyObjectNumInstances(const HTuple& Index) const;
  149. // Get the number of instances of the metrology objects of a metrology model.
  150. double GetMetrologyObjectNumInstances(Hlong Index) const;
  151. // Get the results of the measurement of a metrology model.
  152. HTuple GetMetrologyObjectResult(const HTuple& Index, const HTuple& Instance, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  153. // Get the results of the measurement of a metrology model.
  154. HTuple GetMetrologyObjectResult(Hlong Index, const HString& Instance, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  155. // Get the results of the measurement of a metrology model.
  156. HTuple GetMetrologyObjectResult(Hlong Index, const char* Instance, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  157. #ifdef _WIN32
  158. // Get the results of the measurement of a metrology model.
  159. HTuple GetMetrologyObjectResult(Hlong Index, const wchar_t* Instance, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  160. #endif
  161. // Get the measure regions and the results of the edge location for the metrology objects of a metrology model.
  162. HXLDCont GetMetrologyObjectMeasures(const HTuple& Index, const HString& Transition, HTuple* Row, HTuple* Column) const;
  163. // Get the measure regions and the results of the edge location for the metrology objects of a metrology model.
  164. HXLDCont GetMetrologyObjectMeasures(const HString& Index, const HString& Transition, HTuple* Row, HTuple* Column) const;
  165. // Get the measure regions and the results of the edge location for the metrology objects of a metrology model.
  166. HXLDCont GetMetrologyObjectMeasures(const char* Index, const char* Transition, HTuple* Row, HTuple* Column) const;
  167. #ifdef _WIN32
  168. // Get the measure regions and the results of the edge location for the metrology objects of a metrology model.
  169. HXLDCont GetMetrologyObjectMeasures(const wchar_t* Index, const wchar_t* Transition, HTuple* Row, HTuple* Column) const;
  170. #endif
  171. // Measure and fit the geometric shapes of all metrology objects of a metrology model.
  172. void ApplyMetrologyModel(const HImage& Image) const;
  173. // Get the indices of the metrology objects of a metrology model.
  174. HTuple GetMetrologyObjectIndices() const;
  175. // Reset all fuzzy parameters and fuzzy functions of a metrology model.
  176. void ResetMetrologyObjectFuzzyParam(const HTuple& Index) const;
  177. // Reset all fuzzy parameters and fuzzy functions of a metrology model.
  178. void ResetMetrologyObjectFuzzyParam(const HString& Index) const;
  179. // Reset all fuzzy parameters and fuzzy functions of a metrology model.
  180. void ResetMetrologyObjectFuzzyParam(const char* Index) const;
  181. #ifdef _WIN32
  182. // Reset all fuzzy parameters and fuzzy functions of a metrology model.
  183. void ResetMetrologyObjectFuzzyParam(const wchar_t* Index) const;
  184. #endif
  185. // Reset all parameters of a metrology model.
  186. void ResetMetrologyObjectParam(const HTuple& Index) const;
  187. // Reset all parameters of a metrology model.
  188. void ResetMetrologyObjectParam(const HString& Index) const;
  189. // Reset all parameters of a metrology model.
  190. void ResetMetrologyObjectParam(const char* Index) const;
  191. #ifdef _WIN32
  192. // Reset all parameters of a metrology model.
  193. void ResetMetrologyObjectParam(const wchar_t* Index) const;
  194. #endif
  195. // Get a fuzzy parameter of a metroloy model.
  196. HTuple GetMetrologyObjectFuzzyParam(const HTuple& Index, const HTuple& GenParamName) const;
  197. // Get a fuzzy parameter of a metroloy model.
  198. HTuple GetMetrologyObjectFuzzyParam(const HString& Index, const HTuple& GenParamName) const;
  199. // Get a fuzzy parameter of a metroloy model.
  200. HTuple GetMetrologyObjectFuzzyParam(const char* Index, const HTuple& GenParamName) const;
  201. #ifdef _WIN32
  202. // Get a fuzzy parameter of a metroloy model.
  203. HTuple GetMetrologyObjectFuzzyParam(const wchar_t* Index, const HTuple& GenParamName) const;
  204. #endif
  205. // Get one or several parameters of a metrology model.
  206. HTuple GetMetrologyObjectParam(const HTuple& Index, const HTuple& GenParamName) const;
  207. // Get one or several parameters of a metrology model.
  208. HTuple GetMetrologyObjectParam(const HString& Index, const HTuple& GenParamName) const;
  209. // Get one or several parameters of a metrology model.
  210. HTuple GetMetrologyObjectParam(const char* Index, const HTuple& GenParamName) const;
  211. #ifdef _WIN32
  212. // Get one or several parameters of a metrology model.
  213. HTuple GetMetrologyObjectParam(const wchar_t* Index, const HTuple& GenParamName) const;
  214. #endif
  215. // Set fuzzy parameters or fuzzy functions for a metrology model.
  216. void SetMetrologyObjectFuzzyParam(const HTuple& Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  217. // Set fuzzy parameters or fuzzy functions for a metrology model.
  218. void SetMetrologyObjectFuzzyParam(const HString& Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  219. // Set fuzzy parameters or fuzzy functions for a metrology model.
  220. void SetMetrologyObjectFuzzyParam(const char* Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  221. #ifdef _WIN32
  222. // Set fuzzy parameters or fuzzy functions for a metrology model.
  223. void SetMetrologyObjectFuzzyParam(const wchar_t* Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  224. #endif
  225. // Set parameters for the metrology objects of a metrology model.
  226. void SetMetrologyObjectParam(const HTuple& Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  227. // Set parameters for the metrology objects of a metrology model.
  228. void SetMetrologyObjectParam(const HString& Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  229. // Set parameters for the metrology objects of a metrology model.
  230. void SetMetrologyObjectParam(const char* Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  231. #ifdef _WIN32
  232. // Set parameters for the metrology objects of a metrology model.
  233. void SetMetrologyObjectParam(const wchar_t* Index, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  234. #endif
  235. // Add a rectangle to a metrology model.
  236. Hlong AddMetrologyObjectRectangle2Measure(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, const HTuple& MeasureLength1, const HTuple& MeasureLength2, const HTuple& MeasureSigma, const HTuple& MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  237. // Add a rectangle to a metrology model.
  238. Hlong AddMetrologyObjectRectangle2Measure(double Row, double Column, double Phi, double Length1, double Length2, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  239. // Add a line to a metrology model.
  240. Hlong AddMetrologyObjectLineMeasure(const HTuple& RowBegin, const HTuple& ColumnBegin, const HTuple& RowEnd, const HTuple& ColumnEnd, const HTuple& MeasureLength1, const HTuple& MeasureLength2, const HTuple& MeasureSigma, const HTuple& MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  241. // Add a line to a metrology model.
  242. Hlong AddMetrologyObjectLineMeasure(double RowBegin, double ColumnBegin, double RowEnd, double ColumnEnd, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  243. // Add an ellipse or an elliptic arc to a metrology model.
  244. Hlong AddMetrologyObjectEllipseMeasure(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Radius1, const HTuple& Radius2, const HTuple& MeasureLength1, const HTuple& MeasureLength2, const HTuple& MeasureSigma, const HTuple& MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  245. // Add an ellipse or an elliptic arc to a metrology model.
  246. Hlong AddMetrologyObjectEllipseMeasure(double Row, double Column, double Phi, double Radius1, double Radius2, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  247. // Add a circle or a circular arc to a metrology model.
  248. Hlong AddMetrologyObjectCircleMeasure(const HTuple& Row, const HTuple& Column, const HTuple& Radius, const HTuple& MeasureLength1, const HTuple& MeasureLength2, const HTuple& MeasureSigma, const HTuple& MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  249. // Add a circle or a circular arc to a metrology model.
  250. Hlong AddMetrologyObjectCircleMeasure(double Row, double Column, double Radius, double MeasureLength1, double MeasureLength2, double MeasureSigma, double MeasureThreshold, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  251. // Delete a metrology model and free the allocated memory.
  252. void ClearMetrologyModel() const;
  253. // Delete metrology objects and free the allocated memory.
  254. void ClearMetrologyObject(const HTuple& Index) const;
  255. // Delete metrology objects and free the allocated memory.
  256. void ClearMetrologyObject(const HString& Index) const;
  257. // Delete metrology objects and free the allocated memory.
  258. void ClearMetrologyObject(const char* Index) const;
  259. #ifdef _WIN32
  260. // Delete metrology objects and free the allocated memory.
  261. void ClearMetrologyObject(const wchar_t* Index) const;
  262. #endif
  263. // Set the size of the image of metrology objects.
  264. void SetMetrologyModelImageSize(Hlong Width, Hlong Height) const;
  265. // Create the data structure that is needed to measure geometric shapes.
  266. void CreateMetrologyModel();
  267. };
  268. // forward declarations and types for internal array implementation
  269. template<class T> class HSmartPtr;
  270. template<class T> class HHandleBaseArrayRef;
  271. typedef HHandleBaseArrayRef<HMetrologyModel> HMetrologyModelArrayRef;
  272. typedef HSmartPtr< HMetrologyModelArrayRef > HMetrologyModelArrayPtr;
  273. // Represents multiple tool instances
  274. class LIntExport HMetrologyModelArray : public HHandleBaseArray
  275. {
  276. public:
  277. // Create empty array
  278. HMetrologyModelArray();
  279. // Create array from native array of tool instances
  280. HMetrologyModelArray(HMetrologyModel* classes, Hlong length);
  281. // Copy constructor
  282. HMetrologyModelArray(const HMetrologyModelArray &tool_array);
  283. // Destructor
  284. virtual ~HMetrologyModelArray();
  285. // Assignment operator
  286. HMetrologyModelArray &operator=(const HMetrologyModelArray &tool_array);
  287. // Clears array and all tool instances
  288. virtual void Clear();
  289. // Get array of native tool instances
  290. const HMetrologyModel* Tools() const;
  291. // Get number of tools
  292. virtual Hlong Length() const;
  293. // Create tool array from tuple of handles
  294. virtual void SetFromTuple(const HTuple& handles);
  295. // Get tuple of handles for tool array
  296. virtual HTuple ConvertToTuple() const;
  297. protected:
  298. // Smart pointer to internal data container
  299. HMetrologyModelArrayPtr *mArrayPtr;
  300. };
  301. }
  302. #endif