Skip to content

Commit 0328e14

Browse files
Merge pull request #68 from brainglobe/expose-check-latest
Expose check_latest parameter
2 parents 34c02db + 7453156 commit 0328e14

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

brainglobe_heatmap/heatmaps.py

+46
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,53 @@ def __init__(
6666
zoom: Optional[float] = None,
6767
atlas_name: Optional[str] = None,
6868
label_regions: Optional[bool] = False,
69+
check_latest: bool = True,
6970
**kwargs,
7071
):
72+
"""
73+
Creates a heatmap visualization of the provided values in 3D or 2D
74+
using brainrender or matplotlib in the specified atlas.
75+
76+
Parameters
77+
----------
78+
values : dict
79+
Dictionary with brain regions acronyms as keys and
80+
magnitudes as the values.
81+
position : list, tuple, np.ndarray, float
82+
Position of the plane in the atlas.
83+
orientation : str or tuple, optional
84+
Orientation of the plane in the atlas. Either, "frontal",
85+
"sagittal", "horizontal" or a tuple with the normal vector.
86+
Default is "frontal".
87+
hemisphere : str, optional
88+
Hemisphere to display the heatmap. Default is "both".
89+
title : str, optional
90+
Title of the heatmap. Default is None.
91+
cmap : str, optional
92+
Colormap to use for the heatmap. Default is "Reds".
93+
vmin : float, optional
94+
Minimum value for the colormap. Default is None.
95+
vmax : float, optional
96+
Maximum value for the colormap. Default is None.
97+
format : str, optional
98+
Format of the heatmap visualization.
99+
"3D" for brainrender or "2D" for matplotlib. Default is "3D".
100+
thickness : float, optional
101+
Thickness of the slicing plane in the brainrender scene.
102+
Default is 10.
103+
interactive : bool, optional
104+
If True, the brainrender scene is interactive. Default is True.
105+
zoom : float, optional
106+
Zoom level for the brainrender scene. Default is None.
107+
atlas_name : str, optional
108+
Name of the atlas to use for the heatmap.
109+
If None allen_mouse_25um is used. Default is None.
110+
label_regions : bool, optional
111+
If True, labels the regions on the colorbar (only valid in 2D).
112+
Default is False.
113+
check_latest : bool, optional
114+
Check for the latest version of the atlas. Default is True.
115+
"""
71116
# store arguments
72117
self.values = values
73118
self.format = format
@@ -83,6 +128,7 @@ def __init__(
83128
atlas_name=atlas_name,
84129
title=title,
85130
title_color=grey_darker,
131+
check_latest=check_latest,
86132
**kwargs,
87133
)
88134

brainglobe_heatmap/slicer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,15 @@ def get_structures_slice_coords(
147147
position: Union[list, tuple, np.ndarray],
148148
orientation: Union[str, tuple] = "frontal",
149149
atlas_name: Optional[str] = None,
150+
check_latest: bool = True,
150151
) -> Dict[str, List[np.ndarray]]:
151152
"""
152153
Given a list of region name and a set of plane parameters,
153154
it returns the coordinates of the plane/regions'
154155
intersection in the plane's coordinates
155156
"""
156157

157-
scene = Scene(atlas_name=atlas_name)
158+
scene = Scene(atlas_name=atlas_name, check_latest=check_latest)
158159
if len(regions) == 1:
159160
regions_actors = [scene.add_brain_region(*regions)]
160161
else:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.10"
77
dynamic = ["version"]
88

9-
dependencies = ["brainrender>=2.1.11", "matplotlib", "numpy", "myterial", "rich"]
9+
dependencies = ["brainrender>=2.1.16", "matplotlib", "numpy", "myterial", "rich"]
1010

1111
license = { text = "MIT" }
1212

0 commit comments

Comments
 (0)