Skip to content

Commit

Permalink
Update atlas_fusion.toml, process.py, and pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeLeGoc committed Jan 9, 2025
1 parent 8c0f334 commit dee53e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions atlas/atlas_fusion.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
# members = ["MY-mot", "MY-sat"] # existing Allen Brain acronyms that should belong to the new region
#
# Then, regions labelled "MY-mot" and "MY-sat" will be labelled "MY" and will join regions already labelled "MY".
# What's in [] does not matter but must be unique and is used to group.
# What's in [] does not matter but must be unique and is used to group each blocks.
# The new "name" and "acronym" can be existing Allen Brain regions or a new (meaningful) one.
# Note that it is case sensitive.
# Notes :
# - It is case sensitive.
# - If a Brainglobe atlas is specified in the configuration file, by default, cuisto will remove any
# non-leaf regions (eg. any regions that have child region in the atlas ontology) *before* the merging
# defined here. This means that if members are non-leaf regions, they will be discarded before the merge
# and NOT be included in the new custom region.

[PHY]
name = "Perihypoglossal nuclei"
Expand Down
14 changes: 10 additions & 4 deletions cuisto/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def process_animal(
df_detections: pd.DataFrame,
cfg,
compute_distributions: bool = True,
leaf_regions_only: bool = True,
) -> tuple[pd.DataFrame, list[pd.DataFrame], pd.DataFrame]:
"""
Quantify objects for one animal.
Expand All @@ -34,8 +35,11 @@ def process_animal(
cfg : cuisto.Config
The configuration loaded from TOML configuration file.
compute_distributions : bool, optional
If False, do not compute the 1D distributions and return an empty list.Default
If False, do not compute the 1D distributions and return an empty list. Default
is True.
leaf_regions_only : bool, optional
If True and a Brainglobe atlas is specified, bar plot per regions will keep only
leaf regions, eg. regions with no child -- if there are any. Default is True.
Returns
-------
Expand All @@ -59,7 +63,7 @@ def process_animal(
# add hemisphere
df_annotations = utils.add_hemisphere(df_annotations, cfg.hemispheres["names"])
# remove objects in non-leaf regions if any
if len(cfg.atlas["leaveslist"]) > 0:
if leaf_regions_only & (len(cfg.atlas["leaveslist"]) > 0):
df_annotations = utils.filter_df_regions(
df_annotations, cfg.atlas["leaveslist"], mode="keep", col="Name"
)
Expand All @@ -73,7 +77,7 @@ def process_animal(
df_detections = utils.filter_df_classifications(
df_detections, cfg.object_type, mode="keep", col="Classification"
)
# remove objects from blacklisted regions and "Root"
# remove objects from blacklisted regions
df_detections = utils.filter_df_regions(
df_detections, cfg.atlas["blacklist"], mode="remove", col="Parent"
)
Expand Down Expand Up @@ -176,6 +180,7 @@ def process_animals(
cfg,
out_fmt: str | None = None,
compute_distributions: bool = True,
**kwargs,
) -> tuple[pd.DataFrame]:
"""
Get data from all animals and plot.
Expand All @@ -193,7 +198,7 @@ def process_animals(
compute_distributions : bool, optional
If False, do not compute the 1D distributions and return an empty list.Default
is True.
kwargs : passed to cuisto.process.process_animal().
Returns
-------
Expand Down Expand Up @@ -247,6 +252,7 @@ def process_animals(
df_detections,
cfg,
compute_distributions=compute_distributions,
**kwargs,
)

# collect results
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cuisto"
version = "2025.01.8"
version = "2025.01.9"
authors = [{ name = "Guillaume Le Goc", email = "[email protected]" }]
description = "Quantification of objects in histological slices"
readme = "README.md"
Expand Down

0 comments on commit dee53e2

Please sign in to comment.