void run (const char* file_name, float voxel_size) { PointCloud<PointXYZ>::Ptr points_in (new PointCloud<PointXYZ> ()); PointCloud<PointXYZ>::Ptr points_out (new PointCloud<PointXYZ> ()); // Get the points and normals from the input vtk file if ( !vtk_to_pointcloud (file_name, *points_in) ) return; // Build the octree with the desired resolution ORROctree octree; octree.build (*points_in, voxel_size); // Now build the octree z-projection ORROctreeZProjection zproj; zproj.build (octree, 0.15f*voxel_size, 0.15f*voxel_size); // The visualizer PCLVisualizer viz; show_octree(&octree, viz); show_octree_zproj(&zproj, viz); #ifdef _SHOW_POINTS_ // Get the point of every full octree leaf octree.getFullLeafPoints (*points_out); // Add the point clouds viz.addPointCloud (points_in, "cloud in"); viz.addPointCloud (points_out, "cloud out"); // Change the appearance viz.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "cloud in"); viz.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "cloud out"); viz.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_COLOR, 1.0, 0.0, 0.0, "cloud out"); #endif // Enter the main loop while (!viz.wasStopped ()) { //main loop of the visualizer viz.spinOnce (100); boost::this_thread::sleep (boost::posix_time::microseconds (100000)); } }