# filters.miniball

The **Miniball Criterion** was introduced in [Weyrich2004] and is based on the
assumption that points that are distant to the cluster built by their
k-neighborhood are likely to be outliers. First, the smallest enclosing ball is
computed for the k-neighborhood, giving a center point and radius
[Fischer2010]. The miniball criterion is then computed by comparing the
distance (from the current point to the miniball center) to the radius of the
miniball.

The author suggests that the Miniball Criterion is more robust than the Plane Fit Criterion around high-frequency details, but demonstrates poor outlier detection for points close to a smooth surface.

The filter creates a single new dimension, `Miniball`

, that records the
Miniball criterion for the current point.

Note

To inspect the newly created, non-standard dimensions, be sure to write to an output format that can support arbitrary dimensions, such as BPF.

## Example

The sample pipeline below computes the Miniball criterion with a neighborhood of 8 neighbors. We do not apply a fixed threshold to single out outliers based on the Miniball criterion as the range of values can vary from one dataset to another. In general, higher values indicate the likelihood of a point being an outlier.

```
[
"input.las",
{
"type":"filters.miniball",
"knn":8
},
"output.laz"
]
```

## Options

- knn
The number of k nearest neighbors. [Default: 8]

- where
An expression that limits points passed to a filter. Points that don’t pass the expression skip the stage but are available to subsequent stages in a pipeline. [Default: no filtering]

- where_merge
A strategy for merging points skipped by a ‘where’ option when running in standard mode. If

`true`

, the skipped points are added to the first point view returned by the skipped filter. If`false`

, skipped points are placed in their own point view. If`auto`

, skipped points are merged into the returned point view provided that only one point view is returned and it has the same point count as it did when the filter was run. [Default:`auto`

]