I want to perform a similar analysis as yesterday, except I want
to use a smaller source space. Instead of using the volume of the
entire brain, I want to define a smaller volume, like the right
amygdala.
After performing an analysis in freesurfer, the file aseg.mgz
defines subcortical structures.
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.imshow(plt.imread('/Users/Alan/Desktop/Screen Shot 2014-05-21 at 4.56.06 PM.png'))
I can read this data into python using the nibabel module.
import nibabel as nib
import numpy as np
import mne
from mne.datasets import spm_face
subjects_dir = spm_face.data_path()
aseg_fname = subjects_dir + '/subjects/spm/mri/aseg.mgz'
aseg = nib.load(aseg_fname)
aseg_data = aseg.get_data()
ix = aseg_data==54 # index for the right amygdala
iix = []
for i in range(ix.shape[0]):
for j in range(ix.shape[1]):
for k in range(ix.shape[2]):
if ix[i, j, k]:
iix.append([i, j, k])
iix = np.array(iix)
print iix
Here's a list of voxels that belong to the right amygdala.
The index of 54 comes from a generic freesurfer look up table.
The mne function mne.setup_volume_source_space can accept a
dict of coordinates and orientations, each specified by an Nx3
array. Tomorrow's challenge is converting my list of voxel
indices into the right coordinates.
No comments:
Post a Comment