seung-lab / connected-components-3d

Connected components on discrete and continuous multilabel 3D & 2D images. Handles 26, 18, and 6 connected variants; periodic boundaries (4, 8, & 6)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

6-connected for DNS

hannahmenke opened this issue · comments

Is it possible to calculate 6-connectivity, or 18 instead of 26? A bit of a departure from brain imaging, but this feature would be very useful for finite volume solvers.

This is a cool use case! I'm not really familiar with these types of analyses, is this the kind of thing you're talking about? https://www3.nd.edu/~gtryggva/MultiphaseDNS/DNS-Solver.pdf

It should be pretty easy to make this. The 6-connected version is simple, and the 18-connected logic is derivative of the 26-connected version.

Yep, that's the idea. The 6-connected output would be very useful for generating the different labels needed for input into each phase since the solvers only compute transport over voxel faces.

Okay! Version 1.4.0 is released with support for 26, 18, and 6 connectivities. I also sped up the region adjacency graph and added 26, 18, and 6 connectivity support for it. You can use it like so:

import cc3d

cc_labels = cc3d.connected_components(labels, connectivity=18)

G = cc3d.region_graph(cc_labels, connectivity=18)

Happy sciencing :)