Hi all, I have done a Sitk.MorphologicalWatershed to my image and got a label image, I find there are some small segments of one or two pixels, or like this little “cross”:
What would be the best filter/way to fill these small holes, I tried Sitk.BinaryFillhole but it doesn’t do much, any other API shall I try? Thanks!
Frequently people look at 2D slices of 3D images, and “identify” holes. The little cross is a morphological hole if the image is 2D, but might be beginning (first slice) of a some 3D pit/cavity.
Take a look at this page. A slice through the middle of the torus would show a big “hole”, which in 3D is just the edge of the torus, and not a hole at all.
Thanks @dchen ! MedianImageFilter seems working for me. Do all the Binary* API assume the input image has one background value and one foreground value (hence binary), so they won’t work well with label image which usually has more values?
Thanks @dzenanz , currently I am working only with single 2D slices, but you have a good point and I will remember it when I start working with 3D images!
I am not sure what segmentation artifact you are trying to address. You may want to look into LabelVoting, or “LabelSet” morphology ( which is not enabled by default in SimpleITK ), or perhaps grayscale morphology operations such as closing or opening would work.
With multi-label images it gets more complicated to fill in holes with just a binary operator. You can set the foreground value, if you’re sure that the holes can never overlap.