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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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()

template<typename POINT_CLOUD_PTR_TYPE >
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 163 of file mlPCLMLTools.h.

References MLTypeInfos::castToDouble, ml::SubImage::getBox(), ml::SubImage::getData(), ml::SubImage::getDataType(), ml::SubImage::getDataTypeInfos(), ml::SubImage::getImagePointer(), ml::PCLSupportTools::getUnsigned32BitMaximumLimit(), getVector3fFromVoxVal(), ml::FloatingPointVector< T, size, DataContainer >::length(), ml::PCLMLTools::ImageToPointCloudConversionParameters::lowerValue, ML_BAD_PARAMETER, ML_PRINT_ERROR, MLIsScalarType(), ml::PCLMLTools::ImageToPointCloudConversionParameters::normalizeInClampedRange, ml::PCLSupportTools::setIntensityReplacement(), setVectorReplacement(), ml::PCLMLTools::ImageToPointCloudConversionParameters::skipVoxelsAboveMax, ml::PCLMLTools::ImageToPointCloudConversionParameters::skipVoxelsBelowMin, ml::PCLMLTools::ImageToPointCloudConversionParameters::thresholdMax, ml::PCLMLTools::ImageToPointCloudConversionParameters::thresholdMin, ml::PCLMLTools::ImageToPointCloudConversionParameters::upperValue, ml::PCLMLTools::ImageToPointCloudConversionParameters::useVectorLengthAsIntensity, ml::TSubImageBox< intT >::v1, ml::TSubImageBox< intT >::v2, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.

Referenced by 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 372 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

Referenced by createPointCloudFromBaseList().

◆ 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 332 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

◆ 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 352 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

◆ 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 317 of file mlPCLMLTools.h.

References ml::XMarker::pos.

◆ 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 527 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

Referenced by convertPointCloudToXMarkerList().

◆ 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 493 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

◆ 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 510 of file mlPCLMLTools.h.

References ml::XMarker::pos, ml::XMarker::type, and ml::XMarker::vec.

◆ 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 480 of file mlPCLMLTools.h.

References ml::XMarker::pos.

◆ convertPointCloudToXMarkerList()

template<typename POINT_CLOUD_TYPE >
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 546 of file mlPCLMLTools.h.

References assignXMarkerFromPointData(), and ml::BaseListTemplate< T >::getItemAt().

◆ createPointCloudFromBaseList()

template<typename POINT_CLOUD_PTR_TYPE >
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 396 of file mlPCLMLTools.h.

References assignPointDataFromXMarker(), ml::BaseListTemplate< T >::getConstItemAt(), ml::PointList::getNum(), ml::VectorList::getNum(), ml::VectorList::getPoint(), ml::PCLSupportTools::getUnsigned32BitMaximumLimit(), ml::PointList::getValue(), ML_BAD_PARAMETER, and ML_PRINT_ERROR.

◆ createPointCloudFromPagedImage()

template<typename POINT_CLOUD_PTR_TYPE >
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 281 of file mlPCLMLTools.h.

References ml::SubImage::allocateAsMemoryBlockHandle(), appendSubImageVoxelsToPointCloud(), ml::ImageProperties::getBoxFromImageExtent(), ml::SubImage::getData(), ml::ImageProperties::getDataType(), ml::SubImage::getExtent(), ml::SubImage::getNumVoxels(), ml::PagedImage::getTile(), ml::PCLSupportTools::getUnsigned32BitMaximumLimit(), ml::MedicalImageProperties::getVoxelToWorldMatrix(), ML_NO_MEMORY, ML_RESULT_OK, ML_RETURN_NULL, transformTo(), ml::PCLMLTools::ImageToPointCloudConversionParameters::transformToWorld, ml::TVector6DBase< CompIntType >::x, ml::TVector6DBase< CompIntType >::y, and ml::TVector6DBase< CompIntType >::z.

◆ 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.

Referenced by appendSubImageVoxelsToPointCloud().

◆ 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 53 of file mlPCLMLTools.h.

◆ setVectorReplacement() [2/2]

template<typename PCL_POINT_TYPE >
void ml::PCLMLTools::setVectorReplacement ( PCL_POINT_TYPE &  p,
const Vector3f vf 
)
inline

Definition at line 60 of file mlPCLMLTools.h.

Referenced by appendSubImageVoxelsToPointCloud().

◆ transformTo()

template<typename POINT_CLOUD_TYPE >
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 128 of file mlPCLMLTools.h.

References ml::Tvec3< DT >::assign(), ml::MedicalImageProperties::mapVoxelToWorld(), ml::MedicalImageProperties::mapWorldToVoxel(), and ml::MedicalImageProperties::setVoxelToWorldMatrix().

Referenced by createPointCloudFromPagedImage().