Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2011, Dirk Holz, University of Bonn. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 * $Id: vtk_lib_io.h 3009 2011-10-31 23:50:38Z svn $ 00035 * 00036 */ 00037 00038 #ifndef PLC_IO_VTK_LIB_IO_H_ 00039 #define PLC_IO_VTK_LIB_IO_H_ 00040 00041 #include <vtkSmartPointer.h> 00042 #include <vtkPoints.h> 00043 #include <vtkPointData.h> 00044 #include <vtkCellArray.h> 00045 #include <vtkUnsignedCharArray.h> 00046 #include <vtkFloatArray.h> 00047 #include <vtkPolyDataReader.h> 00048 #include <vtkPolyDataWriter.h> 00049 #include <vtkPLYReader.h> 00050 #include <vtkPLYWriter.h> 00051 #include <vtkOBJReader.h> 00052 //#include <vtkOBJExporter.h> 00053 #include <vtkSTLReader.h> 00054 #include <vtkSTLWriter.h> 00055 //#include <vtkVRMLExporter.h> 00056 #include <boost/filesystem.hpp> 00057 00058 #include "pcl/point_types.h" 00059 #include "pcl/point_cloud.h" 00060 #include "pcl/PolygonMesh.h" 00061 #include "pcl/pcl_macros.h" 00062 #include "pcl/ros/conversions.h" 00063 00064 #include "pcl/io/pcd_io.h" 00065 00066 namespace pcl 00067 { 00068 namespace io 00069 { 00070 00071 // /** \brief Saves a PolygonMesh in ascii VTK format. 00072 // * (For compability with (old/pcl_native) vtk_io.h!) 00073 // * \param file_name the name of the file to write to disk 00074 // * \param triangles the polygonal mesh to save 00075 // * \param precision the output ASCII precision 00076 // * \ingroup io 00077 // */ 00078 // PCL_EXPORTS int 00079 // saveVTKFile (const std::string &file_name, const pcl::PolygonMesh &triangles, unsigned precision = 5) 00080 // { 00081 // 00082 // } 00083 00084 00086 00093 PCL_EXPORTS int 00094 vtk2mesh (const vtkSmartPointer<vtkPolyData>& poly_data, pcl::PolygonMesh& mesh); 00095 00102 PCL_EXPORTS int 00103 mesh2vtk (const pcl::PolygonMesh& mesh, vtkSmartPointer<vtkPolyData>& poly_data); 00104 00105 00106 PCL_EXPORTS int 00107 loadPolygonFile (const std::string &file_name, pcl::PolygonMesh& mesh); 00108 00109 PCL_EXPORTS int 00110 savePolygonFile (const std::string &file_name, const pcl::PolygonMesh& mesh); 00111 00112 00113 00114 PCL_EXPORTS int 00115 loadPolygonFileVTK (const std::string &file_name, pcl::PolygonMesh& mesh); 00116 00117 PCL_EXPORTS int 00118 loadPolygonFilePLY (const std::string &file_name, pcl::PolygonMesh& mesh); 00119 00120 PCL_EXPORTS int 00121 loadPolygonFileOBJ (const std::string &file_name, pcl::PolygonMesh& mesh); 00122 00123 PCL_EXPORTS int 00124 loadPolygonFileSTL (const std::string &file_name, pcl::PolygonMesh& mesh); 00125 00126 00127 00128 PCL_EXPORTS int 00129 savePolygonFileVTK (const std::string &file_name, const pcl::PolygonMesh& mesh); 00130 00131 PCL_EXPORTS int 00132 savePolygonFilePLY (const std::string &file_name, const pcl::PolygonMesh& mesh); 00133 00134 PCL_EXPORTS int 00135 savePolygonFileOBJ (const std::string &file_name, const pcl::PolygonMesh& mesh); 00136 00137 PCL_EXPORTS int 00138 savePolygonFileSTL (const std::string &file_name, const pcl::PolygonMesh& mesh); 00139 00140 PCL_EXPORTS int 00141 savePolygonFileWRL (const std::string &file_name, const pcl::PolygonMesh& mesh); 00142 00143 inline int 00144 savePolygonFileVRML (const std::string &file_name, const pcl::PolygonMesh& mesh) 00145 { 00146 return savePolygonFileWRL (file_name, mesh); 00147 } 00148 00149 00150 00160 } 00161 } 00162 00163 #endif /* PLC_IO_VTK_LIB_IO_H_ */