I have a 3D mask that is "highly textured" and I want to smooth it out, preferably using python scipy.ndimage functions. This is an example cross section. I see scipy.ndimage.binary_erosion and a lot of other binary functions: dilation, fill_holes, opening, closing, and hit_or_miss. Which of these will work best to smooth out my mask? I would like the result to be like this... I tried to call label and eliminate all the small islands, and then call binary_fill_holes, but the result was still very coarse. I was thinking about repeatedly calling erosion and dilation as a way of smoothing, but I think that will tend to remove the "corners" of the shapes. Continue reading...