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

chords_apply with spacing=0 is incompatible with chords_count #692

Closed
bernarda78 opened this issue May 9, 2022 · 2 comments
Closed

chords_apply with spacing=0 is incompatible with chords_count #692

bernarda78 opened this issue May 9, 2022 · 2 comments

Comments

@bernarda78
Copy link

The issue

I have found an issue with function chords_count on a chord filled image where spacing=0. The issue does not seems to appear when I use a spacing greater than 0.
In my case, I'm interested by chords length in a binary image of 800^3 voxels and I end up with a 10^8 chord length using function chords_count. Similar to this previous issue (#131).

I suspect this commit (6808792) introduced a regression for images that contained chords already labelled. Looking at the history, there seems to be a few back-and-forth commit, making the function unable to works with 0-spaced chord images, even though already labelled.

Possible fix

  • chords_count should check the image to know if it is labelled : a simple check like len(np.unique(im)) > 2 should be enough for most cases. There might a some corners cases that I have not though about.
  • another possibility would be for apply_chords to only return labelled image, as it appears in the code that labels are computed and removed at the end if not asked and remove the labeling in chords_count. This change will probably break backward compatibility.

If you want, I could make the change and a pull request once done.

@jgostick
Copy link
Member

Thanks for this report, and we appreciate the offer of a PR. I will take a look and get back to you.

@ma-sadeghi ma-sadeghi changed the title chords_apply with spacing=0 is incompatible with chords_count chords_apply with spacing=0 is incompatible with chords_count Aug 12, 2022
@jgostick
Copy link
Member

This function worked fine for me:
Figure_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants