MeVisLab Toolbox Reference
ml::PCLMLTools Namespace Reference

Namespace with a collection of converter tools between the libraries ML and PCL. More...

Classes

struct  ImageToPointCloudConversionParameters
 A container with parameters for the conversion from ML images to point clouds. More...
 

Functions

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 zero vector is returned.
 
template<typename POINT_CLOUD_TYPE >
void transformTo (POINT_CLOUD_TYPE &pointCloud, const Matrix4 &voxelToWorldMatrix, bool toWorld)
 Performs a voxelToWorld transformation of all point coordinates of pointCloud.
 
template<typename POINT_CLOUD_PTR_TYPE >
bool appendSubImageVoxelsToPointCloud (const SubImage &subImg, const ImageToPointCloudConversionParameters &convParams, POINT_CLOUD_PTR_TYPE retPointCloudPtr)
 Creates a point cloud from an ML SubImage.
 
template<typename POINT_CLOUD_PTR_TYPE >
MLErrorCode createPointCloudFromPagedImage (PagedImage &inImg, const ImageToPointCloudConversionParameters &convParams, POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
 Creates a point cloud from an ML image.
 
template<typename POINT_TYPE >
void assignPointDataFromXMarker (const XMarker &xMarker, POINT_TYPE &point)
 Generically assigns an XMarker to a any at least 3D point cloud point; only data[0] - data[2] are assigned from xMarker.pos and data[3] is set to 1.
 
void assignPointDataFromXMarker (const XMarker &xMarker, pcl::PointXYZLNormal &point)
 Special version to assign an XMarker to a PointXYZLNormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, label is cast from xMarker.type.
 
void assignPointDataFromXMarker (const XMarker &xMarker, pcl::PointXYZRGBNormal &point)
 Special version to assign an XMarker to a PointXYZRGBNormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, rgba (unit32) is cast from xMarker.type.
 
void assignPointDataFromXMarker (const XMarker &xMarker, pcl::PointXYZINormal &point)
 Special version to assign an XMarker to a PointXYZINormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, intensity is cast from xMarker.type.
 
template<typename POINT_CLOUD_PTR_TYPE >
void createPointCloudFromBaseList (const Base *inBaseList, POINT_CLOUD_PTR_TYPE &retPointCloudPtr)
 Creates a point cloud from any of the following Base lists: PointList, VectorList, XMarkerList, or XMarkerListContainer.
 
template<typename POINT_TYPE >
void assignXMarkerFromPointData (const POINT_TYPE &point, XMarker &xMarker)
 Generically assigns a point cloud point to an XMarker; only data[0] - data[2] are assigned from point to xMarker.pos.
 
void assignXMarkerFromPointData (const pcl::PointXYZLNormal &point, XMarker &xMarker)
 Special version to assign a PointXYZLNormal point to an XMarker;
data[0] - data[2] are assigned to xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, label is cast to xMarker.type.
 
void assignXMarkerFromPointData (const pcl::PointXYZRGBNormal &point, XMarker &xMarker)
 Special version to assign a PointXYZRGBNormal point to an XMarker;
data[0] - data[2] are assigned to xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, rgba (uint32) is cast to xMarker.type.
 
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 xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, intensity is cast to xMarker.type.
 
template<typename POINT_CLOUD_TYPE >
void convertPointCloudToXMarkerList (POINT_CLOUD_TYPE &inputPointCloud, XMarkerList &outputList)
 Creates a point cloud from any of the following Base lists: PointList, VectorList, XMarkerList, or XMarkerListContainer.
 
void setVectorReplacement (pcl::PointXYZ &, const Vector3f &)
 If the point type has any normal-like members then any vector components of an ML vector-like voxel type are assigned to them.
 
template<typename PCL_POINT_TYPE >
void setVectorReplacement (PCL_POINT_TYPE &p, const Vector3f &vf)
 

Detailed Description

Namespace with a collection of converter tools between the libraries ML and PCL.

Function Documentation

◆ appendSubImageVoxelsToPointCloud()

bool ml::PCLMLTools::appendSubImageVoxelsToPointCloud ( const SubImage & subImg,
const ImageToPointCloudConversionParameters & convParams,
POINT_CLOUD_PTR_TYPE retPointCloudPtr )
inline

Creates a point cloud from an ML SubImage.

Parameters
subImgThe input SubImage whose voxels shall be thresholded and possibly added as points to retPointCloudPtr.
convParamsA container describing the parameters for the image to point cloud conversion.
retPointCloudPtrThe pointer is reset and set to the newly created point cloud.
Returns
true if all voxels have been added as points, false otherwise. This can be useful to set the isOrganized flag of the point set if this function was the only operation to add points to the point set.

Definition at line 158 of file mlPCLMLTools.h.

References appendSubImageVoxelsToPointCloud(), getVector3fFromVoxVal(), ML_BAD_PARAMETER, ML_PRINT_ERROR, MLIsScalarType(), mlrange_cast(), and setVectorReplacement().

Referenced by appendSubImageVoxelsToPointCloud(), and createPointCloudFromPagedImage().

◆ assignPointDataFromXMarker() [1/4]

void ml::PCLMLTools::assignPointDataFromXMarker ( const XMarker & xMarker,
pcl::PointXYZINormal & point )
inline

Special version to assign an XMarker to a PointXYZINormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, intensity is cast from xMarker.type.

data[2] is set to 1, data_n[3] is set to 0, curvature is left unchanged.

Definition at line 367 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), and mlrange_cast().

◆ assignPointDataFromXMarker() [2/4]

void ml::PCLMLTools::assignPointDataFromXMarker ( const XMarker & xMarker,
pcl::PointXYZLNormal & point )
inline

Special version to assign an XMarker to a PointXYZLNormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, label is cast from xMarker.type.

data[2] is set to 1, data_n[3] is set to 0, curvature is left unchanged.

Definition at line 327 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), and mlrange_cast().

◆ assignPointDataFromXMarker() [3/4]

void ml::PCLMLTools::assignPointDataFromXMarker ( const XMarker & xMarker,
pcl::PointXYZRGBNormal & point )
inline

Special version to assign an XMarker to a PointXYZRGBNormal point;
data[0] - data[2] are assigned from xMarker.pos, data_n[0] - data_n[2] are assigned from xMarker.vec, rgba (unit32) is cast from xMarker.type.

data[2] is set to 1, data_n[3] is set to 0, curvature is left unchanged.

Definition at line 347 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), and mlrange_cast().

◆ assignPointDataFromXMarker() [4/4]

template<typename POINT_TYPE >
void ml::PCLMLTools::assignPointDataFromXMarker ( const XMarker & xMarker,
POINT_TYPE & point )
inline

Generically assigns an XMarker to a any at least 3D point cloud point; only data[0] - data[2] are assigned from xMarker.pos and data[3] is set to 1.

Definition at line 312 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), and mlrange_cast().

Referenced by assignPointDataFromXMarker(), assignPointDataFromXMarker(), assignPointDataFromXMarker(), assignPointDataFromXMarker(), and createPointCloudFromBaseList().

◆ assignXMarkerFromPointData() [1/4]

void ml::PCLMLTools::assignXMarkerFromPointData ( const pcl::PointXYZINormal & point,
XMarker & xMarker )
inline

Special version to assign a PointXYZINormal point to an XMarker;
data[0] - data[2] are assigned to xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, intensity is cast to xMarker.type.

Definition at line 508 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), and mlrange_cast().

◆ assignXMarkerFromPointData() [2/4]

void ml::PCLMLTools::assignXMarkerFromPointData ( const pcl::PointXYZLNormal & point,
XMarker & xMarker )
inline

Special version to assign a PointXYZLNormal point to an XMarker;
data[0] - data[2] are assigned to xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, label is cast to xMarker.type.

Definition at line 474 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), and mlrange_cast().

◆ assignXMarkerFromPointData() [3/4]

void ml::PCLMLTools::assignXMarkerFromPointData ( const pcl::PointXYZRGBNormal & point,
XMarker & xMarker )
inline

Special version to assign a PointXYZRGBNormal point to an XMarker;
data[0] - data[2] are assigned to xMarker.pos, data_n[0] - data_n[2] are assigned to xMarker.vec, rgba (uint32) is cast to xMarker.type.

Definition at line 491 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), and mlrange_cast().

◆ assignXMarkerFromPointData() [4/4]

template<typename POINT_TYPE >
void ml::PCLMLTools::assignXMarkerFromPointData ( const POINT_TYPE & point,
XMarker & xMarker )
inline

Generically assigns a point cloud point to an XMarker; only data[0] - data[2] are assigned from point to xMarker.pos.

Definition at line 461 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), and mlrange_cast().

