MeVisLab Toolbox Reference
ml::PCLInventorTools Namespace Reference

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

Enumerations

enum  PCLMFVecStorageTypes {
  StoreIntensitReplacementAsRGB = 0 , StoreIntensitReplacementAsRGBA , UseOnlyRGBA , CopyFromData ,
  CopyFromData_n , CopyDataAndData_n
}
 Describes the way how data combinations of a point cloud are stored in an OpenInventor MFVec field. More...
 

Functions

void setOneMFVecFieldValue (SbVec2f *dstVal, const float data[4])
 Writes data[0] and data[1] to dstVal; data[2] and data[3] are ignored.
 
void setOneMFVecFieldValue (SbVec2f *dstVal, const unsigned int *)
 Implemented for completeness to match all possible template variant, which, however, is not clearly defined, thus it writes (0.f, 0.f) into all entries of *dstVal.
 
void setOneMFVecFieldValue (SbVec2f *dstVal, float data)
 Writes data in the two components of the idx'th value of mField.
 
void setOneMFVecFieldValue (SbVec3f *dstVal, const float data[4])
 Writes data[0], data[1], and data[2] to dstVal; data[3] is ignored.
 
void setOneMFVecFieldValue (SbVec3f *dstVal, const unsigned int *)
 Implemented for completeness to match all possible template variant, which, however, is not clearly defined, thus it writes (0.f, 0.f, 0.f) into all entries of *dstVal.
 
void setOneMFVecFieldValue (SbVec3f *dstVal, float data)
 Writes data in all three components of the idx'th value of mField.
 
