Plotting brain regions of interest (ROI) for demonstration purposes in Python
Project description
roipy
Plotting brain regions of interest (ROI) for demonstration purposes in Python
Description
Have you ever wanted to plot a region of the brain to include in a talk or presentation? What about in a lecture? Some might arbitrarily highlight the area of the cortex in which they think a particular region might fall. Others might scour the internet for images. Well...you won't need to do that any more. With roipy
, you can plot exact regions of the brain using the Destrieux Atlas.
Installation
This package is hosted on PyPi. You may use pip
to install.
pip install roipy
Usage
There are three types of brain plots included in roipy
. A "univariate" plot, a "multivariate" plot and a "whole brain multivariate" plot. There are two methods for generating each plot:
- Using the domain general class,
roipy.plotting.Plot()
- Executing each individual plotting method via its own specific function (e.g.,
roipy.utils.plot_multivariate()
)
Below is an example of each methods implementation.
# import
from roipy.plotting import Plot
from roipy.utils import plot_multivariate
# Domain general Plot()
P = Plot()
P.plot_multivariate(roi=[1,3,5,34], cmap='viridis')
#Individual function
plot_multivariate(roi=[1,3,5,34], shape='pial', view='lateral', hemi='left', cmap='viridis')
# Save the plot
import matplotlib.pyplot as plt
plt.savefig('brain.png')
The parameter roi
is given a list of integers which correspond to the Destrieux surface atlas.
You can also animate the plots with roipy.animation.Anim()
.
# import
from roipy.animation import Anim
from roipy.plotting import Plot
# Plot() instance
P = Plot()
# Anim() instance
A = Anim()
a.animate(lambda frame: P.plot_multivariate(roi=[1,3,5,34], cmap='viridis'), fname='brain.gif', save=True)
Admittedly, this is more complex as it requires use of the
lambda
function in Python. But, usingroipy.plotting.utils.plot_univariate
, you can devise your own animation style.
Example brain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file roipy-1.3.4.tar.gz
.
File metadata
- Download URL: roipy-1.3.4.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 327be11f5fd69faedc0dc9e714631e493979cfa9802c8c33647f02a0d04e5f31 |
|
MD5 | 5569b8da051ca579742cc7edfaf27884 |
|
BLAKE2b-256 | 26b88a86d12e1474d091af6be67d8be67686a3e08942c6c27d34f506dd3e091a |
File details
Details for the file roipy-1.3.4-py3-none-any.whl
.
File metadata
- Download URL: roipy-1.3.4-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a881d6380a35fc9a01b2f6e2b321a8c86296d92b36e7980a3eeb41238f05039 |
|
MD5 | 83907a105aba2060ef6e2ae37757cb72 |
|
BLAKE2b-256 | e23ee5f64bed9612907c1b59d5f5c76eeb232e75830d5b0a89d05cc7bc6979b6 |