MeVisLab Toolbox Reference
mlPCLMLTools.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code author="Wolf Spindler"
3 //----------------------------------------------------------------------------------
5 
12 //----------------------------------------------------------------------------------
13 #pragma once
14 
15 #include "MLPCLMLAdaptersSystem.h"
16 #include <mlPCLTypes.h>
17 #include <mlPCLSupportTools.h>
18 #include <mlModuleIncludes.h>
19 #include <mlReleaseToolsString.h>
20 
21 #if defined(MLAB_CMAKE_BUILDSYSTEM)
22 //#include <include/mlPointList.h> // Not available any more.
23 //#include <include/mlVectorList.h>// Not available any more.
24 #else
25 #include <mlPointList.h>
26 #include <mlVectorList.h>
27 #endif
28 #include <mlXMarkerList.h>
29 
30 ML_START_NAMESPACE
31 
32 class SubImage;
33 class PagedImage;
34 
36 namespace PCLMLTools {
37 
38 
39 //----------------------------------------------------------------------------------
42 //----------------------------------------------------------------------------------
44  const MLTypeData* voxVal);
45 
46 //----------------------------------------------------------------------------------
50 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
51 //----------------------------------------------------------------------------------
53 inline void setVectorReplacement(pcl::PointXYZ & /*p*/, const Vector3f & /*vf*/)
54 {
55  // There is no member which could be used for the vector, do not assign anything.
56 }
57 
58 // Handle all other point types generically.
59 template <typename PCL_POINT_TYPE>
60 inline void setVectorReplacement(PCL_POINT_TYPE &p, const Vector3f &vf)
61 {
62  p.normal_x = vf[0];
63  p.normal_y = vf[1];
64  p.normal_z = vf[2];
65 }
67 
68 //----------------------------------------------------------------------------------
70 //----------------------------------------------------------------------------------
72 {
75  thresholdMin(0.), thresholdMax(0.),
76  lowerValue(0.), upperValue(0.),
77  skipVoxelsBelowMin(false),
78  skipVoxelsAboveMax(false),
79  normalizeInClampedRange(false),
80  useVectorLengthAsIntensity(false),
81  transformToWorld(false){};
82 
85  double thresholdMin;
86 
89  double thresholdMax;
90 
92  double lowerValue;
93 
95  double upperValue;
96 
99 
102 
107 
112 
117 };
118 
119 
120 //----------------------------------------------------------------------------------
126 //----------------------------------------------------------------------------------
127 template <typename POINT_CLOUD_TYPE>
128 inline void transformTo(POINT_CLOUD_TYPE &pointCloud,
129  const Matrix4 &voxelToWorldMatrix,
130  bool toWorld)
131 {
132  typedef typename POINT_CLOUD_TYPE::PointType PointType;
133  MedicalImageProperties mapProps;
134  mapProps.setVoxelToWorldMatrix(voxelToWorldMatrix);
135  const size_t numPoints = pointCloud.points.size();
136  Vector3 pnt;
137  for (size_t c=0; c < numPoints; ++c){
138  PointType &pclPoint = pointCloud.points[c];
139  pnt.assign(pclPoint.x, pclPoint.y, pclPoint.z);
140  if (toWorld){
141  pnt = mapProps.mapVoxelToWorld(pnt);
142  }
143  else{
144  pnt = mapProps.mapWorldToVoxel(pnt);
145  }
146  pclPoint.x = static_cast<float>(pnt[0]);
147  pclPoint.y = static_cast<float>(pnt[1]);
148  pclPoint.z = static_cast<float>(pnt[2]);
149  }
150 }
151 
152 //----------------------------------------------------------------------------------
161 //----------------------------------------------------------------------------------
162 template <typename POINT_CLOUD_PTR_TYPE>
163 inline bool appendSubImageVoxelsToPointCloud(const SubImage &subImg,
164  const ImageToPointCloudConversionParameters &convParams,
165  POINT_CLOUD_PTR_TYPE retPointCloudPtr)
166 {
167  bool allAddedRet = true;
168  const MLTypeInfos* dataTypeInfos = subImg.getDataTypeInfos();
169  if (dataTypeInfos && subImg.getData() && retPointCloudPtr){
170 
171  const MLDataType dt = subImg.getDataType();
172  const bool isVectorType = MLIsScalarType(dt) ? false : true;
173  double scale=0;
174  if (convParams.normalizeInClampedRange){
175  const double range = convParams.thresholdMax - convParams.thresholdMin;
176  if (range < 10e-10){
177  scale = 1.;
178  }
179  else{
180  scale = 1. / range;
181  }
182  }
183  typedef typename POINT_CLOUD_PTR_TYPE::element_type::PointType PointType;
184  typedef typename POINT_CLOUD_PTR_TYPE::element_type::VectorType PointVectorType;
185  PointVectorType tmpAddedPoints;
186  tmpAddedPoints.reserve(20000);
187  const SubImageBox subImgBox = subImg.getBox();
188  ImageVector p = subImgBox.v1;
189  PointType valToAppend;
190  Vector3f vec3fVal;
191  //for (p.u = subImgBox.v1.u; p.u <= subImgBox.v2.u; ++p.u){
192  //for (p.t = subImgBox.v1.t; p.t <= subImgBox.v2.t; ++p.t){
193  //for (p.c = subImgBox.v1.c; p.c <= subImgBox.v2.c; ++p.c){
194  for (p.z = subImgBox.v1.z; p.z <= subImgBox.v2.z; ++p.z){
195  for (p.y = subImgBox.v1.y; p.y <= subImgBox.v2.y; ++p.y){
196  for (p.x = subImgBox.v1.x; p.x <= subImgBox.v2.x; ++p.x){
197 
198  // Get value from the image as generic voxel MLTypeData and determine
199  // whether the value interpreted as double shall be taken or
200  // alternatively the length of a vector if we have one.
201  const MLTypeData* voxVal = reinterpret_cast<MLTypeData*>(subImg.getImagePointer(p));
202  double dblVal = 0;
203  if (isVectorType){
204  vec3fVal = getVector3fFromVoxVal(dt, voxVal);
205  }
206  dblVal = isVectorType && convParams.useVectorLengthAsIntensity ?
207  vec3fVal.length() :
208  dataTypeInfos->castToDouble(voxVal);
209 
210  // Do clamping and scaling.
211  bool add = true;
212  if (dblVal < convParams.thresholdMin){
213  if (convParams.skipVoxelsBelowMin){
214  add = false;
215  }
216  else{
217  dblVal = convParams.lowerValue;
218  }
219  }
220  if (dblVal > convParams.thresholdMax){
221  if (convParams.skipVoxelsAboveMax){
222  add = false;
223  }
224  else{
225  dblVal = convParams.upperValue;
226  }
227  }
228 
229  // Append point with coordinates and intensity.
230  if (!add){
231  allAddedRet = false;
232  }
233  else{
234  valToAppend.x = static_cast<float>(p.x);
235  valToAppend.y = static_cast<float>(p.y);
236  valToAppend.z = static_cast<float>(p.z);
237  if (convParams.normalizeInClampedRange){
238  if (dblVal < convParams.thresholdMin){ dblVal = convParams.thresholdMin; }
239  if (dblVal > convParams.thresholdMax){ dblVal = convParams.thresholdMax; }
240  dblVal = (dblVal-convParams.thresholdMin)*scale;
241  }
242  valToAppend.data[3] = 1.0f;
243  PCLSupportTools::setIntensityReplacement(valToAppend, static_cast<float>(dblVal));
244  if (isVectorType){
245  setVectorReplacement(valToAppend, vec3fVal);
246  }
247  tmpAddedPoints.push_back(valToAppend);
248  }
249  }
250  }
251  }
252  //}
253  //}
254  //}
255  if (tmpAddedPoints.size() > 0){
256  const MLuint64 newSize = static_cast<MLuint64>(retPointCloudPtr->width) + tmpAddedPoints.size();
258  retPointCloudPtr->width = mlrange_cast<MLuint32>(newSize);
259  retPointCloudPtr->height = 1;
260  retPointCloudPtr->points.insert(retPointCloudPtr->points.end(), tmpAddedPoints.begin(), tmpAddedPoints.end());
261  }
262  else{
263  ML_PRINT_ERROR("mlPCLMLTools.cpp: appendSubImageVoxelsToPointCloud",
265  "Could not add points to point cloud since this would exceed "
266  "the maximum number UINT32_MAX points in a point cloud.");
267  }
268  }
269  }
270  return allAddedRet;
271 }
272 
273 //----------------------------------------------------------------------------------
279 //----------------------------------------------------------------------------------
280 template <typename POINT_CLOUD_PTR_TYPE>
282  const ImageToPointCloudConversionParameters &convParams,
283  POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
284 {
285  typedef typename POINT_CLOUD_PTR_TYPE::element_type POINT_CLOUD_TYPE;
286  MLErrorCode retErr = ML_NO_MEMORY;
287  retPointCloudPtr = POINT_CLOUD_PTR_TYPE(new POINT_CLOUD_TYPE);
288  SubImage subImage(inImg.getBoxFromImageExtent(), inImg.getDataType(), nullptr);
290  bool isOrganized = false;
291  if (subImage.getData()){
292  retErr = inImg.getTile(subImage);
293  if (ML_RESULT_OK == retErr){
294  isOrganized = appendSubImageVoxelsToPointCloud(subImage, convParams, retPointCloudPtr);
295 
296  // If all voxels have been added then we can set the height of the point cloud to mark it as organized.
297  if (isOrganized && retPointCloudPtr &&
298  (subImage.getNumVoxels() <= static_cast<MLint>(PCLSupportTools::getUnsigned32BitMaximumLimit()))){
299  retPointCloudPtr->width = mlrange_cast<MLuint32>(subImage.getExtent().x);
300  retPointCloudPtr->height = mlrange_cast<MLuint32>(subImage.getExtent().y * subImage.getExtent().z);
301  }
302  }
303  }
304  if (convParams.transformToWorld){
305  transformTo(*retPointCloudPtr, inImg.getVoxelToWorldMatrix(), true);
306  }
307  return retErr;
308 }
309 
311 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
312 //----------------------------------------------------------------------------------
315 //----------------------------------------------------------------------------------
316 template <typename POINT_TYPE>
317 inline void assignPointDataFromXMarker(const XMarker &xMarker, POINT_TYPE &point)
318 {
319  point.data[0] = static_cast<float>(xMarker.pos[0]);
320  point.data[1] = static_cast<float>(xMarker.pos[1]);
321  point.data[2] = static_cast<float>(xMarker.pos[2]);
322  point.data[3] = 1.0f;
323 }
324 
325 //----------------------------------------------------------------------------------
331 //----------------------------------------------------------------------------------
332 inline void assignPointDataFromXMarker(const XMarker &xMarker, pcl::PointXYZLNormal &point)
333 {
334  point.data[0] = static_cast<float>(xMarker.pos[0]);
335  point.data[1] = static_cast<float>(xMarker.pos[1]);
336  point.data[2] = static_cast<float>(xMarker.pos[2]);
337  point.data[3] = 1.0f;
338  point.data_n[0] = static_cast<float>(xMarker.vec[0]);
339  point.data_n[1] = static_cast<float>(xMarker.vec[1]);
340  point.data_n[2] = static_cast<float>(xMarker.vec[2]);
341  point.data_n[3] = 0.0f;
342  point.label = static_cast<unsigned int>(xMarker.type);
343 }
344 
345 //----------------------------------------------------------------------------------
351 //----------------------------------------------------------------------------------
352 inline void assignPointDataFromXMarker(const XMarker &xMarker, pcl::PointXYZRGBNormal &point)
353 {
354  point.data[0] = static_cast<float>(xMarker.pos[0]);
355  point.data[1] = static_cast<float>(xMarker.pos[1]);
356  point.data[2] = static_cast<float>(xMarker.pos[2]);
357  point.data[3] = 1.0f;
358  point.data_n[0] = static_cast<float>(xMarker.vec[0]);
359  point.data_n[1] = static_cast<float>(xMarker.vec[1]);
360  point.data_n[2] = static_cast<float>(xMarker.vec[2]);
361  point.data_n[3] = 0.0f;
362  point.rgba = static_cast<unsigned int>(xMarker.type);
363 }
364 
365 //----------------------------------------------------------------------------------
371 //----------------------------------------------------------------------------------
372 inline void assignPointDataFromXMarker(const XMarker &xMarker, pcl::PointXYZINormal &point)
373 {
374  point.data[0] = static_cast<float>(xMarker.pos[0]);
375  point.data[1] = static_cast<float>(xMarker.pos[1]);
376  point.data[2] = static_cast<float>(xMarker.pos[2]);
377  point.data[3] = 1.0f;
378  point.data_n[0] = static_cast<float>(xMarker.vec[0]);
379  point.data_n[1] = static_cast<float>(xMarker.vec[1]);
380  point.data_n[2] = static_cast<float>(xMarker.vec[2]);
381  point.data_n[3] = 0.0f;
382  point.intensity = static_cast<float>(xMarker.type);
383 }
385 
386 //----------------------------------------------------------------------------------
394 //----------------------------------------------------------------------------------
395 template <typename POINT_CLOUD_PTR_TYPE>
396 inline void createPointCloudFromBaseList(const Base *inBaseList,
397  POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
398 {
399  if (!inBaseList){
400  retPointCloudPtr.reset();
401  }
402  else{
403  // Check for list-like base types.
404 #if !defined(MLAB_CMAKE_BUILDSYSTEM)
405  const PointList *pl = mlbase_cast<const PointList*>(inBaseList);
406  const VectorList *vl = mlbase_cast<const VectorList*>(inBaseList);
407 #endif
408  const XMarkerList *xml = mlbase_cast<const XMarkerList*>(inBaseList);
409  const XMarkerListContainer *xmlc = mlbase_cast<const XMarkerListContainer*>(inBaseList);
410 
411  if (
412 #if !defined(MLAB_CMAKE_BUILDSYSTEM)
413  pl || vl ||
414 #endif
415  xml || xmlc){
416  // Create a new point cloud if we have an input object, even if it is empty.
417  typedef typename POINT_CLOUD_PTR_TYPE::element_type POINT_CLOUD_TYPE;
418  retPointCloudPtr = POINT_CLOUD_PTR_TYPE(new POINT_CLOUD_TYPE);
419 
420  // Get number of points from list.
421 #if !defined(MLAB_CMAKE_BUILDSYSTEM)
422  const MLssize_t numVals = (pl ? pl->getNum() :
423  (vl ? vl->getNum() :
424  (xml ? mlrange_cast<MLssize_t>(xml->size()) :
425  (xmlc ? mlrange_cast<MLssize_t>(const_cast<XMarkerListContainer*>(xmlc)->getList()->size()) : 0))));
426 #else
427  const MLssize_t numVals = (xml ? mlrange_cast<MLssize_t>(xml->size()) :
428  (xmlc ? mlrange_cast<MLssize_t>(const_cast<XMarkerListContainer*>(xmlc)->getList()->size()) : 0));
429 #endif
430  if (static_cast<MLint>(numVals) > static_cast<MLint>(PCLSupportTools::getUnsigned32BitMaximumLimit())){
431  ML_PRINT_ERROR("mlPCLToMLTools.h: createPointCloudFromBaseList",
433  "Input point cloud has more than ML_UINT32_MAX entries; the "
434  "PointCloud.width parameter cannot be set to this value any more; "
435  "using ML_UINT32_MAX instead.");
436  retPointCloudPtr->width = static_cast<MLuint32>(PCLSupportTools::getUnsigned32BitMaximumLimit());
437  }
438  else{
439  retPointCloudPtr->width = static_cast<MLuint32>(numVals);
440  }
441  retPointCloudPtr->height = 1;
442  retPointCloudPtr->is_dense = true;
443  retPointCloudPtr->points.resize(mlrange_cast<size_t>(numVals));
444 
445 
446  if (numVals > 0){
447  for (MLssize_t cs=0; cs < numVals; ++cs){
448  typename POINT_CLOUD_TYPE::PointType &point = retPointCloudPtr->points[static_cast<size_t>(cs)];
449 
450 #if !defined(MLAB_CMAKE_BUILDSYSTEM)
451  if (pl){
452  pl->getValue(cs, point.data[0], point.data[1], point.data[2]);
453  }
454  else if (vl){
455  int vecType=0;
456  vl->getPoint(cs, vecType, point.data[0], point.data[1], point.data[2]);
457  }
458  else
459 #endif
460  if (xml || xmlc){
461  const XMarker &xMarker = xml ? (*static_cast<const XMarker*>(xml->getConstItemAt(cs))) :
462  (*static_cast<const XMarker*>(const_cast<XMarkerListContainer*>(xmlc)->getList()->getConstItemAt(cs)));
463  assignPointDataFromXMarker(xMarker, point);
464  }
465  }
466  }
467  }
468  }
469 }
470 
471 
472 
474 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
475 //----------------------------------------------------------------------------------
478 //----------------------------------------------------------------------------------
479 template <typename POINT_TYPE>
480 inline void assignXMarkerFromPointData(const POINT_TYPE &point, XMarker &xMarker)
481 {
482  xMarker.pos[0] = point.data[0];
483  xMarker.pos[1] = point.data[1];
484  xMarker.pos[2] = point.data[2];
485 }
486 
487 //----------------------------------------------------------------------------------
492 //----------------------------------------------------------------------------------
493 inline void assignXMarkerFromPointData(const pcl::PointXYZLNormal &point, XMarker &xMarker)
494 {
495  xMarker.pos[0] = point.data[0];
496  xMarker.pos[1] = point.data[1];
497  xMarker.pos[2] = point.data[2];
498  xMarker.vec[0] = point.data_n[0];
499  xMarker.vec[1] = point.data_n[1];
500  xMarker.vec[2] = point.data_n[2];
501  xMarker.type = static_cast<int>(point.label);
502 }
503 
504 //----------------------------------------------------------------------------------
509 //----------------------------------------------------------------------------------
510 inline void assignXMarkerFromPointData(const pcl::PointXYZRGBNormal &point, XMarker &xMarker)
511 {
512  xMarker.pos[0] = point.data[0];
513  xMarker.pos[1] = point.data[1];
514  xMarker.pos[2] = point.data[2];
515  xMarker.vec[0] = point.data_n[0];
516  xMarker.vec[1] = point.data_n[1];
517  xMarker.vec[2] = point.data_n[2];
518  xMarker.type = static_cast<int>(point.rgba);
519 }
520 
521 //----------------------------------------------------------------------------------
526 //----------------------------------------------------------------------------------
527 inline void assignXMarkerFromPointData(const pcl::PointXYZINormal &point, XMarker &xMarker)
528 {
529  xMarker.pos[0] = point.data[0];
530  xMarker.pos[1] = point.data[1];
531  xMarker.pos[2] = point.data[2];
532  xMarker.vec[0] = point.data_n[0];
533  xMarker.vec[1] = point.data_n[1];
534  xMarker.vec[2] = point.data_n[2];
535  xMarker.type = static_cast<int>(point.intensity);
536 }
538 
539 //----------------------------------------------------------------------------------
544 //----------------------------------------------------------------------------------
545 template <typename POINT_CLOUD_TYPE>
546 inline void convertPointCloudToXMarkerList(POINT_CLOUD_TYPE &inputPointCloud,
547  XMarkerList &outputList)
548 {
549  outputList.clear();
550  const size_t numInputPoints = inputPointCloud.points.size();
551  outputList.resize(numInputPoints);
552  for (size_t c=0; c < numInputPoints; ++c){
553  XMarker *xMarker = static_cast<XMarker*>(outputList.getItemAt(static_cast<MLssize_t>(c)));
554  assignXMarkerFromPointData(inputPointCloud.points[c], *xMarker);
555  }
556 }
557 
558 };
559 
560 ML_END_NAMESPACE
561 
Project global and OS specific declarations.
#define MLPCL_MLAdapters_EXPORT
If included by external modules, exported symbols are declared as import symbols.
BaseItem * getItemAt(MLssize_t index) override
This virtual function is reimplemented from ListBase, where it returns 0 in any case (also in ListTem...
Definition: mlListBase.h:746
const BaseItem * getConstItemAt(MLssize_t index) const override
Same as getItemAt(MLssize_t index) for constant access.
Definition: mlListBase.h:751
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition: mlBase.h:62
T length() const
Returns the length of the vector, i.e. norm2().
MLDataType getDataType() const
Returns the data type of the image.
SubImageBox getBoxFromImageExtent() const
Returns size of image as box with origin 0.
This class encapsulates basic medical image properties:
const Matrix4 & getVoxelToWorldMatrix() const
Returns the voxelToWorld matrix.
void setVoxelToWorldMatrix(const Matrix4 &matrix)
Sets the matrix which transforms voxel to world coordinates to matrix.
Vector3 mapWorldToVoxel(const Vector3 &worldPosition) const
Maps the worldPosition vector to voxel coordinates and returns it.
Vector3 mapVoxelToWorld(const Vector3 &voxelPosition) const
Maps the voxelPosition vector to world coordinates and returns it.
Class which represents an image, which manages properties of an image and image data which is located...
Definition: mlPagedImage.h:70
MLEXPORT MLErrorCode getTile(SubImageBox location, MLDataType dataType, void **data, const ScaleShiftData &scaleShiftData=ScaleShiftData(), MLRequestProgressCB *progressCallback=nullptr, void *progressCallbackUserData=nullptr)
See Host::getTile( module, outputIndex, location, dataType, data, scaleShiftData).
Base object class PointList managing a list of points.
Definition: mlPointList.h:29
void getValue(MLssize_t index, Vector3 &vec) const
get point at given index
MLssize_t getNum() const
returns the number of contained points
This class manages/represents a rectangular 6d image region which is organized linearly in memory.
Definition: mlSubImage.h:75
void * getData() const
Returns the memory address of the memory managed by the subimage.
Definition: mlSubImage.h:372
MLEXPORT void allocateAsMemoryBlockHandle(MLMemoryErrorHandling handleFailure=ML_RETURN_NULL)
Allocate data using the ML memory manager. For failure handing, see SubImage::allocate().
MLDataType getDataType() const
Return type of image data.
Definition: mlSubImage.h:288
ImageVector getExtent() const
Returns the extent of the subimage (which is identical to getBox().getExtent()).
Definition: mlSubImage.h:197
const SubImageBox & getBox() const
Returns the box describing the origin/extent of the subimage.
Definition: mlSubImage.h:230
const MLTypeInfos * getDataTypeInfos() const
Get MLTypeInfos for image data type.
Definition: mlSubImage.h:291
MLint getNumVoxels() const
Returns number of voxels in (sub)image.
Definition: mlSubImage.h:255
void * getImagePointer(const ImageVector &voxelPosition) const
Returns pointer to voxel data of image voxel at 6d position voxelPosition relative to the begin of th...
Definition: mlSubImage.h:323
VectorType v1
Corner v1 of the subimage region (included in region).
Definition: mlSubImageBox.h:63
VectorType v2
Corner v2 of the subimage region (also included in region!).
Definition: mlSubImageBox.h:69
ComponentType z
Z component of the vector.
Definition: mlImageVector.h:63
ComponentType x
X component of the vector.
Definition: mlImageVector.h:59
ComponentType y
Y component of the vector.
Definition: mlImageVector.h:61
Forward declarations to resolve header file dependencies.
Definition: mlVector3.h:66
void assign(const DT px, const DT py, const DT pz)
Sets all components to the passed values.
Definition: mlVector3.h:172
Base object representing a list of vectors given as Vector4's.
Definition: mlVectorList.h:29
void getPoint(MLssize_t index, int &type, float &x1, float &y1, float &z1) const
returns point of vectors at given point index (NOTE: (0,1 = first vector , 2,3 = second vector))
MLssize_t getNum() const
returns the number of contained points
Base object class XMarkerListContainer (derived from ListContainerTemplate) for XMarkerList objects.
Base object class XMarkerList (derived from BaseListTemplate) specialized for XMarker items.
Base object class XMarker (derived form baseItem) with 6D pos, 3D vec and type int.
Definition: mlXMarkerList.h:52
Vector3 vec
Marker vector, relative to position.
Definition: mlXMarkerList.h:59
Vector6 pos
Marker position.
Definition: mlXMarkerList.h:58
int type
Marker type.
Definition: mlXMarkerList.h:60
MLint32 MLDataType
MLDataType.
Definition: mlTypeDefs.h:684
MLEXPORT MLint32 MLIsScalarType(MLDataType dataType)
Alternative name for MLIsStandardType.
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
Definition: mlTypeDefs.h:925
MLint32 MLErrorCode
Type of an ML Error code.
Definition: mlTypeDefs.h:818
#define ML_NO_MEMORY
The system does not have enough memory to perform the desired operation; try to reduce application da...
Definition: mlTypeDefs.h:837
#define ML_RESULT_OK
No error. Everything seems to be okay.
Definition: mlTypeDefs.h:826
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
A collection of tool functions used in MLPCLSupport.
Basic types used in the MeVislab binding of the Point Cloud Library(PCL).
Tool class for some string operations.
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
Definition: mlTypeDefs.h:513
@ ML_RETURN_NULL
On allocation failure NULL is returned without error handling.
Definition: mlTypeDefs.h:778
unsigned int MLuint32
Definition: mlTypeDefs.h:191
unsigned char MLTypeData
This is the pointer type used to point to the data of MLType data instances.
Definition: mlTypeDefs.h:1436
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
SSIZE_T MLssize_t
The signed ML size type which is a signed 32 bit size_t on 32 bit platforms and 64 bit one on 64 bit ...
Definition: mlTypeDefs.h:654
MLErrorCode createPointCloudFromPagedImage(PagedImage &inImg, const ImageToPointCloudConversionParameters &convParams, POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
Creates a point cloud from an ML image.
Definition: mlPCLMLTools.h:281
void convertPointCloudToXMarkerList(POINT_CLOUD_TYPE &inputPointCloud, XMarkerList &outputList)
Creates a point cloud from any of the following Base lists: PointList, VectorList,...
Definition: mlPCLMLTools.h:546
void assignPointDataFromXMarker(const XMarker &xMarker, pcl::PointXYZINormal &point)
Special version to assign an XMarker to a PointXYZINormal point; data[0] - data[2] are assigned fro...
Definition: mlPCLMLTools.h:372
void assignXMarkerFromPointData(const pcl::PointXYZINormal &point, XMarker &xMarker)
Special version to assign a PointXYZINormal point to an XMarker; data[0] - data[2] are assigned to ...
Definition: mlPCLMLTools.h:527
void transformTo(POINT_CLOUD_TYPE &pointCloud, const Matrix4 &voxelToWorldMatrix, bool toWorld)
Performs a voxelToWorld transformation of all point coordinates of pointCloud.
Definition: mlPCLMLTools.h:128
void createPointCloudFromBaseList(const Base *inBaseList, POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
Creates a point cloud from any of the following Base lists: PointList, VectorList,...
Definition: mlPCLMLTools.h:396
MLPCL_MLAdapters_EXPORT Vector3f getVector3fFromVoxVal(MLDataType dt, const MLTypeData *voxVal)
Tries to get any sensible Vector3f from the given voxVal if it is of any ML vector type; otherwise a ...
void setVectorReplacement(PCL_POINT_TYPE &p, const Vector3f &vf)
Definition: mlPCLMLTools.h:60
bool appendSubImageVoxelsToPointCloud(const SubImage &subImg, const ImageToPointCloudConversionParameters &convParams, POINT_CLOUD_PTR_TYPE retPointCloudPtr)
Creates a point cloud from an ML SubImage.
Definition: mlPCLMLTools.h:163
MLPCLSUPPORT_EXPORT MLuint64 getUnsigned32BitMaximumLimit()
Returns the maximum number of entries allowed in data structured with 32 bit unsigned indexing,...
void setIntensityReplacement(pcl::PointXYZ &, float=1.f, MLuint8=0xff)
Sets a scalar value in a member which can be used as storage for an additional value,...
Structure containing all data type features and pointers to all functions needed to implement operati...
Definition: mlTypeDefs.h:1466
Function_CastToDouble castToDouble
Returns a type value cast to double.
Definition: mlTypeDefs.h:1614
A container with parameters for the conversion from ML images to point clouds.
Definition: mlPCLMLTools.h:72
double upperValue
Possibly used on voxels larger than thresholdMax; see thresholdMax for details.
Definition: mlPCLMLTools.h:95
bool useVectorLengthAsIntensity
If enabled then the length of a possibly existing normal vector is used instead of the incoming voxel...
Definition: mlPCLMLTools.h:111
ImageToPointCloudConversionParameters()
Default constructor fixing the defaults.
Definition: mlPCLMLTools.h:74
bool normalizeInClampedRange
If enabled then all voxel values are scaled from [lowerValue, upperValue] to [0,1]; values outside wi...
Definition: mlPCLMLTools.h:106
double thresholdMax
If any value is larger than thresholdMax and skipVoxelsAboveMax is false then the voxel is set to upp...
Definition: mlPCLMLTools.h:89
bool skipVoxelsAboveMax
Used when voxels are larger than thresholdMax; see thresholdMax for details.
Definition: mlPCLMLTools.h:101
bool skipVoxelsBelowMin
Used when voxels are smaller than thresholdMin; see thresholdMin for details.
Definition: mlPCLMLTools.h:98
bool transformToWorld
If enabled then all coordinates retrieved from voxel coordinates are translated world coordinates usi...
Definition: mlPCLMLTools.h:116
double lowerValue
Possibly used on voxels smaller than thresholdMin; see thresholdMin for details.
Definition: mlPCLMLTools.h:92
double thresholdMin
If any value is smaller than thresholdMin and skipVoxelsBelowMin is true then the voxel is not added ...
Definition: mlPCLMLTools.h:81