bool processShape( const std::string & name, Shape & aShape, double border_min[], double border_max[], double h, const std::string & namePCLFile = "" ) { typedef typename Space::RealPoint RealPoint; typedef typename Space::Integer Integer; typedef GaussDigitizer< Space, Shape > Digitizer; typedef KhalimskySpaceND< Space::dimension, Integer > KSpace; typedef LightImplicitDigitalSurface< KSpace, Digitizer > LightImplicitDigSurface; typedef HyperRectDomain< Space > Domain; typedef DigitalSurface< LightImplicitDigSurface > MyDigitalSurface; typedef typename MyDigitalSurface::ConstIterator ConstIterator; typedef typename KSpace::Surfel Surfel; Digitizer dig; dig.attach( aShape ); dig.init( RealPoint( border_min ), RealPoint( border_max ), h ); Domain domain = dig.getDomain(); typedef typename ImageSelector< Domain, unsigned int >::Type Image; Image image( domain ); DGtal::imageFromRangeAndValue( domain.begin(), domain.end(), image ); KSpace K; bool ok = K.init( domain.lowerBound(), domain.upperBound(), true ); if ( ! ok ) { std::cerr << "[compareShapeEstimators]" << " error in creating KSpace." << std::endl; return false; } try { // Extracts shape boundary SurfelAdjacency< KSpace::dimension > SAdj ( true ); Surfel bel = Surfaces<KSpace>::findABel ( K, dig, 10000 ); LightImplicitDigSurface LightImplDigSurf ( K, dig, SAdj, bel ); MyDigitalSurface surf ( LightImplDigSurf ); typedef typename MyDigitalSurface::ConstIterator SurfelConstIterator; std::ofstream PCL; trace.info() << "Filename = "<<namePCLFile<<std::endl; PCL.open( namePCLFile.c_str() ); //Count the number of points long int cpt=0; for(SurfelConstIterator it = surf.begin(), itend=surf.end(); it != itend; ++it) cpt++; trace.info() << "Surface size = "<<cpt<<std::endl; PCL << "# range size = " << surf.size() << std::endl; PCL << "# h = " << h << std::endl; PCL << "# .PCD v.7 - Point Cloud Data file format"<< std::endl; PCL <<" VERSION .7"<<std::endl; PCL <<" FIELDS x y z"<<std::endl; PCL <<" SIZE 4 4 4 4"<<std::endl; PCL <<" TYPE I I I I"<<std::endl; PCL <<" COUNT 1 1 1 1"<<std::endl; PCL <<" WIDTH "<< cpt <<std::endl; PCL <<" HEIGHT 1"<<std::endl; PCL <<" VIEWPOINT 0 0 0 1 0 0 0"<<std::endl; PCL <<" POINTS "<< cpt <<std::endl; PCL <<" DATA ascii"<<std::endl; PCL <<std::endl; for(SurfelConstIterator it = surf.begin(), itend=surf.end(); it != itend; ++it) PCL << K.sCoord(*it , 0) << " " << K.sCoord(*it , 1) <<" "<< K.sCoord(*it , 2) <<std::endl; PCL.close(); } catch ( InputException e ) { std::cerr << "[estimatorCurvatureComparator3D]" << " error." << e.what() << std::endl; return false; } return true; }