Skip to content

Commit

Permalink
Microns interface: fix voxel resolution for soma positions
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Oct 17, 2024
1 parent c8f1427 commit c07cda9
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions navis/interfaces/cave_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ def _get_somas(root_ids, table="nucleus_detection_v0", datastack="cortex65"):
table.
"""
if datastack != "cortex65":
warnings.warn(
"To our knowledge there is no nucleus segmentation "
f'for "{datastack}". If that has changed please '
"get in touch on navis' Github."
)

# Get/Initialize the CAVE client
client = get_cave_client(datastack)

Expand Down Expand Up @@ -161,14 +154,11 @@ def fetch_neurons(x, lod,

vol = _get_cloudvol(client.info.segmentation_source()) # this is cached

if datastack == "cortex65":
try:
somas = _get_somas(x, datastack=datastack)
soma_pos = somas.set_index("pt_root_id").pt_position.to_dict()
except BaseException as e:
logger.warning("Failed to fetch somas via nucleus segmentation" f"(){e})")
soma_pos = {}
else:
try:
somas = _get_somas(x, datastack=datastack)
soma_pos = somas.set_index("pt_root_id").pt_position.to_dict()
except BaseException as e:
logger.warning("Failed to fetch somas via nucleus segmentation" f"(){e})")
soma_pos = {}

nl = []
Expand Down Expand Up @@ -202,7 +192,9 @@ def fetch_neurons(x, lod,

for n in nl:
if n.id in soma_pos:
n.soma_pos = np.array(soma_pos[n.id]) * [8, 8, 33]
# For VoxelResolution see client.materialize.get_table_metadata('nucleus_detection_v0')
# (attached to df as 'table_voxel_resolution')
n.soma_pos = np.array(soma_pos[n.id]) * somas.attrs['table_voxel_resolution']
else:
n.soma_pos = None

Expand Down

0 comments on commit c07cda9

Please sign in to comment.