Tutorial 6: Analysis in patient space

The tutorials #1 to #5 explained how to compute the epileptogenicity index in normalized MNI space, and display the results in the volume. This tutorial illustrates alternatives that stay in subject space, without any spatial normalization, in the subject MRI volume or on a cortical surface extracted from this MRI. For each example, repeat the operations presented in the tutorials #1 to #5, and change only the steps indicated here.

Volume: Subject MRI

Tutorial #1: Anatomy

  • Change the call to function ImaGIN_anat_spm, do not normalize the anatomy.
% Folder in which you unzipped the tutorial dataset
Root = 'C:\Users\username\Documents\Epilpesy';
% Name of the patient, which must corresponds to subfolder in Root directory
Patient{1}.Name = 'tutorial_epimap';
% Patient anatomy: pre- and post-implantation MRI scans
Patient{1}.MRI.pre  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1pre_deface.nii');
Patient{1}.MRI.post = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1post_deface.nii');
Patient{1}.MRI.ref  = 'pre';
Patient{1}.MRI.out  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI');
% MNI normalization: Set to 1 for results in MNI space, 0 for results in patient space
isNormalize = 0;
% Co-registration, segmentation and normalization of the MRI scans
ImaGIN_anat_spm(Patient, isNormalize);
  • This procedure does not create all the normalized volumes, and also skips the skull stripping. It creates only two new volumes:
    BrainPre.nii: Simple copy of the "pre" volume.
    BrainPost.nii: The "post" volume is registered on the "pre" volume, resliced and saved as BrainPost.nii.

Tutorial #3: Importing / Add 3D positions

  • When selecting the menu Import > Electrode positions:
    Select file  anat/implantation/Electrodes_Pos_Patient.txt instead of Electrodes_Pos_MNI.txt.
  • When displaying the contact positions with the button [Electrodes]:
    Select the volume  anat/MRI/BrainPre.nii instead of wBrainPre.nii.

Tutorial #5: Epileptogenicity

  • When computing and displaying the maps of epileptogenicity index with the button [Epileptogenicity]:
    Select the volume  anat/MRI/BrainPre.nii instead of wBrainPre.nii.
  • Left: Epileptogenigity index for SZ1, Right: Propagation maps for SZ2+SZ3

Surface: SPM canonical surface

SPM offers an option to compute pseudo-individual cortex surfaces for any MRI volume. It registers the volume to a template, then applies the inverse spatial deformation to the template mesh to obtain the individual cortical mesh. It does not follow the actual girification of the patient and would not represent correctly any atypical cortex shape. But it provides a fast and efficient way to render the results on a surface. The computation of the epileptogenicity index is a lot faster on surfaces.

Tutorial #1: Anatomy

  • Change the call to function ImaGIN_anat_spm: do not normalize the anatomy and specify the use of the canonical cortex surface.
% Folder in which you unzipped the tutorial dataset
Root = 'C:\Users\username\Documents\Epilpesy';
% Name of the patient, which must corresponds to subfolder in Root directory
Patient{1}.Name = 'tutorial_epimap';
% Patient anatomy: pre- and post-implantation MRI scans
Patient{1}.MRI.pre  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1pre_deface.nii');
Patient{1}.MRI.post = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1post_deface.nii');
Patient{1}.MRI.ref  = 'pre';
Patient{1}.MRI.out  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI');
% Cortex surface
Patient{1}.MRI.pre_cortex = 'canonical';
% MNI normalization: Set to 1 for results in MNI space, 0 for results in patient space
isNormalize = 0;
% Co-registration, segmentation and normalization of the MRI scans
ImaGIN_anat_spm(Patient, isNormalize);
  • This procedure does not create all the normalized volumes, and also skips the skull stripping. It creates two new volumes and a few surfaces:
    BrainPre.nii: Simple copy of the "pre" volume.
    BrainPost.nii: The "post" volume is registered on the "pre" volume, resliced and saved as BrainPost.nii.
    y_BrainPre.nii: Deformation field from the volume BrainPre.nii to the MNI template space.
    BrainPrecortex_hip_amy_8196.surf.gii: Canonical cortex surface (includes meshes of the hippocampus and the amygdala).
    BrainPre*_2562.surf.gii: Canonical inner skull, outer skull and scalp surfaces.

Tutorial #3: Importing / Add 3D positions

  • When selecting the menu Import > Electrode positions:
    Select file  anat/implantation/Electrodes_Pos_Patient.txt instead of Electrodes_Pos_MNI.txt.
  • When displaying the contact positions with the button [Electrodes]:
    Select the volume  anat/MRI/BrainPre.nii instead of wBrainPre.nii.

