DFRemoveStatisticalOutliers component

Contents

_images/icon27.png

DFRemoveStatisticalOutliers component#

Remove statistical outliers from a point cloud.

Inputs:

i_cloud (pointcloud ,item)

The cloud from which statistical outliers should be removed.

i_knn (int ,item)

The number of neighbors to consider when detecting statistical outliers.

i_ratio (float ,item)

The standard deviation threshold for the detection of statistical outliers.

Outputs:

o_cloud

The new cloud with outliers removed.

Code:

#! python3

import Rhino
from ghpythonlib.componentbase import executingcomponent as component

import diffCheck.df_cvt_bindings as cvt

class DFRemoveStatisticalOutliers(component):
    def RunScript(self, i_cloud: Rhino.Geometry.PointCloud, i_knn : int, i_ratio : float):
        if i_cloud is None or i_ratio is None or i_knn is None:
            return None

        df_cloud = cvt.cvt_rhcloud_2_dfcloud(i_cloud)
        df_cloud.remove_statistical_outliers(nb_neighbors=i_knn, std_ratio=i_ratio)
        o_cloud = cvt.cvt_dfcloud_2_rhcloud(df_cloud)

        return o_cloud