\brief Loads a 3D point cloud from a given fileName, and returns: a * vtkDataSet object containing the point cloud. * \param file_name the name of the file containing the dataset */
| 85 | * \param file_name the name of the file containing the dataset |
| 86 | */ |
| 87 | vtkPolyData* |
| 88 | loadDataSet (const char* file_name) |
| 89 | { |
| 90 | std::string extension = pcl_fs::path (file_name).extension ().string (); |
| 91 | if (extension == ".ply") |
| 92 | { |
| 93 | vtkPLYReader* reader = vtkPLYReader::New (); |
| 94 | reader->SetFileName (file_name); |
| 95 | reader->Update (); |
| 96 | return (reader->GetOutput ()); |
| 97 | } |
| 98 | if (extension == ".vtk") |
| 99 | { |
| 100 | vtkPolyDataReader* reader = vtkPolyDataReader::New (); |
| 101 | reader->SetFileName (file_name); |
| 102 | reader->Update (); |
| 103 | return (reader->GetOutput ()); |
| 104 | } |
| 105 | PCL_ERROR ("Needs a VTK/PLY file to continue.\n"); |
| 106 | return (nullptr); |
| 107 | } |
| 108 | |
| 109 | int |
| 110 | main (int argc, char** argv) |