@@ -17,7 +17,29 @@ def _create_pools(vesicles, table):
1717 return pools , colormap
1818
1919
20- def _visualize_vesicle_pools (input_path , vesicle_path , table_path , segmentation_paths ):
20+ def _parse_tables (table_paths ):
21+ def load_table (path ):
22+ if path .endswith (".csv" ):
23+ return pd .read_csv (path )
24+ elif path .endswith (".xlsx" ):
25+ return pd .read_excel (path )
26+ else :
27+ raise RuntimeError ("Unknown file ending." )
28+
29+ if len (table_paths ) == 1 :
30+ table = load_table (table_paths [0 ])
31+ else :
32+ table = []
33+ for table_path in table_paths :
34+ this_table = load_table (table_path )
35+ pool_name = Path (table_path ).stem
36+ this_table ["pool" ] = [pool_name ] * len (this_table )
37+ table .append (this_table )
38+ table = pd .concat (table )
39+ return table
40+
41+
42+ def _visualize_vesicle_pools (input_path , vesicle_path , table_paths , segmentation_paths ):
2143 # Load the tomogram data, including scale information.
2244 data , voxel_size = read_mrc (input_path )
2345 axes = "zyx" if data .ndim == 3 else "yx"
@@ -27,9 +49,9 @@ def _visualize_vesicle_pools(input_path, vesicle_path, table_path, segmentation_
2749 # Load the vesicle layer.
2850 vesicles = imageio .imread (vesicle_path )
2951
30- # Load the table with the pool assignments.
52+ # Load the tables with the pool assignments.
3153 # Create and add the pool layer.
32- table = pd . read_excel ( table_path )
54+ table = _parse_tables ( table_paths )
3355 pools , colormap = _create_pools (vesicles , table )
3456
3557 viewer = napari .Viewer ()
0 commit comments