Skip to content

Commit 798fbf2

Browse files
committed
fix: post-hoc soma detection acyclicity
1 parent 55d58ee commit 798fbf2

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

notebooks/example.post.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@
10151015
},
10161016
{
10171017
"cell_type": "code",
1018-
"execution_count": 33,
1018+
"execution_count": 32,
10191019
"id": "8e2e1f76",
10201020
"metadata": {},
10211021
"outputs": [
@@ -1035,7 +1035,7 @@
10351035
" 'C': <Axes: label='C', xlabel='z (μm)'>})"
10361036
]
10371037
},
1038-
"execution_count": 33,
1038+
"execution_count": 32,
10391039
"metadata": {},
10401040
"output_type": "execute_result"
10411041
},
@@ -1068,22 +1068,22 @@
10681068
},
10691069
{
10701070
"cell_type": "code",
1071-
"execution_count": null,
1071+
"execution_count": 33,
10721072
"id": "567c6668",
10731073
"metadata": {},
10741074
"outputs": [
10751075
{
10761076
"name": "stdout",
10771077
"output_type": "stream",
10781078
"text": [
1079-
"Last updated: 2025-07-18 12:01:51CEST\n",
1079+
"Last updated: 2025-07-18 12:16:14CEST\n",
10801080
"\n",
10811081
"Python implementation: CPython\n",
10821082
"Python version : 3.11.11\n",
10831083
"IPython version : 9.2.0\n",
10841084
"\n",
1085-
"numpy : 2.3.1\n",
10861085
"skeliner: 0.1.9\n",
1086+
"numpy : 2.3.1\n",
10871087
"\n",
10881088
"Watermark: 2.5.0\n",
10891089
"\n"

skeliner/post.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ def _find_soma(
315315
)
316316
return soma_est, soma_idx, has_soma
317317

318-
# -----------------------------------------------------------------------------
319-
# PUBLIC: detect_soma
320-
# -----------------------------------------------------------------------------
321-
def detect_soma( # noqa: C901 (a bit long but self-contained)
318+
319+
def detect_soma(
322320
skel,
323321
*,
324322
radius_key: str = "median",
@@ -356,7 +354,7 @@ def detect_soma( # noqa: C901 (a bit long but self-contained)
356354
*Either* the original instance (no change was necessary) *or* a new
357355
skeleton whose node 0 is the freshly detected soma centroid.
358356
"""
359-
from .core import Skeleton, Soma
357+
from .core import Skeleton, Soma, _build_mst
360358
if radius_key not in skel.radii:
361359
raise KeyError(
362360
f"radius_key '{radius_key}' not found in skel.radii "
@@ -523,7 +521,7 @@ def detect_soma( # noqa: C901 (a bit long but self-contained)
523521
soma=soma_new,
524522
nodes=nodes,
525523
radii=radii,
526-
edges=edges,
524+
edges=_build_mst(nodes, edges),
527525
ntype=ntype,
528526
node2verts=node2verts,
529527
vert2node=vert2node,

0 commit comments

Comments
 (0)