@@ -18,6 +18,7 @@ def process_animal(
1818 df_detections : pd .DataFrame ,
1919 cfg ,
2020 compute_distributions : bool = True ,
21+ leaf_regions_only : bool = True ,
2122) -> tuple [pd .DataFrame , list [pd .DataFrame ], pd .DataFrame ]:
2223 """
2324 Quantify objects for one animal.
@@ -34,8 +35,11 @@ def process_animal(
3435 cfg : cuisto.Config
3536 The configuration loaded from TOML configuration file.
3637 compute_distributions : bool, optional
37- If False, do not compute the 1D distributions and return an empty list.Default
38+ If False, do not compute the 1D distributions and return an empty list. Default
3839 is True.
40+ leaf_regions_only : bool, optional
41+ If True and a Brainglobe atlas is specified, bar plot per regions will keep only
42+ leaf regions, eg. regions with no child -- if there are any. Default is True.
3943
4044 Returns
4145 -------
@@ -59,7 +63,7 @@ def process_animal(
5963 # add hemisphere
6064 df_annotations = utils .add_hemisphere (df_annotations , cfg .hemispheres ["names" ])
6165 # remove objects in non-leaf regions if any
62- if len (cfg .atlas ["leaveslist" ]) > 0 :
66+ if leaf_regions_only & ( len (cfg .atlas ["leaveslist" ]) > 0 ) :
6367 df_annotations = utils .filter_df_regions (
6468 df_annotations , cfg .atlas ["leaveslist" ], mode = "keep" , col = "Name"
6569 )
@@ -73,7 +77,7 @@ def process_animal(
7377 df_detections = utils .filter_df_classifications (
7478 df_detections , cfg .object_type , mode = "keep" , col = "Classification"
7579 )
76- # remove objects from blacklisted regions and "Root"
80+ # remove objects from blacklisted regions
7781 df_detections = utils .filter_df_regions (
7882 df_detections , cfg .atlas ["blacklist" ], mode = "remove" , col = "Parent"
7983 )
@@ -176,6 +180,7 @@ def process_animals(
176180 cfg ,
177181 out_fmt : str | None = None ,
178182 compute_distributions : bool = True ,
183+ ** kwargs ,
179184) -> tuple [pd .DataFrame ]:
180185 """
181186 Get data from all animals and plot.
@@ -193,7 +198,7 @@ def process_animals(
193198 compute_distributions : bool, optional
194199 If False, do not compute the 1D distributions and return an empty list.Default
195200 is True.
196-
201+ kwargs : passed to cuisto.process.process_animal().
197202
198203 Returns
199204 -------
@@ -247,6 +252,7 @@ def process_animals(
247252 df_detections ,
248253 cfg ,
249254 compute_distributions = compute_distributions ,
255+ ** kwargs ,
250256 )
251257
252258 # collect results
0 commit comments