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

neuprint: Two fixes #124

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions navis/interfaces/neuprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ def __fetch_mesh(bodyId, *, vol, lod, missing_mesh='raise'):
# Fetch mesh
import cloudvolume
try:
mesh = vol.mesh.get(bodyId, lod=lod)[bodyId]
if lod is None:
mesh = vol.mesh.get(bodyId)
else:
mesh = vol.mesh.get(bodyId, lod=lod)
except cloudvolume.exceptions.MeshDecodeError as err:
if 'not found' in str(err):
if missing_mesh in ['warn', 'skip']:
Expand Down Expand Up @@ -574,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
Loading