Applies the watershed filter to an image, i.e., separating it in nearly homogeneous regions.
In [1]:
medpy_watershed.py resources/b0.nii.gz output/watershed.nii.gz
Looking at our result we get
To fix this, let's first take a look at the script's parameters.
In [2]:
medpy_watershed.py -h
Note the MINDIST value. With this, the minimal distance between to local minima can be set and thus the minimal size of the regions roughly controlled. let's try it.
In [3]:
medpy_watershed.py resources/b0.nii.gz output/watershed.nii.gz --mindist 10 -f
Original image | Region image | Region image (colored) |
Better. In the colored version, the brain becomes visible.
In [ ]: