pcl::MarchingCubes< PointNT > Class Template Referenceabstract
Module surface

The marching cubes surface reconstruction algorithm. More...

`#include <pcl/surface/marching_cubes.h>`

Inheritance diagram for pcl::MarchingCubes< PointNT >:

## Public Types

typedef boost::shared_ptr< MarchingCubes< PointNT > > | Ptr
typedef boost::shared_ptr< const MarchingCubes< PointNT > > | ConstPtr
typedef pcl::PointCloud< PointNT >::Ptr | PointCloudPtr
typedef pcl::KdTree< PointNT > | KdTree
typedef pcl::KdTree< PointNT >::Ptr | KdTreePtr
Public Types inherited from pcl::SurfaceReconstruction< PointNT >
typedef boost::shared_ptr< SurfaceReconstruction< PointNT > > | Ptr
typedef boost::shared_ptr< const SurfaceReconstruction< PointNT > > | ConstPtr
Public Types inherited from pcl::PCLSurfaceBase< PointNT >
typedef boost::shared_ptr< PCLSurfaceBase< PointNT > > | Ptr
typedef boost::shared_ptr< const PCLSurfaceBase< PointNT > > | ConstPtr
typedef pcl::search::Search< PointNT > | KdTree
typedef pcl::search::Search< PointNT >::Ptr | KdTreePtr
Public Types inherited from pcl::PCLBase< PointNT >
typedef pcl::PointCloud< PointNT > | PointCloud
typedef PointCloud::Ptr | PointCloudPtr
typedef PointCloud::ConstPtr | PointCloudConstPtr
typedef boost::shared_ptr< PointIndices > | PointIndicesPtr
typedef boost::shared_ptr< PointIndices const > | PointIndicesConstPtr

## Public Member Functions

