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)
GNU Lesser General Public License v3.0
356 stars 42 forks source link

Periodic Boundary Conditions #117

Closed william-silversmith closed 5 months ago

william-silversmith commented 5 months ago

Hi,

It means that D(x)=D(x+L), where L is the length of the box along x, so that in the following case:

data = np.array([[3,3,0,3,3]]) labels_out = cc3d.connected_components(data, connectivity=6)

Thereby instead of array([[1,1,0,2,2]], dtype=unit16) it will output array([[1,1,0,1,1]], dtype=unit16) if periodic boundary condition is applied. Maybe this wiki would be helpful in explaining what I meant.

tengssh commented 5 months ago

A simple solution could be to post-process the labels at the boundaries after labelling.

william-silversmith commented 5 months ago

Done! Added 4 and 6 connected support to 3.13.0

tengssh commented 5 months ago

Great! Thank you!

tengssh commented 5 months ago

I will use your citation information if later I publish a paper.