Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on the output of contacts #116

Closed
tengssh opened this issue Apr 2, 2024 · 9 comments
Closed

Question on the output of contacts #116

tengssh opened this issue Apr 2, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@tengssh
Copy link

tengssh commented Apr 2, 2024

Hi,

Thank you for cc3d! I find it very helpful and efficient for labelling domains in 3D system.
Maybe I misunderstood the use of "contacts" function, but when I try to input a 3x3x3 array like this:

data = np.ones((3,3,3))
data[1,1,1]=2
labels_out = cc3d.connected_components(data, connectivity=6)
cc3d.contacts(labels_out, connectivity=6, surface_area=True)

and it gives me
{(1,2): 4.0}

Shouldn't it be 6 instead of 4, e.g. top-bottom, front-back, left-right?
Thank you!

@william-silversmith
Copy link
Contributor

Yup, that looks like a bug to me. Let me check it out.

@william-silversmith william-silversmith added the bug Something isn't working label Apr 2, 2024
@william-silversmith
Copy link
Contributor

I've just uploaded a new version to PyPI! Please give it a test and let me know if that solves it for you.

@tengssh
Copy link
Author

tengssh commented Apr 3, 2024

Yes, it solves the problem and the results now make more sense to me.
Btw, would it be possible to implement a periodic boundary condition? I understand that experimental images may not consider it, but having this option for simulations would be cool.
Thank you again for solving this issue!

@tengssh tengssh closed this as completed Apr 3, 2024
@william-silversmith
Copy link
Contributor

william-silversmith commented Apr 3, 2024 via email

@tengssh
Copy link
Author

tengssh commented Apr 3, 2024

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.

@william-silversmith
Copy link
Contributor

Oh I see what you mean. That's an interesting application. I'll consider it.

@william-silversmith
Copy link
Contributor

Would you need support for 6 connected only? It's a lot more tractable to support it for a limited number of connectives. I believe there are 8 separate CCL implementations in the codebase: 4, 8, 6, 18, 26, and three continuous domain versions. I don't think I'd have time to do more than a few of them.

@william-silversmith
Copy link
Contributor

Might be good to continue this conversation here: #117

@tengssh
Copy link
Author

tengssh commented Apr 4, 2024

Would you need support for 6 connected only? It's a lot more tractable to support it for a limited number of connectives. I believe there are 8 separate CCL implementations in the codebase: 4, 8, 6, 18, 26, and three continuous domain versions. I don't think I'd have time to do more than a few of them.

Thank you! I think 6 should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants