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

Bug Report: ‘check_surface’ Function Offset Calculation Issue in ‘images.py’ #227

Open
HollandSun opened this issue Dec 17, 2023 · 0 comments

Comments

@HollandSun
Copy link

HollandSun commented Dec 17, 2023

I have identified a potential bug within the check_surface function of images.py, specifically between lines 297-301. The code segment is designed to prevent the overlapping of labels across hemispheres and to implement a correction mechanism. However, there appears to be an issue with the calculation of the 'offset'. When surface data is entered as 'adata', which is a list comprising two 'nynum' arrays, the 'np.unique(adata)' function does not execute as expected.

offset = len(np.intersect1d(*adata))
if offset > 1:
       offset = len(np.unique(adata)
       adata[1] += offset
       labs[1] = {k + offset: v for k, v in labs[1].items()}

A viable solution would be to modify the calculation of 'offset' to prevent label duplication. Changing line 299 from
offset = len(np.unique(adata)) to offset = len(np.unique(adata[0]))
might resolve the issue, as it would only consider the labels from the first set of the 'adata' list.

Additionally, I've encountered some issues due to the fact that the label encoding in some annot files may include 0. Therefore, the offset setting might need to be slightly larger. It could be consistent to add +1 subsequently.Like this

offset = len(np.intersect1d(*adata))
if offset > 1:
       offset = len(np.unique(adata[0]))
       adata[1] += offset + 1
       labs[1] = {k + offset + 1: v for k, v in labs[1].items()}
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

1 participant