| MarchingCubes ()
| Constructor. More...
virtual | ~MarchingCubes ()
| Destructor. More...
void | setIsoLevel (float iso_level)
| Method that sets the iso level of the surface to be extracted. More...
float | getIsoLevel ()
| Method that returns the iso level of the surface to be extracted. More...
void | setGridResolution (int res_x, int res_y, int res_z)
| Method that sets the marching cubes grid resolution. More...
void | getGridResolution (int &res_x, int &res_y, int &res_z)
| Method to get the marching cubes grid resolution. More...
void | setPercentageExtendGrid (float percentage)
| Method that sets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits. More...
float | getPercentageExtendGrid ()
| Method that gets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box. More...
Public Member Functions inherited from pcl::SurfaceReconstruction< PointNT >
| SurfaceReconstruction ()
| Constructor. More...
virtual | ~SurfaceReconstruction ()
| Destructor. More...
virtual void | reconstruct (pcl::PolygonMesh &output)
| Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> More...
virtual void | reconstruct (pcl::PointCloud< PointNT > &points, std::vector< pcl::Vertices > &polygons)
| Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> More...
Public Member Functions inherited from pcl::PCLSurfaceBase< PointNT >
| PCLSurfaceBase ()
| Empty constructor. More...
virtual | ~PCLSurfaceBase ()
| Empty destructor. More...
void | setSearchMethod (const KdTreePtr &tree)
| Provide an optional pointer to a search object. More...
KdTreePtr | getSearchMethod ()
| Get a pointer to the search method used. More...
Public Member Functions inherited from pcl::PCLBase< PointNT >
| PCLBase ()
| Empty constructor. More...
| PCLBase (const PCLBase &base)
| Copy constructor. More...
virtual | ~PCLBase ()
| Destructor. More...
virtual void | setInputCloud (const PointCloudConstPtr &cloud)
| Provide a pointer to the input dataset. More...
PointCloudConstPtr const | getInputCloud () const
| Get a pointer to the input point cloud dataset. More...
virtual void | setIndices (const IndicesPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (const IndicesConstPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (const PointIndicesConstPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
virtual void | setIndices (size_t row_start, size_t col_start, size_t nb_rows, size_t nb_cols)
| Set the indices for the points laying within an interest region of the point cloud. More...
IndicesPtr const | getIndices ()
| Get a pointer to the vector of indices used. More...
IndicesConstPtr const | getIndices () const
| Get a pointer to the vector of indices used. More...
const PointNT & | operator[] (size_t pos) const
| Override PointCloud operator[] to shorten code. More...

## Protected Member Functions

virtual void | voxelizeData ()=0
| Convert the point cloud into voxel data. More...
void | interpolateEdge (Eigen::Vector3f &p1, Eigen::Vector3f &p2, float val_p1, float val_p2, Eigen::Vector3f &output)
| Interpolate along the voxel edge. More...
void | createSurface (std::vector< float > &leaf_node, Eigen::Vector3i &index_3d, pcl::PointCloud< PointNT > &cloud)
| Calculate out the corresponding polygons in the leaf node. More...
void | getBoundingBox ()
| Get the bounding box for the input data points. More...
virtual float | getGridValue (Eigen::Vector3i pos)
| Method that returns the scalar value at the given grid position. More...
void | getNeighborList1D (std::vector< float > &leaf, Eigen::Vector3i &index3d)
| Method that returns the scalar values of the neighbors of a given 3D position in the grid. More...
std::string | getClassName () const
| Class get name method. More...
virtual void | performReconstruction (pcl::PolygonMesh &output)
| Extract the surface. More...
virtual void | performReconstruction (pcl::PointCloud< PointNT > &points, std::vector< pcl::Vertices > &polygons)
| Extract the surface. More...
Protected Member Functions inherited from pcl::PCLBase< PointNT >
bool | initCompute ()
| This method should get called before starting the actual computation. More...
bool | deinitCompute ()
| This method should get called after finishing the actual computation. More...

## Protected Attributes

std::vector< float > | grid_
| The data structure storing the 3D grid. More...
int | res_x_
| The grid resolution. More...
int | res_y_
int | res_z_
Eigen::Vector4f | min_p_
| Min and max data points. More...
Eigen::Vector4f | max_p_
float | percentage_extend_grid_
| Parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box. More...
float | iso_level_
| The iso level to be extracted. More...
Protected Attributes inherited from pcl::SurfaceReconstruction< PointNT >
bool | check_tree_
| A flag specifying whether or not the derived reconstruction algorithm needs the search object tree. More...
Protected Attributes inherited from pcl::PCLSurfaceBase< PointNT >
KdTreePtr | tree_
| A pointer to the spatial search object. More...
Protected Attributes inherited from pcl::PCLBase< PointNT >
PointCloudConstPtr | input_
| The input point cloud dataset. More...
IndicesPtr | indices_
| A pointer to the vector of point indices to use. More...
bool | use_indices_
| Set to true if point indices are used. More...
bool | fake_indices_
| If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...

## Detailed Description

### template<typename PointNT>
class pcl::MarchingCubes< PointNT >

The marching cubes surface reconstruction algorithm.

This is an abstract class that takes a grid and extracts the isosurface as a mesh, based on the original marching cubes paper:

Lorensen W.E., Cline H.E., "Marching cubes: A high resolution 3d surface construction algorithm", SIGGRAPH '87

Author
  Alexandru E. Ichim

Definition at line 363 of file marching_cubes.h.

## Member Typedef Documentation

## ConstPtr

template<typename PointNT >

typedef boost::shared_ptr<const MarchingCubes<PointNT> > pcl::MarchingCubes< PointNT >::ConstPtr

Definition at line 367 of file marching_cubes.h.

## KdTree

template<typename PointNT >

typedef pcl::KdTree<PointNT> pcl::MarchingCubes< PointNT >::KdTree

Definition at line 374 of file marching_cubes.h.

## KdTreePtr

template<typename PointNT >

typedef pcl::KdTree<PointNT>::Ptr pcl::MarchingCubes< PointNT >::KdTreePtr

Definition at line 375 of file marching_cubes.h.

## PointCloudPtr

template<typename PointNT >

typedef pcl::PointCloud<PointNT>::Ptr pcl::MarchingCubes< PointNT >::PointCloudPtr

Definition at line 372 of file marching_cubes.h.

## Ptr

template<typename PointNT >

typedef boost::shared_ptr<MarchingCubes<PointNT> > pcl::MarchingCubes< PointNT >::Ptr

Definition at line 366 of file marching_cubes.h.

## Constructor & Destructor Documentation

## MarchingCubes()

template<typename PointNT >

pcl::MarchingCubes< PointNT >::MarchingCubes | ( |  | ) |

Constructor.

Definition at line 47 of file marching_cubes.hpp.

## ~MarchingCubes()

template<typename PointNT >

pcl::MarchingCubes< PointNT >::~MarchingCubes | ( |  | ) |

virtual

Destructor.

Definition at line 54 of file marching_cubes.hpp.

## Member Function Documentation

## createSurface()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::createSurface | ( | std::vector< float > & | leaf_node,
|  | Eigen::Vector3i & | index_3d,
|  | pcl::PointCloud< PointNT > & | cloud
| ) |  |

protected

Calculate out the corresponding polygons in the leaf node.

Parameters

  leaf_node | the leaf node to be checked
  index_3d | the 3d index of the leaf node to be checked
  cloud | point cloud to store the vertices of the polygon

Definition at line 100 of file marching_cubes.hpp.

References pcl::edgeTable, pcl::MarchingCubes< PointNT >::interpolateEdge(), pcl::MarchingCubes< PointNT >::iso_level_, pcl::MarchingCubes< PointNT >::max_p_, pcl::MarchingCubes< PointNT >::min_p_, pcl::PointCloud< PointT >::push_back(), pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, pcl::MarchingCubes< PointNT >::res_z_, and pcl::triTable.

Referenced by pcl::MarchingCubes< PointNT >::performReconstruction().

## getBoundingBox()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::getBoundingBox | ( |  | ) |

protected

Get the bounding box for the input data points.

Definition at line 60 of file marching_cubes.hpp.

References pcl::getMinMax3D(), pcl::PCLBase< PointNT >::input_, pcl::MarchingCubes< PointNT >::max_p_, pcl::MarchingCubes< PointNT >::min_p_, and pcl::MarchingCubes< PointNT >::percentage_extend_grid_.

Referenced by pcl::MarchingCubes< PointNT >::performReconstruction().

## getClassName()

template<typename PointNT >

std::string pcl::MarchingCubes< PointNT >::getClassName | ( |  | ) | const

inline protected virtual

Class get name method.

Reimplemented from pcl::PCLSurfaceBase< PointNT >.

Definition at line 495 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::performReconstruction().

Referenced by pcl::MarchingCubes< PointNT >::performReconstruction().

## getGridResolution()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::getGridResolution | ( | int & | res_x,
|  | int & | res_y,
|  | int & | res_z
| ) |  |

inline

Method to get the marching cubes grid resolution.

Parameters

  [in] | res_x | the resolution of the grid along the x-axis
  [in] | res_y | the resolution of the grid along the y-axis
  [in] | res_z | the resolution of the grid along the z-axis

Definition at line 413 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, and pcl::MarchingCubes< PointNT >::res_z_.

## getGridValue()

template<typename PointNT >

float pcl::MarchingCubes< PointNT >::getGridValue | ( | Eigen::Vector3i | pos | ) |

protected virtual

Method that returns the scalar value at the given grid position.

Parameters

  [in] | pos | The 3D position in the grid

TODO what to return?

Definition at line 209 of file marching_cubes.hpp.

References pcl::MarchingCubes< PointNT >::grid_, pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, and pcl::MarchingCubes< PointNT >::res_z_.

Referenced by pcl::MarchingCubes< PointNT >::getNeighborList1D().

## getIsoLevel()

template<typename PointNT >

float pcl::MarchingCubes< PointNT >::getIsoLevel | ( |  | ) |

inline

Method that returns the iso level of the surface to be extracted.

Definition at line 394 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::iso_level_.

## getNeighborList1D()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::getNeighborList1D | ( | std::vector< float > & | leaf,
|  | Eigen::Vector3i & | index3d
| ) |  |

