seung-lab / kimimaro

Skeletonize densely labeled 3D image segmentations with TEASAR. (Medial Axis Transform)
GNU General Public License v3.0
136 stars 23 forks source link

feat: add fill_holes argument #50

Closed william-silversmith closed 4 years ago

william-silversmith commented 4 years ago

Fills the holes in each connected component and removes components that get filled in. The idea is that holes (or even entirely contained labels) are artifacts in cell segmentations. A common example is a nucleus segmented separately from the rest of the cell or errors in a manual segmentation leaving a void in a dendrite.

This option should be very helpful for newbies to skeletonization. I've interacted with one or two researchers that were getting bad results and on inspection had holes in their segmentation. If this option was default on, it might make the package more intuitive.

On my standard 512x512x512 test volume, this option took about 1m40s to run. On the upside, it should save somata from needing a recalculated EDT (they were already getting their holes filled, but after the EDT was calculated).

william-silversmith commented 4 years ago

Resolves #46 and could subsume #43 #40 in many cases as avocado protection is about trying to decide when to apply fill_voids. However, fixing avocados incurs much lower overhead and is more specific in the kind of defect fixed, so it might still be worth doing.

william-silversmith commented 4 years ago
image

Profile of fill_all_holes by itself.

william-silversmith commented 4 years ago
image

Within the context of a call to skeletonize with fill_holes=True. There's a slight increase in the baseline memory usage compared with fill_all_holes alone.

william-silversmith commented 4 years ago

Actually, just remembered that Avocado protection requires handling somata clipped by the bounding box, so this doesn't really subsume it at all.