{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Cross-hemisphere comparison\n\n\nThis example illustrates how to visualize the difference between activity in\nthe left and the right hemisphere. The data from the right hemisphere is\nmapped to the left hemisphere, and then the difference is plotted. For more\ninformation see :func:`mne.compute_source_morph`.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Author: Christian Brodbeck \n#\n# License: BSD (3-clause)\n\nimport mne\n\ndata_dir = mne.datasets.sample.data_path()\nsubjects_dir = data_dir + '/subjects'\nstc_path = data_dir + '/MEG/sample/sample_audvis-meg-eeg'\n\nstc = mne.read_source_estimate(stc_path, 'sample')\n\n# First, morph the data to fsaverage_sym, for which we have left_right\n# registrations:\nstc = mne.compute_source_morph(stc, 'sample', 'fsaverage_sym', smooth=5,\n warn=False,\n subjects_dir=subjects_dir).apply(stc)\n\n# Compute a morph-matrix mapping the right to the left hemisphere,\n# and vice-versa.\nmorph = mne.compute_source_morph(stc, 'fsaverage_sym', 'fsaverage_sym',\n spacing=stc.vertices, warn=False,\n subjects_dir=subjects_dir, xhemi=True,\n verbose='error') # creating morph map\nstc_xhemi = morph.apply(stc)\n\n# Now we can subtract them and plot the result:\ndiff = stc - stc_xhemi\n\ndiff.plot(hemi='lh', subjects_dir=subjects_dir, initial_time=0.07,\n size=(800, 600))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 0 }