Skip to content

Commit

Permalink
Merge pull request #68 from brainglobe/expose-check-latest
Browse files Browse the repository at this point in the history
Expose check_latest parameter
  • Loading branch information
alessandrofelder authored Dec 10, 2024
2 parents 34c02db + 7453156 commit 0328e14
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
46 changes: 46 additions & 0 deletions brainglobe_heatmap/heatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,53 @@ def __init__(
zoom: Optional[float] = None,
atlas_name: Optional[str] = None,
label_regions: Optional[bool] = False,
check_latest: bool = True,
**kwargs,
):
"""
Creates a heatmap visualization of the provided values in 3D or 2D
using brainrender or matplotlib in the specified atlas.
Parameters
----------
values : dict
Dictionary with brain regions acronyms as keys and
magnitudes as the values.
position : list, tuple, np.ndarray, float
Position of the plane in the atlas.
orientation : str or tuple, optional
Orientation of the plane in the atlas. Either, "frontal",
"sagittal", "horizontal" or a tuple with the normal vector.
Default is "frontal".
hemisphere : str, optional
Hemisphere to display the heatmap. Default is "both".
title : str, optional
Title of the heatmap. Default is None.
cmap : str, optional
Colormap to use for the heatmap. Default is "Reds".
vmin : float, optional
Minimum value for the colormap. Default is None.
vmax : float, optional
Maximum value for the colormap. Default is None.
format : str, optional
Format of the heatmap visualization.
"3D" for brainrender or "2D" for matplotlib. Default is "3D".
thickness : float, optional
Thickness of the slicing plane in the brainrender scene.
Default is 10.
interactive : bool, optional
If True, the brainrender scene is interactive. Default is True.
zoom : float, optional
Zoom level for the brainrender scene. Default is None.
atlas_name : str, optional
Name of the atlas to use for the heatmap.
If None allen_mouse_25um is used. Default is None.
label_regions : bool, optional
If True, labels the regions on the colorbar (only valid in 2D).
Default is False.
check_latest : bool, optional
Check for the latest version of the atlas. Default is True.
"""
# store arguments
self.values = values
self.format = format
Expand All @@ -83,6 +128,7 @@ def __init__(
atlas_name=atlas_name,
title=title,
title_color=grey_darker,
check_latest=check_latest,
**kwargs,
)

Expand Down
3 changes: 2 additions & 1 deletion brainglobe_heatmap/slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,15 @@ def get_structures_slice_coords(
position: Union[list, tuple, np.ndarray],
orientation: Union[str, tuple] = "frontal",
atlas_name: Optional[str] = None,
check_latest: bool = True,
) -> Dict[str, List[np.ndarray]]:
"""
Given a list of region name and a set of plane parameters,
it returns the coordinates of the plane/regions'
intersection in the plane's coordinates
"""

scene = Scene(atlas_name=atlas_name)
scene = Scene(atlas_name=atlas_name, check_latest=check_latest)
if len(regions) == 1:
regions_actors = [scene.add_brain_region(*regions)]
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.10"
dynamic = ["version"]

dependencies = ["brainrender>=2.1.11", "matplotlib", "numpy", "myterial", "rich"]
dependencies = ["brainrender>=2.1.16", "matplotlib", "numpy", "myterial", "rich"]

license = { text = "MIT" }

Expand Down

0 comments on commit 0328e14

Please sign in to comment.