@@ -583,6 +583,7 @@ def equidistant_centers(
583583def tonotopic_mapping (
584584 table : pd .DataFrame ,
585585 component_label : List [int ] = [1 ],
586+ component_mapping : Optional [List [int ]] = None ,
586587 cell_type : str = "ihc" ,
587588 animal : str = "mouse" ,
588589) -> pd .DataFrame :
@@ -592,6 +593,7 @@ def tonotopic_mapping(
592593 Args:
593594 table: Dataframe of segmentation table.
594595 component_label: List of component labels to evaluate.
596+ components_mapping: Components to use for tonotopic mapping. Ignore components torn parallel to main canal.
595597 cell_type: Cell type of segmentation.
596598
597599 Returns:
@@ -602,16 +604,19 @@ def tonotopic_mapping(
602604 centroids = list (zip (new_subset ["anchor_x" ], new_subset ["anchor_y" ], new_subset ["anchor_z" ]))
603605 label_ids = [int (i ) for i in list (new_subset ["label_id" ])]
604606
607+ if component_mapping is None :
608+ component_mapping = component_label
609+
605610 if cell_type == "ihc" :
606611 total_distance , _ , path_dict = measure_run_length_ihcs (centroids , component_label = component_label )
607612
608613 else :
609- if len (component_label ) == 1 :
614+ if len (component_mapping ) == 1 :
610615 total_distance , _ , path_dict = measure_run_length_sgns (centroids )
611616
612617 else :
613618 centroids_components = []
614- for label in component_label :
619+ for label in component_mapping :
615620 subset = table [table ["component_labels" ] == label ]
616621 subset_centroids = list (zip (subset ["anchor_x" ], subset ["anchor_y" ], subset ["anchor_z" ]))
617622 centroids_components .append (subset_centroids )
0 commit comments