Skip to content

Commit 885bad1

Browse files
committed
Tonotopic mapping for OTOF cochleae
1 parent fbb81dd commit 885bad1

File tree

5 files changed

+140
-3
lines changed

5 files changed

+140
-3
lines changed

flamingo_tools/segmentation/cochlea_mapping.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def measure_run_length_ihcs(
519519
return total_distance, path, path_dict
520520

521521

522-
def map_frequency(table: pd.DataFrame, animal: str = "mouse") -> pd.DataFrame:
522+
def map_frequency(table: pd.DataFrame, animal: str = "mouse", otof: bool = False) -> pd.DataFrame:
523523
"""Map the frequency range of SGNs in the cochlea
524524
using Greenwood function f(x) = A * (10 **(ax) - K).
525525
Values for humans: a=2.1, k=0.88, A = 165.4 [kHz].
@@ -543,6 +543,7 @@ def map_frequency(table: pd.DataFrame, animal: str = "mouse") -> pd.DataFrame:
543543
elif animal == "gerbil":
544544
# freq_min = 0.0105 kHz
545545
# freq_max = 43.82 kHz
546+
# values used by keppeler, PNAS 2021 Vol. 118 No. 18, https://doi.org/10.1073/pnas.2014472118
546547
var_A = 0.35
547548
var_a = 2.1
548549
var_k = 0.7
@@ -553,6 +554,17 @@ def map_frequency(table: pd.DataFrame, animal: str = "mouse") -> pd.DataFrame:
553554
table.loc[table['offset'] >= 0, 'frequency[kHz]'] = var_A * (10 ** (var_a * table["length_fraction"]) - var_k)
554555
table.loc[table['offset'] < 0, 'frequency[kHz]'] = 0
555556

557+
if otof and animal == "mouse":
558+
# freq_min = 4.84 kHz
559+
# freq_max = 78.8 kHz
560+
# Mueller, Hearing Research 202 (2005) 63–73, https://doi.org/10.1016/j.heares.2004.08.011
561+
# function has format f(x) = 10 ** (a * (k - (1-x)))
562+
var_a = 100 / 82.5
563+
var_k = 1.565
564+
var_A = 1
565+
table.loc[table['offset'] >= 0, 'frequency-mueller[kHz]'] = var_A * (10 ** (var_a * (var_k - (1 - table["length_fraction"])))) # noqa
566+
table.loc[table['offset'] < 0, 'frequency-mueller[kHz]'] = 0
567+
556568
return table
557569

558570

@@ -727,6 +739,7 @@ def tonotopic_mapping(
727739
animal: str = "mouse",
728740
max_edge_distance: float = 30,
729741
apex_higher: bool = True,
742+
otof: bool = False,
730743
) -> pd.DataFrame:
731744
"""Tonotopic mapping of IHCs by supplying a table with component labels.
732745
The mapping assigns a tonotopic label to each IHC according to the position along the length of the cochlea.
@@ -787,6 +800,6 @@ def tonotopic_mapping(
787800

788801
table.loc[:, "length[µm]"] = table["length_fraction"] * total_distance
789802

790-
table = map_frequency(table, animal=animal)
803+
table = map_frequency(table, animal=animal, otof=otof)
791804

792805
return table
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[
2+
{
3+
"cochlea": "LaVision-OTOF23R",
4+
"image_channel": [
5+
"CR",
6+
"rbOtof",
7+
"IHC_LOWRES-v3"
8+
],
9+
"segmentation_channel": "IHC_LOWRES-v3",
10+
"type": "ihc",
11+
"resolution": [
12+
1.887779,
13+
1.887779,
14+
3.0
15+
],
16+
"n_blocks": 3,
17+
"max_edge_distance": 200,
18+
"component_list": [
19+
4,
20+
18,
21+
7
22+
],
23+
"halo_size": [
24+
256,
25+
256,
26+
48
27+
],
28+
"crop_centers": [
29+
[
30+
1289,
31+
1859,
32+
247
33+
],
34+
[
35+
2308,
36+
3310,
37+
642
38+
],
39+
[
40+
1751,
41+
1140,
42+
710
43+
]
44+
]
45+
}
46+
]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[
2+
{
3+
"cochlea": "LaVision-OTOF25R",
4+
"image_channel": [
5+
"CR",
6+
"rbOtof",
7+
"IHC_LOWRES-v3"
8+
],
9+
"segmentation_channel": "IHC_LOWRES-v3",
10+
"type": "ihc",
11+
"resolution": [
12+
1.887779,
13+
1.887779,
14+
3.0
15+
],
16+
"n_blocks": 3,
17+
"max_edge_distance": 200,
18+
"component_list": [
19+
1
20+
],
21+
"halo_size": [
22+
256,
23+
256,
24+
48
25+
],
26+
"crop_centers": [
27+
[
28+
2803,
29+
2238,
30+
1265
31+
],
32+
[
33+
2781,
34+
3351,
35+
895
36+
],
37+
[
38+
1105,
39+
3380,
40+
1020
41+
],
42+
[
43+
1023,
44+
2197,
45+
1103
46+
],
47+
[
48+
1858,
49+
1507,
50+
993
51+
]
52+
]
53+
}
54+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"cochlea": "LaVision-OTOF25R",
4+
"image_channel": [
5+
"CR",
6+
"rbOtof"
7+
],
8+
"segmentation_channel": "IHC_LOWRES-v3",
9+
"component_list": [
10+
1
11+
],
12+
"resolution" : [
13+
1.887779,
14+
1.887779,
15+
3.0
16+
]
17+
}
18+
]

reproducibility/tonotopic_mapping/repro_tonotopic_mapping.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def repro_tonotopic_mapping(
3535
for dic in param_dicts:
3636
cochlea = dic["cochlea"]
3737
seg_channel = dic["segmentation_channel"]
38+
if "OTOF" in cochlea:
39+
otof = True
40+
else:
41+
otof = False
42+
3843
if cochlea[0] in ["M", "m"]:
3944
animal = "mouse"
4045
elif cochlea[0] in ["G", "g"]:
@@ -71,7 +76,8 @@ def repro_tonotopic_mapping(
7176
if not os.path.isfile(output_table_path) or force_overwrite:
7277
table = tonotopic_mapping(table, component_label=component_list, animal=animal,
7378
cell_type=cell_type, component_mapping=component_mapping,
74-
apex_higher=apex_higher, max_edge_distance=max_edge_distance)
79+
apex_higher=apex_higher, max_edge_distance=max_edge_distance,
80+
otof=otof)
7581

7682
table.to_csv(output_table_path, sep="\t", index=False)
7783

0 commit comments

Comments
 (0)