euclidean-distance-transform-3d icon indicating copy to clipboard operation
euclidean-distance-transform-3d copied to clipboard

Better Algorithm for Voxel Graph

Open william-silversmith opened this issue 4 years ago • 1 comments

Currently, we increase the volume 8x in order to accommodate the voxel graph. For a 512x512x512 uint64 volume, this increases the memory usage.

# Non-Voxel Graph
1 uint64 volume: 1,073 MB
1 float32 output: 536 MB
Total: 1.609 GB

# Current Voxel Graph
1 uint64 volume: 1,073 MB
1 8x uint64 intermediate volume: 8,584 MB
1 8x float32 intermediate output: 4,288 MB
1 uint32 graph: 536 MB
1 float32 output: 536 MB
Total: 15.017 GB

william-silversmith avatar May 17 '21 00:05 william-silversmith

I suspect this could be done with a kind of multi-source dijkstra-like algorithm that colors in the "territory" of a point. When the search encounters another color, you test to see which is the minimum.

This would be roughly:

1 uint64 volume: 1,073 MB
1 uint32 "color" volume: 536 MB
1 uint32 graph: 536 MB
1 float32 output: 536 MB
Total: 2.645 GB

A similar kind of algorithm in dijkstra3d runs at about 4 MVx/sec (42 sec for a 512 cube) while the current 8x algorithm took > 100 sec on a faster machine. I suspect that this would be a bit faster.

william-silversmith avatar May 17 '21 01:05 william-silversmith