brainglobe-atlasapi icon indicating copy to clipboard operation
brainglobe-atlasapi copied to clipboard

[Feature] Add an "Out of brain" acronym for the ID 0

Open GuillaumeLeGoc opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. When querying for structures as ID from coordinates, out of bounds coordinates return 0, but when asking for an acronym, it raises a KeyError value.

Describe the solution you'd like Add an acronym to the id 0, named for example "OutOfBrain" or whatever.

Describe alternatives you've considered This can be managed when using the API with a try/catch but I guess it would be nicer if it is handled directly in the bg-atlasapi.

Additional context Code to reproduce the error :

from bg_atlasapi import BrainGlobeAtlas

atlas = BrainGlobeAtlas("kim_mouse_10um", check_latest=False)  # does the same thing with allen_mouse_10um
atlas.structure_from_coords((9386.32578694152, 6137.89857535182, 8869.46676429553), microns=True) # returns 0
atlas.structure_from_coords((9386.32578694152, 6137.89857535182, 8869.46676429553), microns=True, as_acronym=True) # raises KeyError: 0

GuillaumeLeGoc avatar Jul 11 '23 10:07 GuillaumeLeGoc

Thanks for raising this @GuillaumeLeGoc, this is an oversight on our part and should be fixed.

adamltyson avatar Jul 11 '23 11:07 adamltyson