Removing small objects

Hi,
I’m trying to remove the small objects outside of my main object as seen here in this picture: trabecular_mask.tiff (207.2 KB)

I’ve been using:

trabecular_mask = remove_small_objects(trabecular_mask, min_size=400)

But nothing changes, changing “min_size” doesn’t seem to do anything.
I’ve used the function previously in my code with good results and I’m confused as to why it isnt working now. I’m thinking I’m doing something stupid due to tiredness!
Any help would be much appreciated.

Hi @steersteer I tried it and you need to have quite a large min_size (it measures an area not a radius), with 40000 I could remove both “small” objects.

Maybe we should make it clearer in the docstring that min_size is the total number of pixels of the object and not an equivalent diameter. Of course, pull requests or issues to improve the doc are very much welcome ;-).

Thanks that did it! I was sure I had used much smaller numbers before, maybe I was just getting confused!