ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cc2smReader Class Reference

CC to PCL cloud converter. More...

#include <cc2sm.h>

Collaboration diagram for cc2smReader:

Public Types

enum  Fields {
  COORD_X , COORD_Y , COORD_Z , NORM_X ,
  NORM_Y , NORM_Z
}
 

Public Member Functions

 cc2smReader (bool showMode=false)
 
 cc2smReader (const ccPointCloud *cc_cloud, bool showMode=false)
 
PCLCloud::Ptr getGenericField (std::string field_name) const
 
unsigned getvisibilityNum () const
 
PCLCloud::Ptr getXYZ () const
 
pcl::PointCloud< pcl::PointXYZ >::Ptr getXYZ2 () const
 
PCLCloud::Ptr getNormals () const
 
PCLCloud::Ptr getPointNormals () const
 
PCLCloud::Ptr getColors () const
 
bool getvtkScalars (vtkSmartPointer< vtkDataArray > &scalars, bool sfColors) const
 Obtain the actual color for the input dataset as vtk scalars. More...
 
PCLCloud::Ptr getOneOf (Fields field) const
 
PCLCloud::Ptr getFloatScalarField (const std::string &field_name) const
 
PCLCloud::Ptr getAsSM (std::list< std::string > &requested_fields) const
 
PCLCloud::Ptr getAsSM (bool ignoreScalars=false) const
 Converts all the data in a ccPointCloud to a sesor_msgs::PointCloud2. More...
 
PCLCloud::Ptr getAsSM (bool xyz, bool normals, bool rgbColors, const QStringList &scalarFields) const
 
pcl::PointCloud< pcl::PointXYZ >::Ptr getRawXYZ () const
 Converts the ccPointCloud to a 'pcl::PointXYZ' cloud. More...
 
pcl::PointCloud< pcl::PointNormal >::Ptr getAsPointNormal () const
 Converts the ccPointCloud to a 'pcl::PointNormal' cloud. More...
 
PCLCloud::Ptr getVtkPolyDataAsSM (vtkPolyData *const polydata) const
 
PCLMesh::Ptr getVtkPolyDataAsPclMesh (vtkPolyData *const polydata) const
 
PCLMesh::Ptr getPclMesh (ccGenericMesh *mesh)
 
PCLTextureMesh::Ptr getPclTextureMesh (ccGenericMesh *mesh)
 
PCLPolygon::Ptr getPclPolygon (ccPolyline *polyline) const
 
bool getPclCloud2 (ccGenericMesh *mesh, PCLCloud &cloud) const
 
bool getVtkPolyDataFromMeshCloud (ccGenericMesh *mesh, vtkSmartPointer< vtkPolyData > &polydata) const
 Convert ccGenericMesh to vtkPolyData using same logic as getPclCloud2 Direct conversion without PCL intermediate format for efficiency. More...
 
bool getVtkPolyDataWithTextures (ccGenericMesh *mesh, vtkSmartPointer< vtkPolyData > &polydata, vtkSmartPointer< vtkMatrix4x4 > &transformation, std::vector< std::vector< Eigen::Vector2f >> &tex_coordinates)
 Convert ccGenericMesh to vtkPolyData with texture coordinates Reuses getPclTextureMesh logic to ensure consistency. More...
 

Static Public Member Functions

static std::string GetSimplifiedSFName (const std::string &ccSfName)
 
static void ConVertToPCLMaterial (ccMaterial::CShared inMaterial, PCLMaterial &outMaterial)
 

Protected Member Functions

bool checkIfFieldExists (const std::string &field_name) const
 

Protected Attributes

const ccPointCloudm_cc_cloud
 Associated cloud. More...
 
bool m_showMode
 
bool m_partialVisibility
 
unsigned m_visibilityNum
 

Detailed Description

CC to PCL cloud converter.

Definition at line 43 of file cc2sm.h.

Member Enumeration Documentation

◆ Fields

Enumerator
COORD_X 
COORD_Y 
COORD_Z 
NORM_X 
NORM_Y 
NORM_Z 

Definition at line 63 of file cc2sm.h.

Constructor & Destructor Documentation

◆ cc2smReader() [1/2]

cc2smReader::cc2smReader ( bool  showMode = false)
explicit

Definition at line 54 of file cc2sm.cpp.

◆ cc2smReader() [2/2]

cc2smReader::cc2smReader ( const ccPointCloud cc_cloud,
bool  showMode = false 
)
explicit

Member Function Documentation

◆ checkIfFieldExists()

bool cc2smReader::checkIfFieldExists ( const std::string &  field_name) const
protected

◆ ConVertToPCLMaterial()

◆ getAsPointNormal()

pcl::PointCloud< pcl::PointNormal >::Ptr cc2smReader::getAsPointNormal ( ) const

◆ getAsSM() [1/3]

PCLCloud::Ptr cc2smReader::getAsSM ( bool  ignoreScalars = false) const

Converts all the data in a ccPointCloud to a sesor_msgs::PointCloud2.

This is useful for saving a ccPointCloud into a PCD file. For pcl filters other methods are suggested (to get only the necessary bits of data)

Definition at line 684 of file cc2sm.cpp.

References fields, getAsSM(), cloudViewer::ScalarField::getName(), cloudViewer::PointCloudTpl< T >::getNumberOfScalarFields(), cloudViewer::PointCloudTpl< T >::getScalarField(), ccPointCloud::hasColors(), ccPointCloud::hasNormals(), m_cc_cloud, and cloudViewer::PointCloudTpl< T >::size().

◆ getAsSM() [2/3]

PCLCloud::Ptr cc2smReader::getAsSM ( bool  xyz,
bool  normals,
bool  rgbColors,
const QStringList &  scalarFields 
) const

◆ getAsSM() [3/3]

◆ getColors()

◆ getFloatScalarField()

◆ getGenericField()

PCLCloud::Ptr cc2smReader::getGenericField ( std::string  field_name) const

Definition at line 82 of file cc2sm.cpp.

References COORD_X, COORD_Y, getColors(), getFloatScalarField(), getNormals(), getOneOf(), getXYZ(), NORM_X, NORM_Y, and NORM_Z.

Referenced by getAsSM().

◆ getNormals()

◆ getOneOf()

◆ getPclCloud2()

◆ getPclMesh()

◆ getPclPolygon()

◆ getPclTextureMesh()

◆ getPointNormals()

PCLCloud::Ptr cc2smReader::getPointNormals ( ) const

Definition at line 307 of file cc2sm.cpp.

References getNormals(), getXYZ(), and normals.

◆ getRawXYZ()

pcl::PointCloud< pcl::PointXYZ >::Ptr cc2smReader::getRawXYZ ( ) const

◆ GetSimplifiedSFName()

std::string cc2smReader::GetSimplifiedSFName ( const std::string &  ccSfName)
static

Definition at line 432 of file cc2sm.cpp.

Referenced by MLSSmoothingUpsampling::compute(), and getFloatScalarField().

◆ getvisibilityNum()

unsigned cc2smReader::getvisibilityNum ( ) const

◆ getVtkPolyDataAsPclMesh()

PCLMesh::Ptr cc2smReader::getVtkPolyDataAsPclMesh ( vtkPolyData *const  polydata) const

Definition at line 882 of file cc2sm.cpp.

◆ getVtkPolyDataAsSM()

PCLCloud::Ptr cc2smReader::getVtkPolyDataAsSM ( vtkPolyData *const  polydata) const

Definition at line 849 of file cc2sm.cpp.

References colors, normals, and TO_PCL_CLOUD.

◆ getVtkPolyDataFromMeshCloud()

bool cc2smReader::getVtkPolyDataFromMeshCloud ( ccGenericMesh mesh,
vtkSmartPointer< vtkPolyData > &  polydata 
) const

Convert ccGenericMesh to vtkPolyData using same logic as getPclCloud2 Direct conversion without PCL intermediate format for efficiency.

Parameters
meshInput mesh
polydataOutput VTK polydata (will be created)
Returns
true on success
Note
This method uses the same point indexing as getPclCloud2: pointIndex = n * dimension + vertexIndex This ensures consistency with getPclTextureMesh

Definition at line 1121 of file cc2sm.cpp.

