# be ``1`` s, the second ``2`` s and so on. This image can then be warped by # the SDR transform. We can finally recover a position by averaging the # positions of all the voxels that had the contact's lookup number in # the warped image. # first we need our montage but it needs to be converted to "mri" coordinates # using our ``subj_trans`` montage = raw.get_montage() montage.apply_trans(subj_trans) # higher thresh such as 0.5 (default) works when `zooms=None` montage_warped, elec_image, warped_elec_image = mne.warp_montage_volume( montage, CT_aligned, reg_affine, sdr_morph, thresh=0.1, subject_from='sample_seeg', subjects_dir_from=op.join(misc_path, 'seeg'), subject_to='fsaverage', subjects_dir_to=subjects_dir) fig, axes = plt.subplots(2, 1, figsize=(8, 8)) nilearn.plotting.plot_glass_brain(elec_image, axes=axes[0], cmap='Dark2') fig.text(0.1, 0.65, 'Subject T1', rotation='vertical') nilearn.plotting.plot_glass_brain(warped_elec_image, axes=axes[1], cmap='Dark2') fig.text(0.1, 0.25, 'fsaverage', rotation='vertical') fig.suptitle('Electrodes warped to fsaverage') del CT_aligned
# a lookup table of the electrode contacts. In this image, the background will # be ``0`` s all the bright voxels near the location of the first contact will # be ``1`` s, the second ``2`` s and so on. This image can then be warped by # the SDR transform. We can finally recover a position by averaging the # positions of all the voxels that had the contact's lookup number in # the warped image. # first we need our montage but it needs to be converted to "mri" coordinates # using our ``subj_trans`` montage = raw.get_montage() montage.apply_trans(subj_trans) montage_warped, elec_image, warped_elec_image = mne.warp_montage_volume( montage, CT_aligned, reg_affine, sdr_morph, subject_from='sample_seeg', subjects_dir=subjects_dir, thresh=CT_thresh) fig, axes = plt.subplots(2, 1, figsize=(8, 8)) nilearn.plotting.plot_glass_brain(elec_image, axes=axes[0], cmap='Dark2') fig.text(0.1, 0.65, 'Subject T1', rotation='vertical') nilearn.plotting.plot_glass_brain(warped_elec_image, axes=axes[1], cmap='Dark2') fig.text(0.1, 0.25, 'fsaverage', rotation='vertical') fig.suptitle('Electrodes warped to fsaverage') del CT_aligned