dijkstra3d icon indicating copy to clipboard operation
dijkstra3d copied to clipboard

Make euclidean_distance_field Faster

Open william-silversmith opened this issue 5 years ago • 5 comments

Distance field computation seems amenable to a scan-line algorithm and may be a rate-limiting step in Kimimaro.

william-silversmith avatar Feb 16 '20 15:02 william-silversmith

It's possible to exactly compute the distance in a burst from the point, however, the soon as there is a direction change, a more complex algorithm is needed. Since burst would be far faster than dijkstra and could cover large fractions of a shape, doing a hybrid algorithm would be essentially guaranteed to be faster.

william-silversmith avatar Jul 11 '20 03:07 william-silversmith

Can we combine dijkstra with serial free space bursts? The problem is that if there's a loop in the structure, duplicate effort may be required to correctly deal with overlapping empty spaces.

william-silversmith avatar Jul 13 '20 18:07 william-silversmith

Filling then fixing doesn't seem like it makes things much easier. Dijkstra would then have to look for ways to make the field distance larger, but this would cause dijkstra to go haywire.

Might be able to use a similar scanline fill strategy as in fill_voids. However, what would be the stopping criteria? We can try to detect critical regions and stop there?

william-silversmith avatar Jul 14 '20 17:07 william-silversmith

We got a good speedup for somata, but there's still a lot on the table.

william-silversmith avatar Jul 20 '20 16:07 william-silversmith

Got another speedup from prefetching (for sufficiently large images).

william-silversmith avatar Dec 18 '20 06:12 william-silversmith