protected

Method that returns the scalar values of the neighbors of a given 3D position in the grid.

Parameters

  [in] | index3d | the point in the grid
  [out] | leaf | the set of values

Definition at line 191 of file marching_cubes.hpp.

References pcl::MarchingCubes< PointNT >::getGridValue().

Referenced by pcl::MarchingCubes< PointNT >::performReconstruction().

## getPercentageExtendGrid()

template<typename PointNT >

float pcl::MarchingCubes< PointNT >::getPercentageExtendGrid | ( |  | ) |

inline

Method that gets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box.

Definition at line 430 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::percentage_extend_grid_.

## interpolateEdge()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::interpolateEdge | ( | Eigen::Vector3f & | p1,
|  | Eigen::Vector3f & | p2,
|  | float | val_p1,
|  | float | val_p2,
|  | Eigen::Vector3f & | output
| ) |  |

protected

Interpolate along the voxel edge.

Parameters

  [in] | p1 | The first point on the edge
  [in] | p2 | The second point on the edge
  [in] | val_p1 | The scalar value at p1
  [in] | val_p2 | The scalar value at p2
  [out] | output | The interpolated point along the edge

Definition at line 87 of file marching_cubes.hpp.

References pcl::MarchingCubes< PointNT >::iso_level_.

Referenced by pcl::MarchingCubes< PointNT >::createSurface().

