Skip to content

Commit e20b8e1

Browse files
committed
SGN subtype annotation
1 parent 6c9a0f2 commit e20b8e1

File tree

7 files changed

+492
-4
lines changed

7 files changed

+492
-4
lines changed

flamingo_tools/measurements.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _regionprops_features(seg_id, table, image, segmentation, resolution, backgr
192192
return features
193193

194194

195-
def get_object_measures_from_table(arr_seg, table):
195+
def get_object_measures_from_table(arr_seg, table, keyword="median"):
196196
"""Return object measurements for label IDs wthin array.
197197
"""
198198
# iterate through segmentation ids in reference mask
@@ -202,11 +202,11 @@ def get_object_measures_from_table(arr_seg, table):
202202
if len(object_ids) < len(ref_ids):
203203
warnings.warn(f"Not all IDs were found in measurement table. Using {len(object_ids)}/{len(ref_ids)}.")
204204

205-
median_values = [table.at[table.index[table["label_id"] == label_id][0], "median"] for label_id in object_ids]
205+
measure_values = [table.at[table.index[table["label_id"] == label_id][0], keyword] for label_id in object_ids]
206206

207207
measures = pd.DataFrame({
208208
"label_id": object_ids,
209-
"median": median_values,
209+
keyword: measure_values,
210210
})
211211
return measures
212212

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000184_L",
4+
"image_channel": [
5+
"PV",
6+
"Prph",
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+
864,
23+
1058,
24+
580
25+
],
26+
[
27+
911,
28+
764,
29+
605
30+
],
31+
[
32+
586,
33+
724,
34+
542
35+
],
36+
[
37+
519,
38+
900,
39+
786
40+
],
41+
[
42+
648,
43+
696,
44+
999
45+
],
46+
[
47+
716,
48+
357,
49+
975
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_000184_R",
4+
"image_channel": [
5+
"PV",
6+
"Prph",
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+
911,
23+
1142,
24+
849
25+
],
26+
[
27+
970,
28+
883,
29+
666
30+
],
31+
[
32+
618,
33+
900,
34+
594
35+
],
36+
[
37+
549,
38+
793,
39+
901
40+
],
41+
[
42+
786,
43+
525,
44+
928
45+
],
46+
[
47+
870,
48+
230,
49+
729
50+
]
51+
]
52+
}
53+
]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000214_L",
4+
"image_channel": [
5+
"PV",
6+
"Calb1",
7+
"CR",
8+
"PV_SGN_v2"
9+
],
10+
"segmentation_channel": "PV_SGN_v2",
11+
"type": "sgn",
12+
"n_blocks": 6,
13+
"halo_size": [
14+
256,
15+
256,
16+
50
17+
],
18+
"component_list": [
19+
1
20+
],
21+
"crop_centers": [
22+
[
23+
617,
24+
914,
25+
690
26+
],
27+
[
28+
614,
29+
709,
30+
477
31+
],
32+
[
33+
311,
34+
747,
35+
472
36+
],
37+
[
38+
283,
39+
634,
40+
772
41+
],
42+
[
43+
424,
44+
332,
45+
780
46+
]
47+
]
48+
}
49+
]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[
2+
{
3+
"cochlea": "M_LR_000214_L",
4+
"image_channel": [
5+
"PV",
6+
"Calb1",
7+
"Lypd1",
8+
"PV_SGN_v2"
9+
],
10+
"segmentation_channel": "PV_SGN_v2",
11+
"type": "sgn",
12+
"n_blocks": 6,
13+
"halo_size": [
14+
256,
15+
256,
16+
50
17+
],
18+
"component_list": [
19+
1
20+
],
21+
"crop_centers": [
22+
[
23+
617,
24+
914,
25+
690
26+
],
27+
[
28+
614,
29+
709,
30+
477
31+
],
32+
[
33+
311,
34+
747,
35+
472
36+
],
37+
[
38+
283,
39+
634,
40+
772
41+
],
42+
[
43+
424,
44+
332,
45+
780
46+
],
47+
[
48+
383,
49+
69,
50+
571
51+
]
52+
]
53+
}
54+
]

scripts/intensity_annotation/gfp_annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def gfp_annotation(prefix, default_stat="median", background_norm=None, is_otof=
149149
stain2_name = "Vglut3"
150150
seg_name = "IHC"
151151

152-
else: # ChReef cochlea with PV, GFPand SGN segmentation
152+
else: # ChReef cochlea with PV, GFP and SGN segmentation
153153
stain1_file = [name for name in file_names if basename in name and "GFP" in name][0]
154154
stain2_file = [name for name in file_names if basename in name and "PV" in name][0]
155155
seg_file = [name for name in file_names if basename in name and "SGN" in name][0]

0 commit comments

Comments
 (0)