After creating a binary image, connected clusters thresholding can be used to remove the speckle-like small structures. Here is an [example python script](https://gist.github.com/ofgulban/27c4491592126dce37e97c578cbf307b) to perform connected clusters thresholding from command line. 1. Download the script. 2. In your command line: ``` python /path/to/connected_clusters.py /path/to/image.nii.gz -c 100 ``` 3. For further options: ``` python /path/to/connected_clusters.py -h ``` ___ __TODO:__ I might add this utility to segmentator. The example script is quite slow but does the job.