Skip to content

Commit 7706f5a

Browse files
committed
Improved block extraction for ChReef
1 parent b1536be commit 7706f5a

File tree

7 files changed

+334
-9
lines changed

7 files changed

+334
-9
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000143_L",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1761,
23+
716,
24+
810
25+
],
26+
[
27+
1637,
28+
795,
29+
854
30+
],
31+
[
32+
1563,
33+
872,
34+
940
35+
],
36+
[
37+
1432,
38+
939,
39+
940
40+
],
41+
[
42+
1284,
43+
950,
44+
912
45+
],
46+
[
47+
1180,
48+
900,
49+
815
50+
]
51+
]
52+
}
53+
]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000144_L",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1762,
23+
598,
24+
666
25+
],
26+
[
27+
1441,
28+
526,
29+
738
30+
],
31+
[
32+
1352,
33+
848,
34+
696
35+
],
36+
[
37+
1500,
38+
924,
39+
972
40+
],
41+
[
42+
1357,
43+
716,
44+
1185
45+
],
46+
[
47+
1050,
48+
629,
49+
1309
50+
]
51+
]
52+
}
53+
]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000145_L",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1080,
23+
849,
24+
700
25+
],
26+
[
27+
1034,
28+
557,
29+
603
30+
],
31+
[
32+
815,
33+
523,
34+
857
35+
],
36+
[
37+
625,
38+
769,
39+
775
40+
],
41+
[
42+
560,
43+
662,
44+
457
45+
],
46+
[
47+
442,
48+
339,
49+
420
50+
]
51+
]
52+
}
53+
]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000153_R",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1859,
23+
349,
24+
633
25+
],
26+
[
27+
1610,
28+
550,
29+
817
30+
],
31+
[
32+
1241,
33+
518,
34+
851
35+
],
36+
[
37+
1123,
38+
510,
39+
529
40+
],
41+
[
42+
1240,
43+
820,
44+
476
45+
],
46+
[
47+
1072,
48+
990,
49+
673
50+
]
51+
]
52+
}
53+
]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000189_L",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1511,
23+
1010,
24+
1215
25+
],
26+
[
27+
1355,
28+
964,
29+
929
30+
],
31+
[
32+
1169,
33+
959,
34+
1147
35+
],
36+
[
37+
1329,
38+
693,
39+
1220
40+
],
41+
[
42+
1327,
43+
504,
44+
934
45+
],
46+
[
47+
1100,
48+
499,
49+
670
50+
]
51+
]
52+
}
53+
]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000189_R",
4+
"image_channel": [
5+
"PV",
6+
"GFP",
7+
"SGN_v2"
8+
],
9+
"segmentation_channel": "SGN_v2",
10+
"type": "sgn",
11+
"n_blocks": 6,
12+
"halo_size": [
13+
256,
14+
256,
15+
50
16+
],
17+
"component_list": [
18+
1
19+
],
20+
"crop_centers": [
21+
[
22+
1493,
23+
568,
24+
1136
25+
],
26+
[
27+
1280,
28+
600,
29+
1341
30+
],
31+
[
32+
1457,
33+
723,
34+
1498
35+
],
36+
[
37+
1494,
38+
1004,
39+
1388
40+
],
41+
[
42+
1199,
43+
1080,
44+
1300
45+
],
46+
[
47+
914,
48+
1080,
49+
1459
50+
]
51+
]
52+
}
53+
]

reproducibility/block_extraction/repro_equidistant_centers.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def repro_equidistant_centers(
1818
):
1919
default_cell_type = "ihc"
2020
default_component_list = [1]
21-
default_halo_size = [256, 256, 50]
21+
default_halo_size = [256, 256, 128]
2222
default_n_blocks = 6
2323

2424
with open(ddict, 'r') as myfile:
@@ -30,6 +30,14 @@ def repro_equidistant_centers(
3030
if os.path.isfile(output_path) and not force_overwrite:
3131
print(f"Skipping {output_path}. File already exists.")
3232

33+
def update_dic(dic, keyword, default):
34+
if keyword in dic:
35+
value = dic[keyword]
36+
else:
37+
value = default
38+
dic[keyword] = value
39+
return value
40+
3341
for dic in param_dicts:
3442
cochlea = dic["cochlea"]
3543
seg_channel = dic["segmentation_channel"]
@@ -42,17 +50,16 @@ def repro_equidistant_centers(
4250
with fs.open(tsv_path, 'r') as f:
4351
table = pd.read_csv(f, sep="\t")
4452

45-
cell_type = dic["type"] if "type" in dic else default_cell_type
46-
component_list = dic["component_list"] if "component_list" in dic else default_component_list
47-
halo_size = dic["halo_size"] if "halo_size" in dic else default_halo_size
48-
n_blocks = dic["n_blocks"] if "n_blocks" in dic else default_n_blocks
53+
cell_type = update_dic(dic, "type", default_cell_type)
54+
component_list = update_dic(dic, "component_list", default_component_list)
55+
_ = update_dic(dic, "halo_size", default_halo_size)
56+
n_blocks = update_dic(dic, "n_blocks", default_n_blocks)
4957

5058
centers = equidistant_centers(table, component_label=component_list, cell_type=cell_type, n_blocks=n_blocks)
5159
centers = [[int(c) for c in center] for center in centers]
52-
ddict = dic.copy()
53-
ddict["crop_centers"] = centers
54-
ddict["halo_size"] = halo_size
55-
out_dict.append(ddict)
60+
61+
dic["crop_centers"] = centers
62+
out_dict.append(dic)
5663

5764
with open(output_path, "w") as f:
5865
json.dump(out_dict, f, indent='\t', separators=(',', ': '))

0 commit comments

Comments
 (0)