Skip to content

Commit dee53e2

Browse files
Update atlas_fusion.toml, process.py, and pyproject.toml
1 parent 8c0f334 commit dee53e2

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

atlas/atlas_fusion.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
# members = ["MY-mot", "MY-sat"] # existing Allen Brain acronyms that should belong to the new region
99
#
1010
# Then, regions labelled "MY-mot" and "MY-sat" will be labelled "MY" and will join regions already labelled "MY".
11-
# What's in [] does not matter but must be unique and is used to group.
11+
# What's in [] does not matter but must be unique and is used to group each blocks.
1212
# The new "name" and "acronym" can be existing Allen Brain regions or a new (meaningful) one.
13-
# Note that it is case sensitive.
13+
# Notes :
14+
# - It is case sensitive.
15+
# - If a Brainglobe atlas is specified in the configuration file, by default, cuisto will remove any
16+
# non-leaf regions (eg. any regions that have child region in the atlas ontology) *before* the merging
17+
# defined here. This means that if members are non-leaf regions, they will be discarded before the merge
18+
# and NOT be included in the new custom region.
1419

1520
[PHY]
1621
name = "Perihypoglossal nuclei"

cuisto/process.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cuisto"
3-
version = "2025.01.8"
3+
version = "2025.01.9"
44
authors = [{ name = "Guillaume Le Goc", email = "g.legoc@posteo.org" }]
55
description = "Quantification of objects in histological slices"
66
readme = "README.md"

0 commit comments

Comments
 (0)