Skip to content

Commit e5027a0

Browse files
committed
Updated documentation
1 parent 2114b47 commit e5027a0

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

scripts/measurements/measure_synapses.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@
1212
def check_project(plot=False, save_ihc_table=False, max_dist=None):
1313
s3 = create_s3_target()
1414
cochleae = ['M_LR_000226_L', 'M_LR_000226_R', 'M_LR_000227_L', 'M_LR_000227_R', 'M_AMD_OTOF1_L']
15-
synapse_table_name = "synapse_v3_ihc_v4c"
16-
ihc_table_name = "IHC_v4c"
1715

1816
results = {}
1917
for cochlea in cochleae:
18+
synapse_table_name = "synapse_v3_ihc_v4c"
19+
ihc_table_name = "IHC_v4c"
20+
component_id = [1]
21+
22+
if cochlea == 'M_AMD_OTOF1_L':
23+
synapse_table_name = "synapse_v3_ihc_v4b"
24+
ihc_table_name = "IHC_v4b"
25+
component_id = [3, 11]
26+
2027
content = s3.open(f"{BUCKET_NAME}/{cochlea}/dataset.json", mode="r", encoding="utf-8")
2128
info = json.loads(content.read())
2229
sources = info["sources"]
@@ -38,8 +45,7 @@ def check_project(plot=False, save_ihc_table=False, max_dist=None):
3845
ihc_table = pd.read_csv(table_content, sep="\t")
3946

4047
# Keep only the synapses that were matched to a valid IHC.
41-
component_id = 1
42-
valid_ihcs = ihc_table.label_id[ihc_table.component_labels == component_id].values.astype("int")
48+
valid_ihcs = ihc_table.label_id[ihc_table.component_labels.isin(component_id)].values.astype("int")
4349

4450
valid_syn_table = syn_table[syn_table.matched_ihc.isin(valid_ihcs)]
4551
n_synapses = len(valid_syn_table)

scripts/prediction/postprocess_ihc_synapse.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ def main():
1414
parser = argparse.ArgumentParser(
1515
description="Script to postprocess IHC segmentation based on the number of synapses per IHC.")
1616

17-
parser.add_argument('--base_path', type=str, required=True, help="Base segmentation.")
17+
parser.add_argument('--base_path', type=str, required=True, help="Base segmentation. WARNING: Will be edited.")
1818
parser.add_argument('--ref_path', type=str, required=True, help="Reference segmentation.")
19-
parser.add_argument('--out_path', type=str, required=True, help="Output segmentation.")
19+
parser.add_argument('--out_path_tif', type=str, default=None, help="Output segmentation for tif output.")
2020

2121
parser.add_argument('--base_table', type=str, required=True, help="Synapse per IHC table of base segmentation.")
2222

@@ -42,6 +42,10 @@ def main():
4242

4343
args = parser.parse_args()
4444

45+
if args.tif:
46+
if args.out_path_tif is None:
47+
raise ValueError("Specify out_path_tif for saving TIF file.")
48+
4549
if args.base_key is None:
4650
data_base = read_image_data(args.base_path, args.base_key)
4751
else:
@@ -54,12 +58,12 @@ def main():
5458
if args.crop:
5559
output_ = ihc_synapse_postprocessing.postprocess_ihc_synapse_crop(
5660
data_base, data_ref, table_base=table_base, synapse_limit=25, min_overlap=0.5,
57-
)
61+
)
5862
else:
5963
output_ = ihc_synapse_postprocessing.postprocess_ihc_synapse(
6064
data_base, data_ref, table_base=table_base, synapse_limit=25, min_overlap=0.5,
6165
resolution=0.38, roi_pad=40,
62-
)
66+
)
6367

6468
if args.tif:
6569
imageio.imwrite(args.out_path, output_, compression="zlib")

0 commit comments

Comments
 (0)