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

API proposal/discussion: make hrdic.Map.__getitem__ work like a dictionary instead of a list #102

Open
jni opened this issue Feb 22, 2023 · 1 comment

Comments

@jni
Copy link

jni commented Feb 22, 2023

Currently, the indices to get grains out of hrdic.Map are off by one relative to the integer IDs in the hrdic.Map.grains image. That is, hrdic.Map[0] gets the grain that has value 1 in the image, hrdic.Map[1] gets the grain with value 2, and so on. (And this might be incorrect if the grains array has non-contiguous labels, not sure.) This is confusing! I understand that this is perhaps inherited from or inspired by skimage.measure.regionprops, but over there we regret that API choice and will probably move to a dictionary-like API with the label as the key in a later version.

Would there be interest in taking the same approach here?

@rhysgt
Copy link
Contributor

rhysgt commented Apr 26, 2024

We should definitely implement this - I've been caught out by the values in hrdic.Map.grains being off by one compared to indices in a hrdic.Map...

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