References colors, ccDrawableObject::colorsShown(), ccGenericMesh::getAssociatedCloud(), ccPointCloud::getCurrentDisplayedScalarField(), ccPointCloud::getCurrentDisplayedScalarFieldIndex(), cloudViewer::VerticesIndexes::getDimension(), ccObject::getName(), ccNormalVectors::GetNormal(), ccNormalVectors::getNormal(), cloudViewer::PointCloudTpl< T >::getPoint(), cloudViewer::PointCloudTpl< T >::getScalarFieldName(), ccGenericPointCloud::getTheVisibilityArray(), ccGenericMesh::getTriangleNormalIndexes(), cloudViewer::GenericIndexedMesh::getTriangleVertIndexes(), ccGenericMesh::getTriNormsTable(), ccNormalVectors::GetUniqueInstance(), ccScalarField::getValueColor(), ccDrawableObject::hasColors(), ccDrawableObject::hasDisplayedScalarField(), ccDrawableObject::hasNormals(), ccGenericMesh::hasTriNormals(), cloudViewer::VerticesIndexes::i, cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_cc_cloud, ccPointCloud::normals(), normals, ccDrawableObject::normalsShown(), POINT_VISIBLE, CVLog::PrintDebug(), rgb, ccPointCloud::rgbColors(), ccDrawableObject::sfShown(), cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), ccHObjectCaster::ToPointCloud(), ccGenericMesh::triNormsShown(), Tuple3Tpl< Type >::u, CVLog::Warning(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by getVtkPolyDataWithTextures().

◆ getVtkPolyDataWithTextures()

bool cc2smReader::getVtkPolyDataWithTextures ( ccGenericMesh mesh,
vtkSmartPointer< vtkPolyData > &  polydata,
vtkSmartPointer< vtkMatrix4x4 > &  transformation,
std::vector< std::vector< Eigen::Vector2f >> &  tex_coordinates 
)

Convert ccGenericMesh to vtkPolyData with texture coordinates Reuses getPclTextureMesh logic to ensure consistency.

Parameters
meshInput mesh
polydataOutput VTK polydata (will be created)
transformationOutput transformation matrix (will be created)
tex_coordinatesOutput texture coordinates grouped by material index
Returns
true on success
Note
This method reuses getPclTextureMesh logic to ensure texture coordinate mapping is consistent with addTextureMesh interface

Definition at line 1566 of file cc2sm.cpp.

References ccGenericMesh::getAssociatedCloud(), cloudViewer::VerticesIndexes::getDimension(), ccGenericMesh::getMaterialSet(), ccObject::getMetaData(), ccObject::getName(), ccGenericPointCloud::getTheVisibilityArray(), ccGenericMesh::getTriangleMtlIndex(), ccGenericMesh::getTriangleTexCoordinates(), cloudViewer::GenericIndexedMesh::getTriangleVertIndexes(), getVtkPolyDataFromMeshCloud(), ccGenericMesh::hasMaterials(), ccGenericMesh::hasTextures(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, ccGenericMesh::materialsShown(), POINT_VISIBLE, cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), TexCoords2D::tx, TexCoords2D::ty, and CVLog::Warning().

Referenced by PclUtils::PCLVis::addTextureMeshFromCCMesh(), and PclUtils::renders::MeshTextureApplier::ApplyTexturesFromCCMesh().

◆ getvtkScalars()

bool cc2smReader::getvtkScalars ( vtkSmartPointer< vtkDataArray > &  scalars,
bool  sfColors 
) const

Obtain the actual color for the input dataset as vtk scalars.

Parameters
[out]scalarsthe output scalars containing the color for the dataset
Returns
true if the operation was successful (the handler is capable and the input cloud was given as a valid pointer), false otherwise

Definition at line 366 of file cc2sm.cpp.

References colors, ccPointCloud::getCurrentDisplayedScalarFieldIndex(), ccPointCloud::getPointColor(), cloudViewer::PointCloudTpl< T >::getScalarField(), ccPointCloud::getScalarValueColor(), ccGenericPointCloud::getTheVisibilityArray(), cloudViewer::ScalarField::getValue(), ccPointCloud::hasColors(), ccPointCloud::hasScalarFields(), m_cc_cloud, m_partialVisibility, m_visibilityNum, POINT_VISIBLE, rgb, and cloudViewer::PointCloudTpl< T >::size().

◆ getXYZ()

PCLCloud::Ptr cc2smReader::getXYZ ( ) const

Definition at line 254 of file cc2sm.cpp.

References getXYZ2(), and TO_PCL_CLOUD.

Referenced by getAsSM(), getGenericField(), and getPointNormals().

◆ getXYZ2()

Member Data Documentation

◆ m_cc_cloud

◆ m_partialVisibility

bool cc2smReader::m_partialVisibility
protected

◆ m_showMode

bool cc2smReader::m_showMode
protected

Definition at line 139 of file cc2sm.h.

Referenced by getFloatScalarField().

◆ m_visibilityNum

unsigned cc2smReader::m_visibilityNum
protected

The documentation for this class was generated from the following files: