1212ANNOTATION_FOLDERS = ["consensus_annotation" ]
1313
1414
15- def run_evaluation (root , annotation_folders , result_file , cache_folder ):
15+ def run_evaluation (root , annotation_folders , result_file , cache_folder , segmentation_name ):
1616 results = {
1717 "annotator" : [],
1818 "cochlea" : [],
@@ -32,12 +32,12 @@ def run_evaluation(root, annotation_folders, result_file, cache_folder):
3232 print (annotation_path )
3333 cochlea , slice_id = _parse_annotation_path (annotation_path )
3434
35- # For the cochlea M_LR_000226_R the actual component is 2, not 1
36- component = 2 if "226_R" in cochlea else 1
35+ # For the cochlea M_LR_000226_R the actual component is 2, not 1. (Only for IHC_v2).
36+ component = 2 if ( "226_R" in cochlea and segmentation_name == "IHC_v2" ) else 1
3737 print ("Run evaluation for" , annotator , cochlea , "z=" , slice_id )
3838 segmentation , annotations = fetch_data_for_evaluation (
3939 annotation_path , components_for_postprocessing = [component ],
40- seg_name = "IHC_v2" ,
40+ seg_name = segmentation_name ,
4141 cache_path = None if cache_folder is None else os .path .join (cache_folder , f"{ cochlea } _{ slice_id } .tif" )
4242 )
4343 scores = compute_scores_for_annotated_slice (segmentation , annotations , matching_tolerance = 5 )
@@ -59,9 +59,10 @@ def main():
5959 parser .add_argument ("-i" , "--input" , default = ROOT )
6060 parser .add_argument ("--folders" , default = ANNOTATION_FOLDERS )
6161 parser .add_argument ("--result_file" , default = "results.csv" )
62+ parser .add_argument ("--segmentation_name" , default = "IHC_v2" )
6263 parser .add_argument ("--cache_folder" )
6364 args = parser .parse_args ()
64- run_evaluation (args .input , args .folders , args .result_file , args .cache_folder )
65+ run_evaluation (args .input , args .folders , args .result_file , args .cache_folder , args . segmentation_name )
6566
6667
6768if __name__ == "__main__" :
0 commit comments