diff --git a/include/CloudSamplingTools.h b/include/CloudSamplingTools.h index dd48d4e..e286956 100644 --- a/include/CloudSamplingTools.h +++ b/include/CloudSamplingTools.h @@ -151,13 +151,15 @@ namespace CCCoreLib \param nSigma number of sigmas under which the points should be kept \param octree associated octree if available \param progressCb the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) + \param maxThreadCount maximum number of threads to use (0 = max available) \return a reference cloud corresponding to the filtered cloud **/ static ReferenceCloud* sorFilter( GenericIndexedCloudPersist* cloud, int knn = 6, double nSigma = 1.0, DgmOctree* octree = nullptr, - GenericProgressCallback* progressCb = nullptr); + GenericProgressCallback* progressCb = nullptr, + int maxThreadCount = 0); //! Noise filter based on the distance to the approximate local surface /** This filter removes points based on their distance relatively to the best fit plane computed on their neighbors. @@ -171,6 +173,7 @@ namespace CCCoreLib \param absoluteError absolute error (if useAbsoluteError is true) \param octree associated octree if available \param progressCb the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) + \param maxThreadCount maximum number of threads to use (0 = max available) \return a reference cloud corresponding to the filtered cloud **/ static ReferenceCloud* noiseFilter( GenericIndexedCloudPersist* cloud, @@ -182,7 +185,8 @@ namespace CCCoreLib bool useAbsoluteError = true, double absoluteError = 0.0, DgmOctree* octree = nullptr, - GenericProgressCallback* progressCb = nullptr); + GenericProgressCallback* progressCb = nullptr, + int maxThreadCount = 0); protected: diff --git a/src/CloudSamplingTools.cpp b/src/CloudSamplingTools.cpp index 4d0518d..797a9b5 100644 --- a/src/CloudSamplingTools.cpp +++ b/src/CloudSamplingTools.cpp @@ -461,7 +461,8 @@ ReferenceCloud* CloudSamplingTools::sorFilter( GenericIndexedCloudPersist* input int knn/*=6*/, double nSigma/*=1.0*/, DgmOctree* inputOctree/*=nullptr*/, - GenericProgressCallback* progressCb/*=nullptr*/) + GenericProgressCallback* progressCb/*=nullptr*/, + int maxThreadCount/*=0*/) { if (!inputCloud || knn <= 0 || inputCloud->size() <= static_cast(knn)) { @@ -517,7 +518,8 @@ ReferenceCloud* CloudSamplingTools::sorFilter( GenericIndexedCloudPersist* input additionalParameters, true, progressCb, - "SOR filter") == 0) + "SOR filter", + maxThreadCount ) == 0) { //something went wrong break; @@ -579,7 +581,8 @@ ReferenceCloud* CloudSamplingTools::noiseFilter(GenericIndexedCloudPersist* inpu bool useAbsoluteError/*=true*/, double absoluteError/*=0.0*/, DgmOctree* inputOctree/*=nullptr*/, - GenericProgressCallback* progressCb/*=nullptr*/) + GenericProgressCallback* progressCb/*=nullptr*/, + int maxThreadCount/*=0*/) { if (!inputCloud || inputCloud->size() < 2 || (useKnn && knn <= 0) || (!useKnn && kernelRadius <= 0)) { @@ -612,7 +615,7 @@ ReferenceCloud* CloudSamplingTools::noiseFilter(GenericIndexedCloudPersist* inpu } //additional parameters - void* additionalParameters[] = {reinterpret_cast(filteredCloud), + void* additionalParameters[] { reinterpret_cast(filteredCloud), reinterpret_cast(&kernelRadius), reinterpret_cast(&nSigma), reinterpret_cast(&removeIsolatedPoints), @@ -633,7 +636,8 @@ ReferenceCloud* CloudSamplingTools::noiseFilter(GenericIndexedCloudPersist* inpu additionalParameters, true, progressCb, - "Noise filter" ) == 0) + "Noise filter", + maxThreadCount ) == 0) { //something went wrong delete filteredCloud;