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

1D Array of 4 Elements Incorrect #103

Closed
modaresimr opened this issue Nov 19, 2022 · 5 comments
Closed

1D Array of 4 Elements Incorrect #103

modaresimr opened this issue Nov 19, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@modaresimr
Copy link

modaresimr commented Nov 19, 2022

An error occurs when using an array of 4 elements

import numpy as np
import cc3d
labels, seg_count = cc3d.connected_components(np.array([[[1,1,1,1]]]), return_N=True)
labels

output:

[1,0,0,0]

expected output:

[1,1,1,1]
@william-silversmith william-silversmith self-assigned this Nov 19, 2022
@william-silversmith william-silversmith added the bug Something isn't working label Nov 19, 2022
@william-silversmith william-silversmith changed the title [bug] wrong response in cc3d 1D Array of 4 Elements Incorrect Nov 19, 2022
@william-silversmith
Copy link
Contributor

Thank you for reporting this! I'll take a look.

@william-silversmith
Copy link
Contributor

This is due to faulty special handling of single rows of foreground for fast processing. It gets confused between the different orientations of arrays. Will issue a fix soon.

@modaresimr
Copy link
Author

Thank you :-)

@william-silversmith
Copy link
Contributor

Well, that was a subtle bug. 1D arrays are both C and F contiguous. Some parts of the code were checking for if F else and others were doing if C else and this caused 1D arrays to have problems.

@william-silversmith
Copy link
Contributor

Released a fix in 3.10.3. Check it out!

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