From 9673465c6eef08a4a68523a53f7f5711ed0a1a55 Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Mon, 20 May 2024 16:26:34 +0100 Subject: [PATCH 1/7] Add human example script --- examples/heatmap_human_brain.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 examples/heatmap_human_brain.py diff --git a/examples/heatmap_human_brain.py b/examples/heatmap_human_brain.py new file mode 100644 index 0000000..9ff87b5 --- /dev/null +++ b/examples/heatmap_human_brain.py @@ -0,0 +1,16 @@ +import brainglobe_heatmap as bgh + +values = dict( # scalar values for each region + SFG=1, + PrCG=2, + Ca=4, + Pu=10, +) + +scene = bgh.heatmap( + values, + position=(100000, 100000, 100000), + thickness=1000, + atlas_name="allen_human_500um", + format="2D", +).show() From 464e6a19c6c8756a53bb8e51cae78c3a69706585 Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Mon, 20 May 2024 16:26:48 +0100 Subject: [PATCH 2/7] rename spinal cord example --- examples/{heatmap_spinal_coord.py => heatmap_spinal_cord.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{heatmap_spinal_coord.py => heatmap_spinal_cord.py} (100%) diff --git a/examples/heatmap_spinal_coord.py b/examples/heatmap_spinal_cord.py similarity index 100% rename from examples/heatmap_spinal_coord.py rename to examples/heatmap_spinal_cord.py From d5e292e290be6ce33866c689436153c889db06fc Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Mon, 20 May 2024 16:27:20 +0100 Subject: [PATCH 3/7] Remove main --- brainglobe_heatmap/heatmaps.py | 39 +--------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/brainglobe_heatmap/heatmaps.py b/brainglobe_heatmap/heatmaps.py index 318b452..a7e7b2a 100644 --- a/brainglobe_heatmap/heatmaps.py +++ b/brainglobe_heatmap/heatmaps.py @@ -252,41 +252,4 @@ def plot( ax.legend() plt.show() - return f - - -if __name__ == "__main__": - values = dict( # scalar values for each region - TH=1, - RSP=0.2, - AI=0.4, - SS=-3, - MO=2.6, - PVZ=-4, - LZ=-3, - VIS=2, - AUD=0.3, - RHP=-0.2, - STR=0.5, - CB=0.5, - FRP=-1.7, - HIP=3, - PA=-4, - ) - - heatmap( - values, - position=None, - # or 'sagittal', or 'horizontal' or a tuple (x,y,z) - orientation=( - 1, - 1, - 0, - ), - # thickness of the slices used for rendering (in microns) - thickness=250, - title="frontal", - vmin=-5, - vmax=3, - format="3D", - ).show() + return f \ No newline at end of file From c0ba0a9f85d70d7f00d155deb15a3749643c3f53 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 15:29:10 +0000 Subject: [PATCH 4/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- brainglobe_heatmap/heatmaps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brainglobe_heatmap/heatmaps.py b/brainglobe_heatmap/heatmaps.py index a7e7b2a..1bd21f0 100644 --- a/brainglobe_heatmap/heatmaps.py +++ b/brainglobe_heatmap/heatmaps.py @@ -252,4 +252,4 @@ def plot( ax.legend() plt.show() - return f \ No newline at end of file + return f From 41a14860a0dd0b4af60c8bf5e5ecab21b1b72695 Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Mon, 20 May 2024 16:37:43 +0100 Subject: [PATCH 5/7] Add note to example --- examples/heatmap_human_brain.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/heatmap_human_brain.py b/examples/heatmap_human_brain.py index 9ff87b5..5b8fe90 100644 --- a/examples/heatmap_human_brain.py +++ b/examples/heatmap_human_brain.py @@ -1,3 +1,9 @@ +""" +This example shows how to generate a heatmap with the `allen_human_500um` +human brain atlas. + +N.B. the physical scales are very different to e.g. the small animal atlases. +""" import brainglobe_heatmap as bgh values = dict( # scalar values for each region From ee62ccb169c5ebc5e81ee47fcc9196af322d874e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 15:38:17 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/heatmap_human_brain.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/heatmap_human_brain.py b/examples/heatmap_human_brain.py index 5b8fe90..0385393 100644 --- a/examples/heatmap_human_brain.py +++ b/examples/heatmap_human_brain.py @@ -4,6 +4,7 @@ N.B. the physical scales are very different to e.g. the small animal atlases. """ + import brainglobe_heatmap as bgh values = dict( # scalar values for each region From 33c123d3a3924a124cdb7605623cfda39f30f622 Mon Sep 17 00:00:00 2001 From: Adam Tyson Date: Mon, 20 May 2024 16:41:25 +0100 Subject: [PATCH 7/7] Make mypy happy --- brainglobe_heatmap/heatmaps.py | 2 +- examples/heatmap_human_brain.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/brainglobe_heatmap/heatmaps.py b/brainglobe_heatmap/heatmaps.py index 1bd21f0..c959cd3 100644 --- a/brainglobe_heatmap/heatmaps.py +++ b/brainglobe_heatmap/heatmaps.py @@ -51,7 +51,7 @@ def check_values(values: dict, atlas: Atlas) -> Tuple[float, float]: class heatmap: def __init__( self, - values: Dict[str, float], + values: Dict, position: Union[list, tuple, np.ndarray], orientation: Union[str, tuple] = "frontal", hemisphere: str = "both", diff --git a/examples/heatmap_human_brain.py b/examples/heatmap_human_brain.py index 5b8fe90..37ed820 100644 --- a/examples/heatmap_human_brain.py +++ b/examples/heatmap_human_brain.py @@ -4,14 +4,11 @@ N.B. the physical scales are very different to e.g. the small animal atlases. """ + import brainglobe_heatmap as bgh -values = dict( # scalar values for each region - SFG=1, - PrCG=2, - Ca=4, - Pu=10, -) +values = dict(SFG=1, PrCG=2, Ca=4, Pu=10) # scalar values for each region + scene = bgh.heatmap( values,