Skip to content

Commit

Permalink
neuprint: If the segmentation layer has multiple sources, assume we w…
Browse files Browse the repository at this point in the history
…ant the first one.
  • Loading branch information
stuarteberg committed Oct 16, 2023
1 parent 91671f1 commit dde4331
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions navis/interfaces/neuprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,23 @@ def get_seg_source(*, client=None):
if len(named_segs):
segs = named_segs

# Get the first entry
# If there are multiple segmentation layers, select the first entry
seg_source = segs[0]['source']

# Make sure it's actually a string and not a {'source': url, 'subsources'...} dict
# If there are multiple segmentation sources for
# the layer we picked, select the first source.
if isinstance(seg_source, list):
seg_source = seg_source[0]

# If it's a dict like {'source': url, 'subsources'...},
# select the url.
if isinstance(seg_source, dict):
seg_source = seg_source['url']

if not isinstance(seg_source, str):
e = f"Could not understand segmentation source: {seg_source}"
raise RuntimeError(e)

if len(segs) > 1:
logger.warning(f'{len(segs)} segmentation sources found. Using the '
f'first entry: "{seg_source}"')
Expand Down

0 comments on commit dde4331

Please sign in to comment.