diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp index 9a372c863..9df1b0618 100644 --- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp +++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp @@ -57,12 +57,16 @@ QString FilterScreenedPoissonPlugin::filterName(FilterIDType filter) const QString FilterScreenedPoissonPlugin::filterInfo(FilterIDType filter) const { if (filter == FP_SCREENED_POISSON) - return "This surface reconstruction algorithm creates watertight surfaces from oriented point sets.\n" - "The filter uses the original code of Michael Kazhdan and Matthew Bolitho implementing the algorithm described in the following paper:\n" - "Michael Kazhdan, Hugues Hoppe,\n" - "\"Screened Poisson surface reconstruction\"\n" - "ACM Trans. Graphics, 32(3), 2013\n" - "WARNING: this filter saves intermediate cache files in the \"working\" folder (last folder used when loading/saving). Be sure you are not working in a READ-ONLY location.\n"; + return "This surface reconstruction algorithm creates watertight surfaces " + "from oriented point sets.
" + "The filter uses the original code of Michael Kazhdan and Matthew Bolitho " + "implementing the algorithm described in the following paper:
" + "Michael Kazhdan, Hugues Hoppe,
" + "\"Screened Poisson surface reconstruction\"
" + "ACM Trans. Graphics, 32(3), 2013

" + "WARNING: this filter saves intermediate cache files in the \"working\" " + "folder (last folder used when loading/saving). Be sure you are not working in " + "a READ-ONLY location.
"; else { return "Error!"; } @@ -82,7 +86,7 @@ MeshFilterInterface::FilterClass FilterScreenedPoissonPlugin::getClass(QAction* int FilterScreenedPoissonPlugin::getRequirements(QAction* a) { if (ID(a) == FP_SCREENED_POISSON){ - + return MeshModel::MM_NONE; } else { assert(0); @@ -92,15 +96,13 @@ int FilterScreenedPoissonPlugin::getRequirements(QAction* a) bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, RichParameterSet& params, vcg::CallBackPos* cb) { - /*bool currDirChanged=false; + bool currDirChanged=false; QDir currDir = QDir::current(); - if (filter == "Surface Reconstruction: Screened Poisson") - { + if (ID(filter) == FP_SCREENED_POISSON) { //check if folder is writable QTemporaryFile file("./_tmp_XXXXXX.tmp"); - if (!file.open()) - { + if (!file.open()) { currDirChanged=true; QTemporaryDir tmpdir; QDir::setCurrent(tmpdir.path()); @@ -110,36 +112,34 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, } PoissonParam pp; - pp.MaxDepthVal = params.evalInt("depth"); - pp.FullDepthVal = params.evalInt("fullDepth"); - pp.CGDepthVal= params.evalInt("cgDepth"); - pp.ScaleVal = params.evalFloat("scale"); - pp.SamplesPerNodeVal = params.evalFloat("samplesPerNode"); - pp.PointWeightVal = params.evalFloat("pointWeight"); - pp.ItersVal = params.evalInt("iters"); - pp.ConfidenceFlag = params.evalBool("confidence"); + pp.MaxDepthVal = params.getInt("depth"); + pp.FullDepthVal = params.getInt("fullDepth"); + pp.CGDepthVal= params.getInt("cgDepth"); + pp.ScaleVal = params.getFloat("scale"); + pp.SamplesPerNodeVal = params.getFloat("samplesPerNode"); + pp.PointWeightVal = params.getFloat("pointWeight"); + pp.ItersVal = params.getInt("iters"); + pp.ConfidenceFlag = params.getBool("confidence"); pp.DensityFlag = true; - pp.CleanFlag = params.evalBool("preClean"); + pp.CleanFlag = params.getBool("preClean"); bool goodNormal=true, goodColor=true; - if(params.evalBool("visibleLayer") == false) - { + if(params.getBool("visibleLayer") == false) { PoissonClean(md.mm()->cm, pp.ConfidenceFlag, pp.CleanFlag); goodNormal=HasGoodNormal(md.mm()->cm); goodColor = md.mm()->hasDataMask(MeshModel::MM_VERTCOLOR); } - else - { - MeshModel *_mm=0; - while(_mm=md.nextVisibleMesh(_mm)) { + else { + MeshModel *_mm=md.nextVisibleMesh(_mm); + while(_mm != nullptr) { PoissonClean(_mm->cm, pp.ConfidenceFlag, pp.CleanFlag); goodNormal &= HasGoodNormal(_mm->cm); goodColor &= _mm->hasDataMask(MeshModel::MM_VERTCOLOR); + _mm=md.nextVisibleMesh(_mm); } } - if(!goodNormal) - { + if(!goodNormal) { this->errorMessage = "Filter requires correct per vertex normals.
" "E.g. it is necessary that your ALL the input vertices have a proper, not-null normal.
" "Try enabling the pre-clean option and retry.

" @@ -153,20 +153,21 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, MeshModel *pm =md.addNewMesh("","Poisson mesh",false); md.setVisible(pm->id(),false); pm->updateDataMask(MeshModel::MM_VERTQUALITY); - if(goodColor) pm->updateDataMask(MeshModel::MM_VERTCOLOR); + if(goodColor) + pm->updateDataMask(MeshModel::MM_VERTCOLOR); - if(params.evalBool("visibleLayer")) - { + if(params.getBool("visibleLayer")) { Box3m bb; - MeshModel *_mm=0; - while(_mm=md.nextVisibleMesh(_mm)) + MeshModel *_mm=md.nextVisibleMesh(_mm); + while(_mm != nullptr){ bb.Add(_mm->cm.Tr,_mm->cm.bbox); + _mm=md.nextVisibleMesh(_mm); + } MeshDocumentPointStream documentStream(md); _Execute >(&documentStream,bb,pm->cm,pp,cb); } - else - { + else { MeshModelPointStream meshStream(md.mm()->cm); _Execute >(&meshStream,md.mm()->cm.bbox,pm->cm,pp,cb); } @@ -176,16 +177,25 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, if(currDirChanged) QDir::setCurrent(currDir.path()); return true; } - return false;*/ + return false; } void FilterScreenedPoissonPlugin::initParameterSet( QAction* filter, - MeshModel& m, - RichParameterSet& parent) + MeshModel&, + RichParameterSet& parlist) { if (ID(filter) == FP_SCREENED_POISSON) { - + parlist.addParam(new RichBool("visibleLayer", false, "Merge all visible layers", "Enabling this flag means that all the visible layers will be used for providing the points.")); + parlist.addParam(new RichInt("depth", 8, "Reconstruction Depth", "This integer is the maximum depth of the tree that will be used for surface reconstruction. Running at depth d corresponds to solving on a voxel grid whose resolution is no larger than 2^d x 2^d x 2^d. Note that since the reconstructor adapts the octree to the sampling density, the specified reconstruction depth is only an upper bound. The default value for this parameter is 8.")); + parlist.addParam(new RichInt("fullDepth", 5, "Adaptive Octree Depth", "This integer specifies the depth beyond depth the octree will be adapted. At coarser depths, the octree will be complete, containing all 2^d x 2^d x 2^d nodes. The default value for this parameter is 5.")); + parlist.addParam(new RichInt("cgDepth", 0, "Conjugate Gradients Depth", "This integer is the depth up to which a conjugate-gradients solver will be used to solve the linear system. Beyond this depth Gauss-Seidel relaxation will be used. The default value for this parameter is 0.")); + parlist.addParam(new RichFloat("scale", 1.1, "Scale Factor", "This floating point value specifies the ratio between the diameter of the cube used for reconstruction and the diameter of the samples' bounding cube. The default value is 1.1.")); + parlist.addParam(new RichFloat("samplesPerNode", 1.5, "Minimum Number of Samples", "This floating point value specifies the minimum number of sample points that should fall within an octree node as the octree construction is adapted to sampling density. For noise-free samples, small values in the range [1.0 - 5.0] can be used. For more noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a smoother, noise-reduced, reconstruction. The default value is 1.5.")); + parlist.addParam(new RichFloat("pointWeight", 4, "Interpolation Weight", "This floating point value specifies the importants that interpolation of the point samples is given in the formulation of the screened Poisson equation. The results of the original (unscreened) Poisson Reconstruction can be obtained by setting this value to 0. The default value for this parameter is 4.")); + parlist.addParam(new RichInt("iters", 8, "Gauss-Seidel Relaxations", "This integer value specifies the number of Gauss-Seidel relaxations to be performed at each level of the hierarchy. The default value for this parameter is 8.")); + parlist.addParam(new RichBool("confidence", false, "Confidence Flag", "Enabling this flag tells the reconstructor to use the quality as confidence information; this is done by scaling the unit normals with the quality values. When the flag is not enabled, all normals are normalized to have unit-length prior to reconstruction.")); + parlist.addParam(new RichBool("preClean", false, "Pre-Clean", "Enabling this flag force a cleaning pre-pass on the data removing all unreferenced vertices or vertices with null normals.")); } } diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h index eb7f858d0..b3dc1543c 100644 --- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h +++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h @@ -53,7 +53,7 @@ public: RichParameterSet& params, vcg::CallBackPos* cb) ; - void initParameterSet(QAction* a,MeshModel& m, RichParameterSet& parent); + void initParameterSet(QAction* a, MeshModel&, RichParameterSet& parlist); int postCondition(QAction* filter) const; FILTER_ARITY filterArity(QAction*) const; };