netneurolab / netneurotools

Useful tools from the Network Neuroscience Lab
https://netneurolab.github.io/netneurotools
BSD 3-Clause "New" or "Revised" License
57 stars 33 forks source link

Allow return of labelids in find_parcel_centroids #113

Open pvandyken opened 2 years ago

pvandyken commented 2 years ago

I was working with an atlas (Brainnetome) that interleaves nodes from each hemisphere (e.g. 1=L, 2=R, 3=L, 4=R, ...). find_parcel_centroids separates the two hemispheres in its return, such that all nodes from the left hemisphere come first, followed by the right. This disrupts the order of the nodes to something like (1, 3, 5, 7, ..., 2, 4, 6, 8, ...)

To remedy this, I added a flag allowing the return of the label ids associated with each centroid, which in turn can be used to resort everything. The flag is False by default, so there's no breaking change in behaviour.

If you're interested in incorporating this, I'm happy to provide any tests as required, and any additional documentation (although this PR already updates the docstring).