## performReconstruction() [1/2]

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::performReconstruction | ( | pcl::PolygonMesh & | output | ) |

protected virtual

Extract the surface.

Parameters

  [out] | output | the resultant polygonal mesh

Implements pcl::SurfaceReconstruction< PointNT >.

Definition at line 225 of file marching_cubes.hpp.

References pcl::PolygonMesh::cloud, pcl::MarchingCubes< PointNT >::createSurface(), pcl::PCLPointCloud2::data, pcl::MarchingCubes< PointNT >::getBoundingBox(), pcl::MarchingCubes< PointNT >::getClassName(), pcl::MarchingCubes< PointNT >::getNeighborList1D(), pcl::MarchingCubes< PointNT >::grid_, pcl::PCLPointCloud2::height, pcl::PCLBase< PointNT >::input_, pcl::MarchingCubes< PointNT >::iso_level_, pcl::PolygonMesh::polygons, pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, pcl::MarchingCubes< PointNT >::res_z_, pcl::PointCloud< PointT >::size(), pcl::toPCLPointCloud2(), pcl::PCLSurfaceBase< PointNT >::tree_, pcl::Vertices::vertices, pcl::MarchingCubes< PointNT >::voxelizeData(), and pcl::PCLPointCloud2::width.

Referenced by pcl::MarchingCubes< PointNT >::getClassName().

## performReconstruction() [2/2]

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::performReconstruction | ( | pcl::PointCloud< PointNT > & | points,
|  | std::vector< pcl::Vertices > & | polygons
| ) |  |

protected virtual

Extract the surface.

Parameters

  [out] | points | the points of the extracted mesh
  [out] | polygons | the connectivity between the point of the extracted mesh.

Implements pcl::SurfaceReconstruction< PointNT >.

Definition at line 279 of file marching_cubes.hpp.

References pcl::PointCloud< PointT >::clear(), pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getBoundingBox(), pcl::MarchingCubes< PointNT >::getClassName(), pcl::MarchingCubes< PointNT >::getNeighborList1D(), pcl::MarchingCubes< PointNT >::grid_, pcl::PointCloud< PointT >::height, pcl::PCLBase< PointNT >::input_, pcl::MarchingCubes< PointNT >::iso_level_, pcl::PointCloud< PointT >::points, pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, pcl::MarchingCubes< PointNT >::res_z_, pcl::PointCloud< PointT >::size(), pcl::PCLSurfaceBase< PointNT >::tree_, pcl::Vertices::vertices, pcl::MarchingCubes< PointNT >::voxelizeData(), and pcl::PointCloud< PointT >::width.

## setGridResolution()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::setGridResolution | ( | int | res_x,
|  | int | res_y,
|  | int | res_z
| ) |  |

inline

Method that sets the marching cubes grid resolution.

Parameters

  [in] | res_x | the resolution of the grid along the x-axis
  [in] | res_y | the resolution of the grid along the y-axis
  [in] | res_z | the resolution of the grid along the z-axis