Tutorial #5: Epileptogenicity

  • When computing and displaying the maps of epileptogenicity index with the button [Epileptogenicity]:
    – Type of output: Select Surface instead of Volume
    – Select cortex surface: anat/MRI/BrainPrecortex_hip_amy_8196.surf.gii
    – Smoothing parameter: 5 (number of smoothing iterations with spm_mesh_smooth.m)

Display results as a textured surface

  • To display the results, use the button [Surface overlay]:
    – Select surface mesh: anat/MRI/BrainPrecortex_hip_amy_8196.surf.gii
    – Select data texture: seeg/SPM_EI_bSZ1_120_200_3_0/spmT_0001.gii
    – Plot electrodes: Yes (makes the surface transparent) or No (surface is opaque)
    – Select electrode positions file:  seeg/bSZ1.mat
    – Sign of values: Positive (displays only the positive t-values, corresponding to higher power during the seizure than during the baseline)
    – Amplitude threshold: 0 (display all the t-values)
    – Color for electrode set 1: Pick the color you want
    – Right-click on the surface for additional display options

Surface: BrainVISA cortex surface

To estimate the epileptogenicity index on a realistic surface, you can use BrainVISA to extract the cortex envelope (Morphologist). A simple tutorial for BrainVISA 4.3 is available here. For newer versions, please refer to the documentation on the BrainVISA website.
In this example, the files we use have been copied in the folder tutorial_epimap/anat/MRI/brainvisa. When using your own data, you can keep the entire folder containing the output of the Morphologist pipeline, the import functions will find the files it need in it.

Tutorial #1: Anatomy

  • Change the call to function ImaGIN_anat_spm: do not normalize the anatomy and specify the use of the canonical cortex surface.
% Folder in which you unzipped the tutorial dataset
Root = 'C:\Users\username\Documents\Epilpesy';
% Name of the patient, which must corresponds to subfolder in Root directory
Patient{1}.Name = 'tutorial_epimap';
% Patient anatomy: pre- and post-implantation MRI scans
Patient{1}.MRI.pre  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1pre_deface.nii');
Patient{1}.MRI.post = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', '3DT1post_deface.nii');
Patient{1}.MRI.ref  = 'pre';
Patient{1}.MRI.out  = fullfile(Root, Patient{1}.Name, 'anat', 'MRI');
% Cortex surface
Patient{1}.MRI.pre_cortex = fullfile(Root, Patient{1}.Name, 'anat', 'MRI', 'brainvisa');
% MNI normalization: Set to 1 for results in MNI space, 0 for results in patient space
isNormalize = 0;
% Co-registration, segmentation and normalization of the MRI scans
ImaGIN_anat_spm(Patient, isNormalize);
  • This procedure does not create all the normalized volumes, and also skips the skull stripping. It creates two new volumes and a one surface:
    BrainPre.nii: Simple copy of the "pre" volume.
    BrainPost.nii: The "post" volume is registered on the "pre" volume, resliced and saved as BrainPost.nii.
    3DT1pre.gii: Cortex envelope: Lhemi and Rhemi surfaces merged and registered in patient space with the transformations from the .minf files.
  • The script ImaGIN_load_brainvisa.m can be modified to use the grey-white interface (Lwhite and Rwhite surfaces in BrainVISA) instead of the pial surface (Rhemi and Lhemi)

Tutorial #3: Importing / Add 3D positions

  • When selecting the menu Import > Electrode positions:
    Select file  anat/implantation/Electrodes_Pos_Patient.txt instead of Electrodes_Pos_MNI.txt.
  • When displaying the contact positions with the button [Electrodes]:
    Select the volume  anat/MRI/BrainPre.nii instead of wBrainPre.nii.

Tutorial #5: Epileptogenicity

  • When computing and displaying the maps of epileptogenicity index with the button [Epileptogenicity]:
    – Type of output: Select Surface instead of Volume
    – Select cortex surface: anat/MRI/3DT1pre.gii
    – Smoothing parameter: 5 (number of smoothing iterations with spm_mesh_smooth.m)

Display results as a textured surface

  • To display the results, use the button [Surface overlay]:
    – Select surface mesh: anat/MRI/3DT1pre.gii
    – Select data texture: seeg/SPM_EI_bSZ1_120_200_3_0/spmT_0001.gii
    – Plot electrodes: Yes (makes the surface transparent) or No (surface is opaque)
    – Select electrode positions file:  seeg/bSZ1.mat
    – Sign of values: Positive (displays only the positive t-values, corresponding to higher power during the seizure than during the baseline)
    – Amplitude threshold: 0 (display all the t-values)
    – Color for electrode set 1: Pick the color you want
    – Right-click on the surface for additional display options
  • Epileptogenicity index for SZ1 (left and bottom, rendered in Brainstorm):
  • Right: Propagation maps for SZ2+SZ3 (left and bottom, rendered in Brainstorm):