Skip to content

Commit

Permalink
example to show probe tracks (#313)
Browse files Browse the repository at this point in the history
* example to show probe tracks

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Standardise script

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Adam Tyson <[email protected]>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent 874c24d commit 52b1ec0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Binary file added brainrender/resources/probe_1_striatum.npy
Binary file not shown.
Binary file added brainrender/resources/probe_2_RSP.npy
Binary file not shown.
40 changes: 40 additions & 0 deletions examples/probe_tracks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
This example visualizes `.npy` files exported from brainglobe-segmentation
"""

from pathlib import Path
import numpy as np

from brainrender import Scene
from brainrender.actors import Points

data_path = Path(__file__).parent.parent / "brainrender" / "resources"

scene = Scene(title="Silicon Probe Visualization")

# Visualise the probe target regions
cp = scene.add_brain_region("CP", alpha=0.15)
rsp = scene.add_brain_region("RSP", alpha=0.15)

# Add probes to the scene.
# Each .npy file should contain a numpy array with the coordinates of each
# part of the probe.
scene.add(
Points(
np.load(data_path / "probe_1_striatum.npy"),
name="probe_1",
colors="darkred",
radius=50,
)
)
scene.add(
Points(
np.load(data_path / "probe_2_RSP.npy"),
name="probe_2",
colors="darkred",
radius=50,
)
)

# render
scene.render()

0 comments on commit 52b1ec0

Please sign in to comment.