Skip to content

Commit 48c352c

Browse files
committed
Updated documentation
1 parent be63f00 commit 48c352c

File tree

5 files changed

+66
-72
lines changed

5 files changed

+66
-72
lines changed

flamingo_tools/segmentation/cochlea_mapping.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import networkx as nx
55
import numpy as np
66
import pandas as pd
7-
from networkx.algorithms.approximation import steiner_tree
87
from scipy.ndimage import distance_transform_edt, binary_dilation, binary_closing
98
from scipy.interpolate import interp1d
109

@@ -148,10 +147,17 @@ def measure_run_length_sgns(centroids: np.ndarray, scale_factor=10):
148147

149148
def measure_run_length_ihcs(centroids, max_edge_distance=50):
150149
"""Measure the run lengths of the IHC segmentation
151-
by finding the shortest path between the most distant nodes in a Steiner Tree.
150+
by determining the shortest path between the most distant nodes of a graph.
151+
The graph is created based on a maximal edge distance between nodes.
152+
However, this value may not correspond to the max_edge_distance parameter used to process the IHC segmentation,
153+
which may consist of more than one component.
154+
That's why a large max_edge_distance is used to connect different components and identify
155+
the two most distant nodes and the shortest path between them.
156+
The path is then edited using a moving average filter.
152157
153158
Args:
154159
centroids: Centroids of SGN segmentation.
160+
max_edge_distance: Maximal edge distance between graph nodes to create an edge between nodes.
155161
156162
Returns:
157163
Total distance of the path.
@@ -167,6 +173,9 @@ def measure_run_length_ihcs(centroids, max_edge_distance=50):
167173
for num, pos in coords.items():
168174
graph.add_node(num, pos=pos)
169175

176+
# TODO: Find cleaner option than the creation of a new graph with edges
177+
# to identify start / end point and shortest path.
178+
170179
# create edges between points whose distance is less than threshold max_edge_distance
171180
for num_i, pos_i in coords.items():
172181
for num_j, pos_j in coords.items():
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[
22
{
33
"cochlea": "M_LR_000226_L",
4-
"segmentation_channel": "IHC_v3",
4+
"segmentation_channel": "IHC_v4b",
55
"type": "ihc"
66
},
77
{
88
"cochlea": "M_LR_000226_R",
9-
"segmentation_channel": "IHC_v3",
9+
"segmentation_channel": "IHC_v4b",
1010
"type": "ihc"
1111
},
1212
{
1313
"cochlea": "M_LR_000227_L",
14-
"segmentation_channel": "IHC_v3",
14+
"segmentation_channel": "IHC_v4b",
1515
"type": "ihc"
1616
},
1717
{
1818
"cochlea": "M_LR_000227_R",
19-
"segmentation_channel": "IHC_v3",
19+
"segmentation_channel": "IHC_v4b",
2020
"type": "ihc"
2121
}
2222
]

reproducibility/tonotopic_mapping/2025-07-SGN.json

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000143_L",
4+
"segmentation_channel": "SGN_v2",
5+
"type": "sgn"
6+
},
7+
{
8+
"cochlea": "M_LR_000144_L",
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn"
11+
},
12+
{
13+
"cochlea": "M_LR_000145_L",
14+
"segmentation_channel": "SGN_v2",
15+
"type": "sgn"
16+
},
17+
{
18+
"cochlea": "M_LR_000189_L",
19+
"segmentation_channel": "SGN_v2",
20+
"type": "sgn"
21+
},
22+
{
23+
"cochlea": "M_LR_000144_R",
24+
"segmentation_channel": "SGN_v2",
25+
"type": "sgn"
26+
},
27+
{
28+
"cochlea": "M_LR_000145_R",
29+
"segmentation_channel": "SGN_v2",
30+
"type": "sgn"
31+
},
32+
{
33+
"cochlea": "M_LR_000153_R",
34+
"segmentation_channel": "SGN_v2",
35+
"type": "sgn"
36+
},
37+
{
38+
"cochlea": "M_LR_000155_R",
39+
"segmentation_channel": "SGN_v2",
40+
"type": "sgn"
41+
},
42+
{
43+
"cochlea": "M_LR_000189_R",
44+
"segmentation_channel": "SGN_v2",
45+
"type": "sgn"
46+
}
47+
]

reproducibility/tonotopic_mapping/2025-07-SGN_fig2.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
{
33
"cochlea": "M_LR_000226_L",
44
"segmentation_channel": "SGN_v2",
5-
"type": "sgn",
6-
"filter_factor": 0.75
5+
"type": "sgn"
76
},
87
{
98
"cochlea": "M_LR_000226_R",
109
"segmentation_channel": "SGN_v2",
11-
"type": "sgn",
12-
"filter_factor": 0.75
10+
"type": "sgn"
1311
},
1412
{
1513
"cochlea": "M_LR_000227_L",
1614
"segmentation_channel": "SGN_v2",
17-
"type": "sgn",
18-
"max_edge_distance": 70,
19-
"filter_factor": 0.75
15+
"type": "sgn"
2016
},
2117
{
2218
"cochlea": "M_LR_000227_R",
2319
"segmentation_channel": "SGN_v2",
24-
"type": "sgn",
25-
"filter_factor": 0.75
20+
"type": "sgn"
2621
}
2722
]

0 commit comments

Comments
 (0)