Dataset ArithmeticΒΆ

This plots example volume data onto an example subject, S1, onto a flatmap using quickflat. In order for this to run, you have to have a flatmap for this subject in the pycortex filestore.

Once you have created a cortex.Volume object, you can manipulate it with normal arithmetic operators like +, -, , /, and *

  • plot dataset arithmetic
  • plot dataset arithmetic
  • plot dataset arithmetic
import cortex
import numpy as np
import matplotlib.pyplot as plt

subject = 'S1'
xfm = 'fullhead'

# Creating a random dataset that is the shape for this transform with one
# entry for each voxel
test_data = np.random.randn(31, 100, 100)

# This creates a Volume object for our test dataset for the given subject
# and transform
vol_data = cortex.Volume(test_data, subject, xfm, vmin=-2, vmax=2)

# Now you can do arithmetic with the Volume
vol_plus = vol_data + 1

# You can also do multiplication
vol_mult = vol_data * 4

Total running time of the script: ( 0 minutes 8.302 seconds)

Gallery generated by Sphinx-Gallery