Referenced by assignXMarkerFromPointData(), assignXMarkerFromPointData(), assignXMarkerFromPointData(), assignXMarkerFromPointData(), and convertPointCloudToXMarkerList().

◆ convertPointCloudToXMarkerList()

void ml::PCLMLTools::convertPointCloudToXMarkerList ( POINT_CLOUD_TYPE & inputPointCloud,
XMarkerList & outputList )
inline

Creates a point cloud from any of the following Base lists: PointList, VectorList, XMarkerList, or XMarkerListContainer.

Parameters
inputPointCloudThe point cloud to be converted to outputList.
outputListThe result list containing as many entries as the point cloud has entries.

Definition at line 527 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), convertPointCloudToXMarkerList(), and mlrange_cast().

Referenced by convertPointCloudToXMarkerList().

◆ createPointCloudFromBaseList()

void ml::PCLMLTools::createPointCloudFromBaseList ( const Base * inBaseList,
POINT_CLOUD_PTR_TYPE & retPointCloudPtr )
inline

Creates a point cloud from any of the following Base lists: PointList, VectorList, XMarkerList, or XMarkerListContainer.

Parameters
inBaseListThe input Base pointer whose list contents shall be converted to retPointCloudPtr, may be nullptr.
retPointCloudPtrIf a valid Base object is connected then this pointer is set to a newly created point set with the same number of entries as the corresponding input Base list; if no valid Base object is connected then this pointer will be reset to nullptr.

Definition at line 391 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), createPointCloudFromBaseList(), ML_BAD_PARAMETER, ML_PRINT_ERROR, and mlrange_cast().

Referenced by createPointCloudFromBaseList().

◆ createPointCloudFromPagedImage()

MLErrorCode ml::PCLMLTools::createPointCloudFromPagedImage ( PagedImage & inImg,
const ImageToPointCloudConversionParameters & convParams,
POINT_CLOUD_PTR_TYPE & retPointCloudPtr )
inline

Creates a point cloud from an ML image.

Parameters
inImgThe input paged image whose voxels shall be thresholded and possibly added as points to retPointCloudPtr.
convParamsA container describing the parameters for the image to point cloud conversion.
retPointCloudPtrThe pointer is reset and set to the newly created point cloud.

Definition at line 276 of file mlPCLMLTools.h.

References appendSubImageVoxelsToPointCloud(), createPointCloudFromPagedImage(), ML_NO_MEMORY, ML_RESULT_OK, ML_RETURN_NULL, mlrange_cast(), and transformTo().

Referenced by createPointCloudFromPagedImage().

◆ getVector3fFromVoxVal()

MLPCL_MLAdapters_EXPORT Vector3f ml::PCLMLTools::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 zero vector is returned.

References getVector3fFromVoxVal().

Referenced by appendSubImageVoxelsToPointCloud(), and getVector3fFromVoxVal().

◆ setVectorReplacement() [1/2]

void ml::PCLMLTools::setVectorReplacement ( pcl::PointXYZ & ,
const Vector3f &  )
inline

If the point type has any normal-like members then any vector components of an ML vector-like voxel type are assigned to them.

If the pcl voxel type does not have appropriate members then nothing is assigned for example such in pcl::PointXYZ.

Definition at line 48 of file mlPCLMLTools.h.

References setVectorReplacement().

Referenced by appendSubImageVoxelsToPointCloud(), setVectorReplacement(), and setVectorReplacement().

◆ setVectorReplacement() [2/2]

void ml::PCLMLTools::setVectorReplacement ( PCL_POINT_TYPE & p,
const Vector3f & vf )
inline

Definition at line 55 of file mlPCLMLTools.h.

References setVectorReplacement().

◆ transformTo()

void ml::PCLMLTools::transformTo ( POINT_CLOUD_TYPE & pointCloud,
const Matrix4 & voxelToWorldMatrix,
bool toWorld )
inline

Performs a voxelToWorld transformation of all point coordinates of pointCloud.

Parameters
pointCloudThe point cloud whose point coordinates shall be transformed.
voxelToWorldMatrixThe ML homogeneous matrix transforming voxel to world coordinates.
toWorldIf true then a voxelToWorld transformation is performed,
otherwise a worldToVoxel transformation,

Definition at line 123 of file mlPCLMLTools.h.

References ml::Tvec3< DT >::assign(), mlrange_cast(), ml::MedicalImageProperties::setVoxelToWorldMatrix(), and transformTo().

Referenced by createPointCloudFromPagedImage(), and transformTo().