Definition at line 403 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::res_x_, pcl::MarchingCubes< PointNT >::res_y_, and pcl::MarchingCubes< PointNT >::res_z_.

## setIsoLevel()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::setIsoLevel | ( | float | iso_level | ) |

inline

Method that sets the iso level of the surface to be extracted.

Parameters

  [in] | iso_level | the iso level.

Definition at line 389 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::iso_level_.

## setPercentageExtendGrid()

template<typename PointNT >

void pcl::MarchingCubes< PointNT >::setPercentageExtendGrid | ( | float | percentage | ) |

inline

Method that sets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits.

Does not affect the resolution of the grid, it just changes the voxel size accordingly.

Parameters

  [in] | percentage | the percentage of the bounding box that should be left empty between the bounding box and the grid limits.

Definition at line 423 of file marching_cubes.h.

References pcl::MarchingCubes< PointNT >::percentage_extend_grid_.

## voxelizeData()

template<typename PointNT >

virtual void pcl::MarchingCubes< PointNT >::voxelizeData | ( |  | ) |

protected pure virtual

Convert the point cloud into voxel data.

Implemented in pcl::MarchingCubesRBF< PointNT >, and pcl::MarchingCubesHoppe< PointNT >.

Referenced by pcl::MarchingCubes< PointNT >::performReconstruction().

## Member Data Documentation

## grid_

template<typename PointNT >

std::vector<float> pcl::MarchingCubes< PointNT >::grid_

protected

The data structure storing the 3D grid.

Definition at line 435 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::getGridValue(), pcl::MarchingCubes< PointNT >::performReconstruction(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

## iso_level_

template<typename PointNT >

float pcl::MarchingCubes< PointNT >::iso_level_

protected

The iso level to be extracted.

Definition at line 448 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getIsoLevel(), pcl::MarchingCubes< PointNT >::interpolateEdge(), pcl::MarchingCubes< PointNT >::performReconstruction(), and pcl::MarchingCubes< PointNT >::setIsoLevel().

## max_p_

template<typename PointNT >

Eigen::Vector4f pcl::MarchingCubes< PointNT >::max_p_

protected

Definition at line 441 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getBoundingBox(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

## min_p_

template<typename PointNT >

Eigen::Vector4f pcl::MarchingCubes< PointNT >::min_p_

protected

Min and max data points.

Definition at line 441 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getBoundingBox(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

## percentage_extend_grid_

template<typename PointNT >

float pcl::MarchingCubes< PointNT >::percentage_extend_grid_

protected

Parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box.

Definition at line 445 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::getBoundingBox(), pcl::MarchingCubes< PointNT >::getPercentageExtendGrid(), and pcl::MarchingCubes< PointNT >::setPercentageExtendGrid().

## res_x_

template<typename PointNT >

int pcl::MarchingCubes< PointNT >::res_x_

protected

The grid resolution.

Definition at line 438 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getGridResolution(), pcl::MarchingCubes< PointNT >::getGridValue(), pcl::MarchingCubes< PointNT >::performReconstruction(), pcl::MarchingCubes< PointNT >::setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

## res_y_

template<typename PointNT >

int pcl::MarchingCubes< PointNT >::res_y_

protected

Definition at line 438 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getGridResolution(), pcl::MarchingCubes< PointNT >::getGridValue(), pcl::MarchingCubes< PointNT >::performReconstruction(), pcl::MarchingCubes< PointNT >::setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

## res_z_

template<typename PointNT >

int pcl::MarchingCubes< PointNT >::res_z_

protected

Definition at line 438 of file marching_cubes.h.

Referenced by pcl::MarchingCubes< PointNT >::createSurface(), pcl::MarchingCubes< PointNT >::getGridResolution(), pcl::MarchingCubes< PointNT >::getGridValue(), pcl::MarchingCubes< PointNT >::performReconstruction(), pcl::MarchingCubes< PointNT >::setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().

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

- /build/pcl-OilVEB/pcl-1.8.1+dfsg1/surface/include/pcl/surface/marching_cubes.h
- /build/pcl-OilVEB/pcl-1.8.1+dfsg1/surface/include/pcl/surface/impl/marching_cubes.hpp