void setOneMFVecFieldValue (MLuint32 *dstVal, const float data)
 Special version writing a float to be from [0,256[ as RGBA value with same components
into the idx'th value of mField.
 
void setOneMFVecFieldValue (MLuint32 *dstVal, const float data[4])
 Writes data[0] - data[3] into the idx'th value of mField, data must have at least four values; all other arguments are ignored.
 
void setOneMFVecFieldValue (MLuint32 *dstVal, const unsigned int *rgbaVal)
 Writes swapped *rgbaVal into *dstVal.
 
template<typename DST_VAL_TYPE >
void setOneMFVecFieldValueFromPoint (DST_VAL_TYPE *dstVal, const SpecializedPCLPointXYZ &pnt, bool useData_n)
 Explicit case for PointXYZ (which does not have data_n members) to copy pnt.data[0-2] or pnt.data_n[0-2] dependent on useData_n to dstVal; for useData_n == TRUE (0,0,0) is written.
 
template<typename POINT_TYPE , typename DST_VAL_TYPE >
void setOneMFVecFieldValueFromPoint (DST_VAL_TYPE *dstVal, const POINT_TYPE &pnt, bool useData_n)
 Generic function to copy pnt.data[0-2] or pnt.data_n[0-2] (dependent on useData_n) to dstVal.
 
template<typename DST_VAL_TYPE >
void setTwoMFVecFieldValuesFromPoint (DST_VAL_TYPE *dstVal, const SpecializedPCLPointXYZ &pnt)
 Explicit case for pclPointXYZ which copies pnt.data[0-2] to dstVal and dstVal+1.
 
template<typename POINT_TYPE , typename DST_VAL_TYPE >
void setTwoMFVecFieldValuesFromPoint (DST_VAL_TYPE *dstVal, const POINT_TYPE &pnt)
 Generic function to copy data[0-2] to dstVal and data[0-2}+data_n[0-2] to dstVal+1.
 
MLPCL_InventorAdapters_EXPORT void getRainbowRGB_From0_to_1 (float intensity, float retRGB[3])
 Maps an intensity value from [0,1] to an RGB rainbow value where 0 is mapped to red increasing to green and finally to blue and violet; values outside [0,1] are clamped to the interval borders.
 
template<typename POINT_CLOUD_TYPE , typename SM_MF_VEC_FIELD_TYPE >
size_t setMFVecFromPointCloud (const POINT_CLOUD_TYPE &pointCloud, SM_MF_VEC_FIELD_TYPE &mfvecField, PCLMFVecStorageTypes storageType, bool duplicateColors=false, bool mapToRainbow=false, bool useCurvatureForColor=false, bool scaleFromInputRange=false, float inRangeMin=0.f, float inRangeMax=1.f)
 Converts the point cloud to an Inventor SoMFVec2f, SoMFVec3f, or SoMFUInt32 field; it does not necessarily touch the modified field since it uses Inventor field editing.
 
MLPCL_InventorAdapters_EXPORT void setVertices (const std::vector< pcl::Vertices > &verticesVector, SoMFInt32 &mfIntField, bool terminateWithMinusOne)
 For each entry of verticesVector all indexes of are appended mfIntField and - if terminateWithMinusOne is true - a -1 is also appended.
 

Detailed Description

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

Enumeration Type Documentation

◆ PCLMFVecStorageTypes

Describes the way how data combinations of a point cloud are stored in an OpenInventor MFVec field.

Enumerator
StoreIntensitReplacementAsRGB 

Store the member values of the points, which is considered as an intensity replacement, in the MF vector scaled to the rgb channels with transparency = opaque.

StoreIntensitReplacementAsRGBA 

Store the member values of the points, which is considered as an intensity replacement, in the MF vector scaled to the rgba channels.

UseOnlyRGBA 

If the point is of an RGBA type the rgba member is used for the SoVertexProperty.rgba settings, or 0x00000000 otherwise.

CopyFromData 

The data vector of the points are copied to the MFVec.

CopyFromData_n 

If available then the point values describing the vector are copied, if not then nullptr vectors are used instead.

CopyDataAndData_n 

From each point the point given by point.data followed by another coordinate, which is the result from point point.data+point.data_n, is written to the MFvec.

The resulting number of entries in the MFVec will be twice the number of incoming points.

Definition at line 204 of file mlPCLInventorTools.h.

Function Documentation

◆ getRainbowRGB_From0_to_1()

MLPCL_InventorAdapters_EXPORT void ml::PCLInventorTools::getRainbowRGB_From0_to_1 ( float intensity,
float retRGB[3] )

Maps an intensity value from [0,1] to an RGB rainbow value where 0 is mapped to red increasing to green and finally to blue and violet; values outside [0,1] are clamped to the interval borders.

References getRainbowRGB_From0_to_1().

Referenced by getRainbowRGB_From0_to_1(), and setMFVecFromPointCloud().

◆ setMFVecFromPointCloud()

size_t ml::PCLInventorTools::setMFVecFromPointCloud ( const POINT_CLOUD_TYPE & pointCloud,
SM_MF_VEC_FIELD_TYPE & mfvecField,
PCLMFVecStorageTypes storageType,
bool duplicateColors = false,
bool mapToRainbow = false,
bool useCurvatureForColor = false,
bool scaleFromInputRange = false,
float inRangeMin = 0.f,
float inRangeMax = 1.f )
inline

Converts the point cloud to an Inventor SoMFVec2f, SoMFVec3f, or SoMFUInt32 field; it does not necessarily touch the modified field since it uses Inventor field editing.

Parameters
pointCloudThe point cloud whose point coordinates data or data_n shall be written into mfvecField.
mfvecFieldMust be a SoMFVec2f, SoMFVec3f, or SoMFUInt32. It is the MField into which the data entries from the pointCloud shall be transferred. mfvecField will be resized to the number of written points or to zero if pointCloud is nullptr or empty.
storageTypeDescribes how members of the points are are copied into the mfvecFields, see PCLMFVecStorageTypes for details.
duplicateColorsIf true and storageType is StoreIntensityReplacement, then each color is added twice, i.e. the double number of entries is created. Ignored in all other modes.
mapToRainbowIf true and an intensity is converted to RGB[a], then is is not scaled to same red/green/blue but to a rainbow color map.
useCurvatureForColorIf true then the curvature value is used to determine RGB values (even is otherwise the normal intensity replacement is used).
scaleFromInputRangeIf true then the values are scaled from input range to [0,1] before mapping them to corresponding ranges; if false it is assumed that they are already from that range.
inRangeMinignored if scaleFromInputRange is false, otherwise the interval minimum to scale incoming values from. Must be smaller than inRangeMax or unpredictable error may occur.
inRangeMaxignored if scaleFromInputRange is false, otherwise the interval maximum to scale incoming values from. Must be larger than inRangeMin or unpredictable error may occur.
Returns
The number of points successfully read and copied to the mfvecField.

Definition at line 255 of file mlPCLInventorTools.h.

References CopyDataAndData_n, CopyFromData, CopyFromData_n, getRainbowRGB_From0_to_1(), ML_BAD_PARAMETER, ML_PRINT_ERROR, mlrange_cast(), setMFVecFromPointCloud(), setOneMFVecFieldValue(), setOneMFVecFieldValueFromPoint(), setTwoMFVecFieldValuesFromPoint(), StoreIntensitReplacementAsRGB, StoreIntensitReplacementAsRGBA, and UseOnlyRGBA.

Referenced by setMFVecFromPointCloud().

◆ setOneMFVecFieldValue() [1/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( MLuint32 * dstVal,
const float data )
inline

Special version writing a float to be from [0,256[ as RGBA value with same components
into the idx'th value of mField.

Parameters
dstValdestination value in which data is written as rgba.
datathe input value to be converted to rgba before writing it to dstVal.

Definition at line 116 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [2/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( MLuint32 * dstVal,
const float data[4] )
inline

Writes data[0] - data[3] into the idx'th value of mField, data must have at least four values; all other arguments are ignored.

Parameters
dstValdestination value in which data[0-3] are converted as components.
datathe input values to be converted to the four UInt32 colour components.

Definition at line 128 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [3/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( MLuint32 * dstVal,
const unsigned int * rgbaVal )
inline

Writes swapped *rgbaVal into *dstVal.

Definition at line 139 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [4/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec2f * dstVal,
const float data[4] )
inline

Writes data[0] and data[1] to dstVal; data[2] and data[3] are ignored.

Parameters
dstValdestination value in which data[0] and data[1] are written.
dataprovides the two input values to be written at dstVal.

Definition at line 42 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

Referenced by setMFVecFromPointCloud(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValue(), setOneMFVecFieldValueFromPoint(), setOneMFVecFieldValueFromPoint(), setTwoMFVecFieldValuesFromPoint(), and setTwoMFVecFieldValuesFromPoint().

◆ setOneMFVecFieldValue() [5/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec2f * dstVal,
const unsigned int *  )
inline

Implemented for completeness to match all possible template variant, which, however, is not clearly defined, thus it writes (0.f, 0.f) into all entries of *dstVal.

Parameters
dstValdestination value in which 0 and 0 are written; Arguments rgbaVal is ignored.

Definition at line 53 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [6/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec2f * dstVal,
float data )
inline

Writes data in the two components of the idx'th value of mField.

Parameters
dstValdestination value in which data is written two times.
datathe input value to be written in each of the two components of dstVal.

Definition at line 63 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [7/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec3f * dstVal,
const float data[4] )
inline

Writes data[0], data[1], and data[2] to dstVal; data[3] is ignored.

Parameters
dstValdestination value in which data[0], data[1], and data[2] are written.
dataprovides the three input values to be written at dstVal.

Definition at line 78 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [8/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec3f * dstVal,
const unsigned int *  )
inline

Implemented for completeness to match all possible template variant, which, however, is not clearly defined, thus it writes (0.f, 0.f, 0.f) into all entries of *dstVal.

Parameters
dstValdestination value in which 0, 0, and 0 are written; Arguments rgbaVal is ignored.

Definition at line 89 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValue() [9/9]

void ml::PCLInventorTools::setOneMFVecFieldValue ( SbVec3f * dstVal,
float data )
inline

Writes data in all three components of the idx'th value of mField.

Parameters
dstValdestination value in which data is written three times.
datathe input value to be written in each of the three components of dstVal.

Definition at line 99 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue().

◆ setOneMFVecFieldValueFromPoint() [1/2]

void ml::PCLInventorTools::setOneMFVecFieldValueFromPoint ( DST_VAL_TYPE * dstVal,
const POINT_TYPE & pnt,
bool useData_n )
inline

Generic function to copy pnt.data[0-2] or pnt.data_n[0-2] (dependent on useData_n) to dstVal.

Definition at line 174 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue(), and setOneMFVecFieldValueFromPoint().

◆ setOneMFVecFieldValueFromPoint() [2/2]

template<typename DST_VAL_TYPE >
void ml::PCLInventorTools::setOneMFVecFieldValueFromPoint ( DST_VAL_TYPE * dstVal,
const SpecializedPCLPointXYZ & pnt,
bool useData_n )
inline

Explicit case for PointXYZ (which does not have data_n members) to copy pnt.data[0-2] or pnt.data_n[0-2] dependent on useData_n to dstVal; for useData_n == TRUE (0,0,0) is written.


Definition at line 164 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue(), and setOneMFVecFieldValueFromPoint().

Referenced by setMFVecFromPointCloud(), setOneMFVecFieldValueFromPoint(), and setOneMFVecFieldValueFromPoint().

◆ setTwoMFVecFieldValuesFromPoint() [1/2]

void ml::PCLInventorTools::setTwoMFVecFieldValuesFromPoint ( DST_VAL_TYPE * dstVal,
const POINT_TYPE & pnt )
inline

Generic function to copy data[0-2] to dstVal and data[0-2}+data_n[0-2] to dstVal+1.

Definition at line 193 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue(), and setTwoMFVecFieldValuesFromPoint().

◆ setTwoMFVecFieldValuesFromPoint() [2/2]

template<typename DST_VAL_TYPE >
void ml::PCLInventorTools::setTwoMFVecFieldValuesFromPoint ( DST_VAL_TYPE * dstVal,
const SpecializedPCLPointXYZ & pnt )
inline

Explicit case for pclPointXYZ which copies pnt.data[0-2] to dstVal and dstVal+1.

Definition at line 183 of file mlPCLInventorTools.h.

References setOneMFVecFieldValue(), and setTwoMFVecFieldValuesFromPoint().

Referenced by setMFVecFromPointCloud(), setTwoMFVecFieldValuesFromPoint(), and setTwoMFVecFieldValuesFromPoint().

◆ setVertices()

MLPCL_InventorAdapters_EXPORT void ml::PCLInventorTools::setVertices ( const std::vector< pcl::Vertices > & verticesVector,
SoMFInt32 & mfIntField,
bool terminateWithMinusOne )

For each entry of verticesVector all indexes of are appended mfIntField and - if terminateWithMinusOne is true - a -1 is also appended.

If the number of allowed entries in mfIntField is exceeded then the maximum possible indexes is transferred, the the rest is skipped and an ML error is posted.

References setVertices().

Referenced by setVertices().