2356
Comment:
|
56374
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
'''[TUTORIAL UNDER DEVELOPMENT: NOT READY FOR PUBLIC USE] ''' |
|
Line 8: | Line 10: |
''Warning: The same tools can be used for processing and displaying ECOG, but this hasn't been debugged properly yet. Please share with us any suggestion for improving the ECOG support.'' |
|
Line 10: | Line 14: |
== License == This tutorial dataset (EEG and MRI data) remains property of the Grenoble University Hospital, France. Its use and transfer outside the ImaGIN tutorial, e.g. for research purposes, is prohibited without written consent. For questions, please contact Olivier David, PhD (olivier.david@grenoble-univ-alpes.fr). == Reference == The acquisition methodology is described in the following articles: David O, Blauwblomme T, Job AS, Chabardès S, Hoffmann D, Minotti L, Kahane P<<BR>>Imaging the seizure onset zone with stereo-electroencephalography<<BR>>Brain. 2011 Oct;134(10):2898-911<<BR>>https://academic.oup.com/brain/article/134/10/2898/323878 Lamarche F, Job AS, Deman P, Bhattacharjee M, Hoffmann D, Gallazzini-Crépin C, Bouvard S, Minotti L, Kahane P, David O<<BR>>Correlation of FDG-PET hypometabolism and SEEG epileptogenicity mapping in patients with drug-resistant focal epilepsy<<BR>>Epilepsia. 2016 Dec; 57(12):2045–2055<<BR>>https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5214566/ == Download == How to get the example dataset: * Download zip: https://gin11-git.ujf-grenoble.fr/ftract_dev/ImaGIN_datasets/tree/master/tutorial_epimap * Unzip on your computer, rename to "tutorial_epimap" Files included in this package: * anat/MRI/3DT1*_deface.nii: Subject MRI before and after implantation, de-identified with FreeSurfer's mri_deface * anat/MRI/brainvisa: Cortical surface extracted with BrainVISA 4.5 * anat/implantation/*.txt: Positions of the sEEG contacts in various formats (MNI coordinates or patient coordinates) * seeg/SZ*.TRC: Seizure recordings in Micromed format, one seizure per file |
<<Include(DatasetEpileptogenicity, , from="\<\<HTML\(\<!-- START-PAGE --\>\)\>\>", to="\<\<HTML\(\<!-- STOP-SHORT --\>\)\>\>")>> == Download and installation == * '''Requirements''': You have already followed all the introduction tutorials and you have a working copy of Brainstorm installed on your computer. * Go to the [[http://neuroimage.usc.edu/bst/download.php|Download]] page of this website, and download the file: '''tutorial_epimap.zip''' * Unzip it in a folder that is not in any of the Brainstorm folders (program folder or database folder) * Start Brainstorm (Matlab scripts or stand-alone version). * Select the menu File > Create new protocol. Name it "'''TutorialEpimap'''" and select the options: * "'''No, use individual anatomy'''", * "'''No, use one channel file per acquisition run'''". == Import the anatomy == === Pre-implantation MRI === * Right-click on the TutorialEpimap folder > '''New subject''' > '''Subject01'''.<<BR>>Keep the default options you defined for the protocol. * Switch to the "anatomy" view of the protocol. * Right-click on the subject node > '''Import MRI''':<<BR>>Set the file format: "All MRI file (subject space)"<<BR>>Select the file: '''tutorial_epimap/anat/MRI/3DT1pre_deface.nii''' * Do you want to apply the transformation to the MRI file? '''YES''' * The MRI viewer opens automatically. Click on "[[http://neuroimage.usc.edu/brainstorm/Tutorials/ImportAnatomy#MNI_transformation|Click here to compute MNI transformation]]". It computes an affine transformation between the subject space and the MNI ICBM152 space, and sets default positions for all the anatomical landmarks.<<BR>> {{attachment:mni_transformation.gif}} * Click on [Save] to close the MRI viewer. === Post-implantation MRI === * The pre-implantation MRI will be used as the anatomical reference for this subject. We will now import a second scan done after the SEEG implantation, on which we can see the SEEG electrodes and contacts. In this dataset, the post-implantation volume is another T1 MRI scan (contacts hyposignal appear in black), but it is more commonly a CT scan (contacts hypersignal appear in white). * Right-click on the subject node > '''Import MRI''':<<BR>>Select the file: '''tutorial_epimap/anat/MRI/3DT1post_deface.nii''' * Do you want to apply the transformation to the MRI file? '''YES'''<<BR>>This will reorient the MRI in Brainstorm's standard orientation, so you can see the coronal/sagittal/axial views correctly oriented. * How to register the new volume? '''IGNORE'''<<BR>>The two volumes have already been coregistered with SPM. See the section [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Volume_coregistration|Volume coregistration]] for more details on this option. * Reslice the volume? '''YES'''<<BR>>This will rewrite the volume with the orientation and resolution of the pre-implantation MRI, so that the two volumes can be overlaid in the MRI viewer. You may answer no to this question when the resolution of the pre-implantation MRI is very low and/or when you want to edit the positions of the fiducials in the original post-implantation volume (CT or MRI). * The MRI viewer opens automatically, showing the post-implantation volume as a colored layer on top of the previous volume. Adjust the transparency and amplitude threshold of this layer in the section Data options in the Surface tab, adjust its colormap with the popup menu of the figure. Use this display to validate that the coregistration of the two volume is correct, all the parts of the head must align well. <<BR>><<BR>> {{attachment:anat_overlay.gif||width="591",height="277"}} === Generate default surfaces === * Right-click on the pre-implantation MRI > '''SPM canonical surfaces'''. * Leave the default option selected (20484). This represents the resolution of SPM template surface used in this process. The higher the better, but it will slow down significantly the computation of the epileptogenicity maps. * These surfaces will be used later, in the computation of the epileptogenicity maps. Read the advanced sections of this page for information on [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Importing_realistic_surfaces|how to use realistic surfaces]] from BrainVISA or FreeSurfer.<<BR>><<BR>> {{attachment:anat_canonical.gif||width="598",height="161"}} == Access the recordings == === Link the recordings === * Switch to the "functional data" view (2nd button, on top of the database explorer). * Right-click on the subject folder > '''Review raw file''': * Select the file format: "'''SEEG: Deltamed/Micromed/...'''" * Select all the SEEG recordings: '''tutorial_epimap/seeg/*.TRC''' * The new files "Link to raw file" let you access directly the contents of the original SEEG files. The menu "Review raw file" does not actually copy any data to the database. [[http://neuroimage.usc.edu/brainstorm/Tutorials/ChannelFile#Review_vs_Import|More information]]. <<BR>><<BR>> {{attachment:import_link.gif||width="634",height="202"}} === Import the contacts positions === In order to generate epileptogenicity maps, we need accurate 3D positions for the contacts of the depth electrodes. Placing the contacts requires a good understanding of the implantation scheme reported by the neurosurgeon, and some skills in reading MRI scans. To make this tutorial easier to reproduce and follow, we distribute the positions of the contacts saved in a text file (folder /anat/implantation). For instructions to place the SEEG contacts using Brainstorm, read the advanced section [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Editing_the_contacts_positions|Editing the contacts positions]]. * The channel files "Micromed channels" contain the name of the channels, but not their positions. We need to import or edit separately the positions of the SEEG contacts. * Click on the [+] next to the three SZ folders, select all the channel files simultaneously. * Right-click one channel file > '''Add EEG positions''' > '''Import from file''': * Select the file format: "'''EEG: ASCII: Name, XYZ (*.*)'''" * Select the file: '''tutorial_epimap/anat/implantation/elec_pos_patient.txt '''<<BR>><<BR>> {{attachment:import_pos_file.gif||width="585",height="178"}} * Select a scaling factor: '''0.1''' (keep the default selection)<<BR>>The positions in this text file are in millimeters, while the expected unit for "EEG: ASCII" is the centimeter. This option means that the values will be interpreted as 0.1*cm, ie. millimeters. <<BR>><<BR>> {{attachment:import_pos_factor.gif||width="407",height="111"}} * Apply MRI transformation? '''YES'''<<BR>>This will interpret the coordinates in the text file as positions in the referential defined by the voxel-to-world transformation (vox2ras) transformation available in the MRI, if available (in NIfTI format, this corresponds to matrices qform or sform). If you answer no here, it would load the positions as [[CoordinateSystems|Brainstorm SCS coordinates]] and try to realign them based on the NAS/LPA/RPA landmarks. <<BR>><<BR>> {{attachment:import_pos_transf.gif||width="345",height="98"}} * At the end you get a report indicating how many channels from the SEEG recordings were attributed a new 3D position. The channels are matched by name: the position file you import must include the labels of the electrodes and they must be named exactly in the the same way as in your recordings. * The type of the channels for which a position was not found is set to '''EEG_NO_LOC''', so they are ignored when you process the SEEG channels. In this example dataset, the channels that are not found are "fz" and "cz", which are indeed not SEEG contacts. * You should always validate that the type of all the channels has been detected correctly. Check also that the names are correct and using the same convention for all the contact of a given electrode. These are entered manually, and typing errors are frequent. Right-click on a channel file > '''Edit channel file'''.<<BR>><<BR>> {{attachment:import_pos_edit.gif||width="595",height="120"}} * '''MNI coordinates''': Note that you can also import contact positions in MNI coordinates. In this example dataset includes the positions, they are available in the file "elec_pos_patient.txt". To import this file correctly, make sure you select a file format that explicitely mentions MNI coordinates. In this example, it would be: "EEG: ASCII: Name, XYZ'''_MNI''' (*.*)". * If you don't have the positions for the SEEG contacts, or if they don't look correctly aligned, you can directly place them in the MRI viewer. See the section [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Editing_the_contacts_positions|Editing the contacts positions]]. == Display the depth electrodes == === 3D figures === * Right-click on the channel file > '''Display sensors''' > Explore all the options available. {{attachment:display_menu.gif}} * You can render the SEEG depth electrodes in 3D together with the subject surfaces, pre- or post-implantation volumes. You can add more anatomy elements to the figure with the button "Add a surface" at the top-right of the Surface tab. For more help: [[http://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#MRI_in_3D|Display the anatomy]]. <<BR>><<BR>> {{attachment:display_3d.gif||width="507",height="273"}} * Click on contact to select it, right-click on the figure to get its name: <<BR>><<BR>> {{attachment:display_selectchan.gif||width="408",height="247"}} === MRI Viewer === * You can also display the contacts in the MRI viewer, on top of the the pre- or post-implantation volumes. By default, the electrode is displayed in a slice if there is a contact of attached to this electrode in the slice.<<BR>><<BR>> {{attachment:display_mri.gif||width="542",height="422"}} * To display all the electrodes, select the option "'''MIP: Functional'''". For a glass-brain view, select at the same time the option "'''MIP: Anatomy'''". <<BR>><<BR>> {{attachment:display_mri_mip.gif||width="621",height="508"}} * Zoom in/out with the buttons or the associated shortcuts (Ctrl+Scroll or +/-) and explore the volume with (Shift+)x/y/z. Additional display options are available in the popup menu for this figure. All the shortcuts listed in [[http://neuroimage.usc.edu/brainstorm/Tutorials/ImportAnatomy#Using_the_MRI_Viewer|this tutorial]]. * You can '''edit the position of a contact''' directly by clicking on its dot in one of the slice and moving it around. Modifications are not saved immediately and can be cancelled when you close the window. Alternatively, you can right-click on the figure > '''Set electrode position'''. === Panel iEEG === * When opening SEEG/ECOG recordings, the panel iEEG is added to the Brainstorm window. You can use it to edit the display properties of the depth electrodes. In this interface, "'''electrode'''" refers to entire depth electrode implanted in the head of the patient while "'''contact'''" refers to recording sites on the electrode. There are multiple contacts on an electrode, and one contact corresponds to one channel of data in the channel file and the recordings. <<BR>><<BR>> {{attachment:panel_ieeg.gif||width="611",height="319"}} * SEEG depth electrodes are graphical objects, they are defined independently from the SEEG contacts available in the channel file and recordings. A contact/channel is associated to a depth electrode using the '''Group''' property of the channel, accessible with a right-click on the channel file > '''Edit channel file'''. * In this example, the depth electrodes available in the panel iEEG have been detected automatically based on the names and positions of the data channels. In the convention used here, the contact names must start with one or more letters (the name of the electrode) followed by a number representing the index of the contact on the electrode. Contact #1 is at the tip of the electrode, and is therefore the deeper contact of the electrode. If the convention used in your recordings is different, you may have to edit the electrodes properties in order to get them displayed correctly. * Buttons in the toolbar: * '''Add an electrode''': Adds an entry for a new depth electrode. The new electrode will not be displayed until you set its properties and position. This will not add or remove SEEG contacts or channels of data. * '''Remove selected electrodes''': Deletes a depth electrode from the list, but does not modify the list of SEEG contacts or channels of data. * '''Set color for selected electrodes''': Self explanatory. * '''Show/hide selected electrodes''': To hide an electrode in the 3D figures and MRI viewers, select it in the list then click on this button. Select all the electrodes with the standard shortcut Ctrl+A. * '''Display contacts as''': Depth electrodes / Spheres. * '''Contacts > Set default positions''': For each of the selected electrodes, the current positions of the SEEG contacts are discarded and replaced with the default positions of the contacts on the electrode. The properties used for setting the position of the contacts are the contact spacing, the tip of the electrode and the entry point in the skull. Contact #i is placed along the electrode at (i-1)*contact_spacing millimeters for the tip of the electrode. * '''Contacts > Project on electrode''': For each of the selected electrodes, the contacts are projected orthogonally on the electrode. This menu can be useful for aligning contacts that were marked one by one. * '''Contacts > Save modifications''': Save the current modifications to the channel file. Otherwise, the modifications are saved only when you close the figure (dialog box "Save modifications to channel file?") * '''Contacts > Export contacts positions''': Save the 3D positions of the SEEG contacts in the current channel file in one of the file formats supported by Brainstorm. * Electrode properties: ''Properties that have an impact on the position of the contacts''.<<BR>> * If you edit the properties, the modifications will apply to all the selected electrodes in the current channel file. Check what is selected before making changes. * '''Type''': SEEG/ECOG * '''Model''': List of electrode models. If you select an entry in this menu, it will copy the default properties for this model to the selected electrodes. If you are using electrodes that are not in this list, please post on the specification of your devices on the user forum and we will add them to this list. * '''Number of contacts''': Number of recording sites on the electrode. By default, this is set for SEEG to the maximum index found in a group of contacts. Example: electrode s' is associated to channels s'1, s'2, s'3, s'10, s'11, s'12 => detected number of contacts is 12. * '''Contact spacing''': Distance between the centers of two consecutive contacts in the electrode. In this example dataset, the default value corresponds to the average distance observed between pairs of adjacent contacts. * '''Set tip''': Select one electrode in the list, then move the cursor of the MRI viewer to the tip of the selected electrode (center of the first contact), and finally click on [Set tip]. * '''Set skull entry''': Select one electrode in the list, then move the cursor of the MRI viewer to the point where the depth electrode enters the skull (or the center of the screw), and finally click on [Set skull entry]. This position does not correspond to any contact, it is used only to estimate the direction of the depth electrode. * Display options: Properties that only affect the way the electrodes are renderer graphically. * '''Contact length''': Defines the length along the electrode axis of the yellow cylinder that represents the contacts, or the diameter of the sphere when the electrodes are not rendered. * '''Contact diameter''': Diameter of the yellow cylinders representing the contacts. By default, this value is slightly larger than the electrode diameter so that it is rendered correctly. If you use the same value as the electrode diameter, the contacts might not be visible. * '''Electrode diameter''': Diameter of the cylinder representing the SEEG depth electrode. * '''Electrode length''': Length of the cylinder representing the SEEG depth electrode. == Display the SEEG recordings == === SEEG time series === * Right-click on any "Link to raw file" > '''SEEG '''> '''Display time series'''.<<BR>><<BR>> {{attachment:display_ts.gif||width="637",height="276"}} * For instructions on how to use this viewer, please refer to these tutorials: * [[Tutorials/ReviewRaw|Review continuous recordings]] * [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy#Review_EEG_recordings|EEG and epilepsy: Review EEG recordings]] * Typical display configuration includes: * Set the page duration tp 20s or 30s: Record tab > Page settings. * Change the display mode to "columns": Record tab > Toolbar > First button. * Change the montage (bipolar/monopolar): Record tab > Note all the default montages available for SEEG: you can display all the contacts at once, or each electrode individually. * Set visualization filters: Filter tab. * Disable the automatic scaling when changing page: Button [AS] in the time series figure. * Adjust the amplitude scale: Right-click+move up/down, or buttons [^] and [v]. * Set the resolution precisely: Right-click on the figure > Figure > Set axes resolution. * With the menus "'''3D electrodes'''" you can visualize the SEEG values at the current time point. Move the time cursor and it will update the values represented on the SEEG contacts. <<BR>><<BR>> {{attachment:display_3delectrodes.gif||width="640",height="299"}} === Interpolate on the anatomy === * From the same SEEG display menu, you can also project the SEEG values on the MRI or the cortex. You can edit the colormap for the displayed value [[http://neuroimage.usc.edu/brainstorm/Tutorials/Colormaps|like any other colormap]]. * '''MRI volume''': All the voxels in the neighborhood of a contact are attributed the value associated with this contact. In the figure below, both "MIP: functional" and "MIP: anatomy" options are selected. * '''Cortex surface''': The values of the vertices are interpolated from the nearest SEEG contacts (the magnitude decreases with the distance to the contact). <<BR>><<BR>> {{attachment:display_interp_anat.gif||width="640",height="263"}} == Review recordings == === Bad channels === We will now to review the recordings for the three seizures recorded for this subject: SZ1, SZ2, SZ3. All the following steps are illustrated only for '''SZ1''' but need to be reproduced for the other files. * Double-click on '''SZ1/Link to raw file''' to open the SEEG recordings for the first seizure. * We need to mark the bad channels using a "'''monopolar'''" montage (common reference). If you are currently reviewing the recordings with a bipolar montage, swith it back to "All channels", using the menu in the toolbar of the record tab or with the popup menu of the time series figure. Otherwise, marking a signal as bad (eg. "v'2-v'1") would actually mark two channels as bad ("v'1" and "v'2"), while only one contact ("v'1") is not recording properly. * Click on the channels that you consider as bad to select them. For SZ1, select '''v'1''' and '''f'1'''. * Press the '''delete''' key, or use the popup menu Channels > '''Mark selected as bad'''. <<BR>><<BR>> {{attachment:mark_bad.gif||width="465",height="217"}} * Close the figure and repeat for the two other files. * Bad channels for the three seizures: * SZ1: '''v'1''', '''f'1''' * SZ2: '''v'1''' * SZ3: '''o'1''', '''t'8''' === Seizure onset === Two events are already available in this file: "Part1" only indicates the beginning of the file, and "Seizure" indicates approximately the onset of the first seizure. This marking was done for clinical use, to jump quickly to the page of interest, but here we need a more accurate marker. We will create a new marker "Onset" where we observe the beginning of the fast gamma activity, which is the main feature used computation of the epileptogenicity maps is based on. * Double-click on '''SZ1/Link to raw file''' to open the SEEG recordings for the first seizure, or do this immediately after marking the bad channels. * Switch to a '''bipolar montage''': bipolar-1 is sparse (eg. g2-g1, g4-3), bipolar-2 is exhaustive (eg. g2-g1, g3-g2, g4-3), depending on how dense you want your figure to be. * In the Record tab, click on the event group "'''Seizure'''", then on the event timing. This will jump quickly to the page on which we will place our Onset marker. * Zoom around the '''g'''' contacts (using the buttons on the right of the figure or the corresponding shortcuts, indicated if you leave your mouse over the buttons for a second), or select the g' electrode in the '''montage menu'''. * If needed, zoom locally in time in the current page (mouse wheel) and change the amplitude scale (right-click+mouse up/down). * Create an event group "Onset": Record tab > Events > '''Add group > "Onset"''', or select it. * Place the time cursor at '''120.800s''', add an Onset marker at this time (press the key "E", or use the popup menu Add/delete event). <<BR>><<BR>> {{attachment:mark_onset.gif||width="638",height="270"}} * If you are marking a lot of events, you might be interest in using [[http://neuroimage.usc.edu/brainstorm/Tutorials/EventMarkers#Custom_shortcuts|custom shortcuts]]. * Repeat for the other files. Seizure onset time for the three seizures: * SZ1: '''120.800s''' * SZ2: '''143.510s''' * SZ3: '''120.287s''' === Baseline === In the following sections, we will compute a time-frequency decomposition of the seizure and normalize it with respect to a baseline level. We will identify and import this baseline now. The baseline could be a segment of 5s to 30s of recordings, typically before the seizure, that contains as little interictal epileptiform activity as possible. The duration of the baseline influences the computation time for the following steps of this tutorial. We will work here with short segments of 5s for illustration purposes, between 72.8s and 77.8s. Use longer segments for more accurate results. * Create a new event group "'''Baseline'''". * Select the segment '''[72.8s, 77.8s]''': Click and drag your mouse, or right-click > Time selection > Set selection manually. Then create a Baseline extended event ("E" or "Add/delete event"). <<BR>><<BR>> {{attachment:mark_baseline.gif||width="642",height="242"}} * Repeat for the other files. Baselines for the three seizures: * SZ1: '''[72.800, 77.800]s''' * SZ2: '''[103.510, 108.510]s''' * SZ3: '''[45.287, 50.287]s''' * Close the viewer to save the modifications, or use the menu File > Save modifications. == Import epochs of interest == At this point of the analysis, we are still looking at the original files, no SEEG data was copied to the database. The montages are saved in the Brainstorm preferences, the bad channels and new events are saved in the links of the database but not eported to the original .TRC files. If you delete your protocol at this point, you would only lose the event marking and bad channel selection. We are now going to import two segments of recordings for each seizure file: the seizure (10s before and 40s after the onset) and the baseline (all the segment selected). This will make real copies of the data in the database, so we can run additional processes on them. === Import in database === * Right-click on the '''SZ1 / Link to raw file''' > '''Import in database''': * Time window: All, the only interesting point is to have access to the Onset marker. * Split in time blocks: Disabled * Use events: Enabled, select '''Onset''' * Epoch time: '''[-10000, +40000] ms''' (imports -10s to 40s around the event "Onset") * Remove DC offset: Disabled * Resample: Disabled * Create a separate folder for each event type: Disabled <<BR>><<BR>> {{attachment:import_onset.gif||width="601",height="262"}} * Repeat the last operation to import the baseline, modify only the following options: * Use events: Select '''Baseline''' * Epoch time: Not applicable, the event Baseline already defines a start and an end * Repeat for the three seizures. * At the end, you should have three new folders SZ1/SZ2/SZ3, the same name as the original .TRC files, but without the tag "raw" on top of it. These new folders contain copy of the SEEG recordings, if you delete these folders from the database explorer, you lose the files they contain. * The imported epochs are saved with a new timing: for the seizure onsets, the reference time t=0s is now the event "Onset", which has been removed from the list. You can still see the other marker Seizure, which should be slightly before 0s. For the baselines, the reference t=0 is the beginning of the segment.<<BR>><<BR>> {{attachment:import_database.gif||width="632",height="283"}} === Bipolar montage === We will run the rest of the analysis using a bipolar montage (bipolar-2). The montage selected in the Record tab is for visualization only, most processes ignore this selection and work only on the original common-reference data. To force all the processes to work on the bipolar values, we need to explicitly apply the montage to the recordings. * In Process1, drag and drop all the imported recordings (either the folders or the files). * Run the process '''Standardize >''' '''Apply montage''': * Montage: '''Subject01: SEEG (bipolar 2)''' * Create new folders: '''Enabled''' <<BR>><<BR>> {{attachment:import_montage.gif||width="475",height="191"}} * This process rewrites the channel files and data files in the selected folders. The position associated with a bipolar channel in the channel file is the middle of the segment between the two contacts (eg. "b'2-b'1" is placed half-way between "b'1" and "b'2"). <<BR>><<BR>> {{attachment:import_montage_files.gif}} {{attachment:import_montage_chan.gif||width="379",height="119"}} * If you display these new recordings and select the montage "All channels", it would now show the bipolar values. If you select a bipolar montage for these new files, it would do something you don't want, such as displaying values like "(b'4-b'3)-(b'2-b'1)". <<TAG(Advanced)>> === Uniform list of channels === In this example dataset, the list of channels recorded for all the files is the same, we can directly process the three seizures together. But this is not always the case, the list of recorded channels might be different between two files. This could happen if the patient was implanted multiple times, or if not all the contacts could be recorded simultaneously due to technical limitations related with the amplifiers or the acquisition software. For files that have different channels recorded, or the same contacts in a different order, you need to chose one of the two following approaches: * '''Process the two files separately''': the differences will not matter, but you would obtain one epileptogenicity map for each file instead of a group result. * '''Process the two files together''': in this case, only the contact names that are found in all the input files are kept. All the other contacts are removed from the channel files and the recordings files. This will allow the computation of possibly more stable group results, but at the cost of ignoring some of the data. This approach is acceptable only if the deleted channels are far from the seizure onset zone, or you already know they cannot be associated with any interesting information. * If you choose the second option, you need to call a process that deletes the unwanted channels. Select all the bipolar files (Onset and Baseline) in Process1, and run the process '''Standardize > Uniform list of channels''', with the option "'''Keep only the common channel names'''". {{attachment:import_uniform.gif||width="491",height="306"}} == Time-frequency analysis == The aim of this section is only to evaluate the frequency range for the computation of the epileptogenicity maps. We need to identify which frequency band is the most representation and specific of the high-frequency activity at the beginning of a seizure. Starting from this step, you need to have the [[http://www.fil.ion.ucl.ac.uk/spm/software/download/|SPM12 toobox]] installed on your computer and added to your Matlab path. We need here the multitaper functions from the FieldTrip toolbox, which are also included in the SPM package. * In Process1, select all the bipolar files (Epoch and Baseline). * Run the process: '''Frequency > FieldTrip: ft_mtmconvol (Multitaper)''': * '''Time window''': [-10, 10]s * '''Sensor types''': SEEG * '''Taper''': hanning * '''Frequencies''': 10:3:220 * '''Modulation factor''': 10 * '''Time resolution''': 1000ms * '''Measure''': Magnitude * '''Save average''': Disabled * Add the process: '''Standardize > Baseline normalization''': * '''Baseline''': [-10, -1]s * '''Method''': Z-scoe transformation * '''Overwrite''': Enabled * Add the process: '''Average > Average files''': * '''Group files''': Everything * '''Function''': Arithmetic average * Run the pipeline.<<BR>><<BR>> {{attachment:timefreq_multitaper.gif||width="511",height="442"}} <<BR>><<BR>> {{attachment:timefreq_normalize.gif||width="630",height="496"}} * Four new files are available in the database: one for each bipolar Onset epoch, and one average, saved in folder "Intra-subject". * Right-click on the average time-frequency map > '''All channels'''. Then you can click on a channel to open it in a separate figure. Change the colormap to "GIN" and the colormap maximum to [-0.1,+0.1]*10^2 to reproduce the figures below. <<BR>><<BR>> {{attachment:timefreq_allchan.gif||width="650",height="247"}} * These figures are useful to identify a frequency band specific of the fast rhythmic activity after the seizure onset. To create the epileptogenicity maps in the next tutorial, we will use a frequency band for which we observe a significant increase after t=0 with the highest possible frequencies. The underlying physiological hypothesis is that the frequency is higher in the seizure onset zone, and decreases with the propagation: the highest the frequency, the highest the spatial specificity. * Our goal is to identify a few contacts, among the ones showing a sustained significant activity after t=0, for which the spectrum expands in higher frequencies than the others. As a guideline to what is significant and what is not: the values represented here are Z-scores, and a value of Z=5 is already very significant. You can increase the saturation of the image by setting manually the highest value in the color bar (text box colour/max at the bottom of the figure). * Example of several signals, the first one possibly very close to the seizure onset zone (g'7-g'8), and the second one a bit further away (c'9-c'10). This observations leads us to consider the frequency band from 120Hz to 200Hz. <<BR>><<BR>> {{attachment:timefreq_select.gif||width="647",height="224"}} == Epileptogenicity maps == The goal of this section is to create 3D maps of epileptogenicity, with the expectation they indicate the location and extent of the seizure onset zone, and maps of propagation delay in the patient's brain. The method used for computing the epileptogenicity maps is described in this article: David O, Blauwblomme T, Job AS, Chabardès S, Hoffmann D, Minotti L, Kahane P, [[https://academic.oup.com/brain/article/134/10/2898/323878|Imaging the seizure onset zone with stereo-electroencephalography]], Brain, 2011 The first seizure is short (around 5s), without any propagation. We will first compute the epileptogenicity map for this one, without any delay map. Then we will compute the epileptogencity maps for seizures #2 and #3 together, with the associated delay maps during the first 20s of the seizure. We can compute and display the results either in the full MRI volume, or only limited to the cortex surface. To illustrate the two approaches, we will run the first example (seizure #1) in the volume, and the second example (seizure #2 and #3) on the surface. This choice is arbitrary and for demonstration purpose only. If you decide for one approach (volume or surface), keep the same choice for all your analyses. === Volume: Seizure 1 === * In Process2, select the following files: <<BR>>FilesA = '''SZ1_bipolar_2/Baseline''', FilesB =''' SZ1_bipolar_2/Onset''' * Run process: '''Epilepsy > Epilepogenicity maps'''<<BR>><<BR>> {{attachment:epilepto_process_sz1.gif||width="645",height="394"}} * '''Sensor types''': SEEG * '''Frequency band''': 120-200 Hz<<BR>>Frequency band specific of the beginning of the seizure, which should be adapted for each subject manually. See previous section. * '''Latency''': 0s<<BR>>List of time points for which we want to compute an epileptogenicity map, with respect to the seizure onset. There is no expected propagation here, we want to study only the first seconds immediately after the onset marker (0-3s). * '''Time constant''': 3s<<BR>>Duration of the time window used to estimate the epileptogenicity map. * '''Time-resolution''': 0.2s<<BR>>Each 3s window is subdivided in small blocks of 0.2s, the power in each block is estimated for the frequency band 120-200Hz, and a t-test is performed with SPM for all the 0.2s blocks in the baseline vs. all the 0.2s blocks in the time window of interest (post-onset). The result of this t-test is the epileptogenicity map. * '''Propagation threshold''': 0.05<<BR>>Related to the computation of the delay map, so not applicable here. The epileptogenicity maps computed for each 3s window are thresholded using this p-value threshold, then grouped into one single delay map. * '''Output type''': Volume * The results are saved in a new folder "'''Epileptogenicity_volume'''" containing three files: * The channel file is a copy of the channel file in folder SZ1_bipolar_2. * The "source" file contains the epileptogenicity maps and can be displayed in the volume. * The "recordings" file contains the epileptogenicity index associated to each bipolar contact. * These files are time resolved when the "Latency" option is a vector of being a single time point. This will be illustrated in the next section.In this example, if you double-click on the sensor data, you get to see only flat lines because there is only one time point. * Display the two files in various ways and explore the results. From the Stat tab, edit the statistical threshold and the type of correction for multiple comparisons. <<BR>><<BR>> {{attachment:epilepto_map_sz1.gif||width="648",height="293"}} {{attachment:epilepto_index_sz1.gif||width="646",height="272"}} * Note for the SPM experts: If you are interested in exploring all the files generated by SPM, you can access them immediately after the execution in the temporary folder '''$HOME/.brainstorm/tmp/ImaGIN_epileptogenicity'''. === Surface: Seizure 2/3 === * In Process2, select the following files: <<BR>>FilesA = '''SZ2_bipolar_2/Baseline''' and '''SZ3_bipolar_2/Baseline'''<<BR>>FilesB =''' SZ2_bipolar_2/Onset '''and '''SZ3_bipolar_2/Onset''' * Run process: '''Epilepsy > Epilepogenicity maps'''<<BR>><<BR>> {{attachment:epilepto_process_sz23.gif||width="624",height="243"}} * '''Latency''': 0:2:20 s<<BR>>Computes the epileptogenicity maps for sliding windows of 3s between 0s and 20s post-seizure (ie. 0-3s, 2-5s, 4-7s, 20-23s…), then summarizes these results in delay maps with a 2s resolution. * '''Output type''': Surface * We obtain 9 files in a new folder '''Epileptogenicity_surface''': 3x epileptogenicity index (sensor level), 3x epileptogenicity maps (volume), 3x delay maps. For each type of file, we have one result for each individual seizure (_SZ2_*, _SZ3_*) and one for the group results, ie. the two seizures processed simultaneously (_Group_*). * This time, if you double-click on the sensor data, you will observe time series corresponding to the evolution over time of the epileptogenicity index for each bipolar contact. This seems to show a propagation from electrode g' to electrode et'. <<BR>><<BR>> {{attachment:epilepto_index_sz23.gif||width="586",height="214"}} * The epileptogenity maps are now time-resolved as well. Move the time cursor in the time series figure and it updates the map at the selected latency. You can create the figures below with the popup menu Snapshot > Time contact sheet.<<BR>><<BR>> {{attachment:epilepto_mapl_sz23.gif||width="342",height="229"}} {{attachment:epilepto_mapb_sz23.gif||width="254",height="293"}} * The delay maps show a summary of the epileptogenicity maps at different time points after the seizure onset. In this example, we computed 11 epileptogenicity maps for SZ2 and SZ3, for sliding windows of 3s (t,,1,,=0-3s, t,,2,,=2-5s, t,,3,,=4-7s, …, t,,11,,=20-23s). These maps of t-statistics were thresholded under a given significance level (p<0.05). If a voxel is significantly activated in the epiptogenicity map at t=t,,i,,, the value for this voxel in the propagation map is t,,i,,, for i=1..11. At the end, the value of each voxel represents the latency for which the activity in this voxel becomes significantly higher than during the baseline. The color bar in the figures below represent the time, from 0 to 20 seconds. <<BR>><<BR>> {{attachment:epilepto_delay_sz23.gif||width="462",height="190"}} <<TAG(Advanced)>> == Guidelines panel == In addition to this process "Epileptogenicity maps", we developped a simpler interface to reproduce the same analysis with fewer interface manipulations. We will now reproduce the same results with this simplified interface. * In the Brainstorm window, select the menu '''Help''' > '''Guidelines''' > '''Epileptogenicity maps'''. It shows a new panel at the bottom of the window, that will guide you through 6 steps. You can work with a mix of controls from this panel and the regular database explorer. * Click on ['''>>'''] to move to the next step, and ['''Reset'''] to restart the analysis from this step for the selected subject. The first step (1/6) is an introduction, nothing happens here. === Step 2: Import anatomy === Edit the mandatory inputs: * '''Subject name''': Type "Subject02", it will create a new subject in the same protocol. We will import the same anatomy and recordings as in Subject01, it will allow us to compare the files obtained with the two methods. Later, when getting back to this step, simply select an existing subject to resume the analysis where you left it. * '''Pre-implantation MRI''': Select tutorial_epimap/anat/MRI/3DT1pre_deface.nii * '''Post-implantation MRI/CT''': Select tutorial_epimap/anat/MRI/3DT1post_deface.nii * '''MRI volumes are already registered''': Select this option for this example. <<BR>>When this option is __not__ selected, Brainstorm calls SPM to coregister the pre- and post-implantation volumes. If the volumes have already been coregistered and the .nii files look correctly aligned when loaded in any other program, leave this option unchecked to use the existing registration and save some time when importing the files. Ignore the advanced options, keep the default options: * '''Cortex resolution''': This defines which cortex surface will be used to compute the interpolation between the SEEG contacts and the MRI volume. The first three options (5124V, 8196V, 20484V) correspond to the options available for the computation of the SPM canonical mesh of the cortex, the number indicates the number of vertices of the surface. The last one (7861V+hip+amyg) is a modified version of SPM8 canonical mesh with extra vertices to represent the hippocampus and the amygdala of both hemispheres, which was used in the reference publication for the epileptogenicity maps. * '''Onset event name''': Name of the event representing the seizure onset in the recordings. * '''Baseline event name''': Name of the event representing the baseline in the recordings. Click on ['''>>'''] to validate this step, import the anatomy, and move on to the next one. . {{attachment:guidelines_step1.gif}} The MRI viewer opens automatically, showing the post-implantation volume as a colored layer on top of the previous volume. Adjust the transparency and amplitude threshold of this layer in the section Data options in the Surface tab, adjust its colormap with the popup menu of the figure. Use this display to validate that the coregistration of the two volume is correct, all the parts of the head must align well. . {{attachment:guidelines_step2_end.gif||width="326",height="262"}} === Step 3: Prepare recordings === This panel guides you to include the seizure recordings in the database, set the 3D positions of the SEEG contacts, exclude bad channels and mark onset and baseline events. The documentation below explains the role of each button in the toolbar. * '''Add files''': Click on the first button ("Add ictal recordings for this subject") * Select the file format: "'''SEEG: Deltamed/Micromed/...'''" * Select all the SEEG recordings: '''tutorial_epimap/seeg/SZ*.TRC''' * After adding the files to the database, the channel editor is opened automatically. This corresponds to clicking on button [Channels], see below. <<BR>><<BR>> {{attachment:guidelines_step3_add.gif}} * '''Channels''': Opens the channel editor to edit the properties of all the channels of data that were recorded in the .TRC files. The column "#" in the Guidelines tab indicates the number of SEEG channels detected in each file. Make sure the names and types are correct for all the channels. * To edit one channel, double-click on the text to modify. To edit multiple channels, select them all and right-click > Set channel group/type. * The column Group corresponds to the name of the depth electrode. It is detected based on the channel type and name. If you include as SEEG a channel that detected as something else or rename a channel, you would need to manually update the channel name. <<BR>><<BR>> {{attachment:guidelines_step3_channels.gif}} * If you modify the list of channels associated to the type "SEEG", when you close the channel editor and save the modifications, the number of SEEG contacts in the Guidelines tab should be updated automatically. * Note that the Guidelines tab gets updated automatically only for operations that were initiated from the Guidelines tab. If you open the channel editor from the database explorer and modify the list of SEEG channels, the number in the column "#" would not be updated automatically. The same goes for the bad channels and event markers. To force the values in the Guidelines tab to be reloaded, click [<<] and [>>] again. * If all the files have the same list of channels (same names and same order), the modifications done for one file are reported to all the other channel files. Otherwise, it saves only the modifications for the file that was selected before clicking on [Channels]. If the channel list is different across files, you have to edit the channel file separatly for each file (select the file in the list, then click on [Channels]). * '''3D''': Sets the positions of the SEEG contacts. In this example, we will load contact positions we obtained from another program, but you could also mark the positions using Brainstorm. * Click on '''[3D]''', then '''[Import]''' * Select the file format: "'''EEG: ASCII: Name, XYZ (*.*)'''" * Select the file: '''tutorial_epimap/anat/implantation/elec_pos_patient.txt ''' * Selection default options: '''[0.1]''' and '''[Yes]'''. [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Import_the_contacts_positions|More details]]. * After importing the positions, a 3D figure shows the post-implantation volume with the imported contacts positions, and possibly the depth electrodes if the detection worked. [[http://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#MRI_in_3D|Move the]][[http://neuroimage.usc.edu/brainstorm/Tutorials/ExploreAnatomy#MRI_in_3D|volume slices]] to make sure the contact artifacts match the positions of the electrodes. <<BR>><<BR>> {{attachment:guidelines_step3_3d.gif}} * The circles in the column "3D" of the Guidelines tab turn green when the 3D positions of __all__ the SEEG contacts is set. If it stays red after importing the positions, you have either some channels mislabelled as SEEG, or a list of a positions that does not include all the SEEG contacts. Another common issue is the use of a different labelling convention in the SEEG recordings and the file with the positions. You may have to rename the contacts either in the channel file (from Brainstorm) or in the positions file (with a text editor, before importing) in order to have them matched correctly. * Same comment as for the button [Channels]: If all the files have the same list of channels (same names and same order), the modifications done for one file are reported to all the other channel files. Otherwise, it saves only the modifications for the file that was selected before clicking on [3D]. * '''Review''': Displays the SEEG recordings for the selected file. The goal is now to mark for each file: the bad channels, the seizure onset(s), the baseline(s). * Select the first file SZ1, click on [Review] (or simply double-click on the first file). * Use a [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Display_the_SEEG_recordings|monopolar montage]], then [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Bad_channels|mark the bad channels]]. * If you close the figure, it saves the modifications and updates the panel. <<BR>><<BR>> {{attachment:guidelines_step3_bad.gif}} * '''Onset''': Adds an event marker "Onset" to identify the seizure onset. The marker is placed at the current time (red cursor in the figure). If the file viewer is not opened yet, this button has the same effect as button "Review". * Follow [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Seizure_onset|these recommendations]] for selecting an appropriate seizure onset. * When you close the figure, it saves the modifications and updates the panel. But you don't have to close and save at each step. Mark the bad channels, onset and baseline markers for a file before closing. * If you already know the bad channels/onset/baseline for a file, right-click on the file and select the appropriate menu. <<BR>><<BR>> {{attachment:guidelines_step3_set.gif}} * '''Baseline''': Adds an event marker "Baseline" to identify a baseline in the file. The baseline must be an extended event, selected with the mouse or with the menu "Set selection manually". If the file viewer is not opened yet, this button has the same effect as button "Review". * Follow [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Baseline|these recommendations]] for selecting an appropriate seizure onset. * If you close the figure, it saves the modifications and updates the panel. <<BR>><<BR>> {{attachment:guidelines_step3_done.gif}} * Click on ['''>>'''] after reviewing all the files. === Step 4: Import epochs === This step imports two segments of recordings for each seizure file: the seizure (duration edited in this panel) and the baseline (the segment to import is already defined). [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Import_epochs_of_interest|More details]]. * '''Time window''': Select 10s before and 40s after the onset. * '''Electrode montage''': Bipolar 2 * Click on ['''>>'''] to import the epochs and apply the bipolar montage. <<BR>><<BR>> {{attachment:guidelines_step4_panel.gif}} {{attachment:guidelines_step4_done.gif||width="210",height="103"}} === Step 5: Time-frequency === This step computes the time-frequency decomposition of the SEEG signals around the seizure onset and normalizes them based on the short baseline (10s) immediately before the seizure onset. * For information about the parameters or the display/interpretation of the results, see [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Time-frequency_analysis|this section]]. * At the end of the computation, two figures appear, showing all the time-frequency maps averaged across all the seizures. The first window shows all the contacts individually (click on one contact to display it in a separate window), and the other one represents the average of all the contacts. <<BR>><<BR>> {{attachment:guidelines_step5_panel.gif||width="260",height="130"}} {{attachment:guidelines_step5_maps.gif||width="364",height="184"}} * Use these figures to identify the frequency band of interest for this subject: 120-200Hz === Step 6: Epileptogenicity === Last step of the analysis, reproduces what is illustrated in [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Epileptogenicity_maps|this section]]. * '''Frequency band''': Enter what you visually identified previously (120-200Hz), or select the relevant part of the time-frequency map with your mouse and click on [Get]. * '''Latency list''': 0s (no propagation expected, looking only at the first 3 seconds) * '''Time constant''': 3s (duration of the time window used to estimate the epileptogenicity map) * '''Propagation threshold''': p-value threshold on the epileptogenicity map for the computation of the propagation maps (not applicable here, there is no propagation map computed) * '''Output type''': Volume * '''File selection''': Select only SZ1 * Click on ['''>>'''] to start the computation. Expect it to last for a while...<<BR>><<BR>> {{attachment:guidelines_step6_panel1.gif||width="558",height="150"}} * In output you get exactly the same volume as what was illustrated [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Epileptogenicity_maps|here]].<<BR>><<BR>> {{attachment:guidelines_step6_res1.gif||width="490",height="200"}} Repeat for SZ2 and SZ3, processed together, on the cortex surface instead of the volume: * '''Latency list''': 0:2:20 s (sliding windows of 3s between 0s and 20s post-seizure) * '''Output type''': Surface * '''File selection''': SZ2 and SZ3 * Click on ['''>>'''] to start again the computation. There is a lot more to estimate (11 epileptogenicity maps), but the computation on the surface is a lot faster.<<BR>><<BR>> {{attachment:guidelines_step6_panel2.gif}} * Same results for Subject01 and Subject02, but on a different surface. The example in the previous section was using the default SPM12 canonical surface, while here we used the modified SPM8 surface including amygdala and hippocampus. Except for this, the two interfaces are equivalent. <<BR>><<BR>> {{attachment:guidelines_step6_res2.gif||width="587",height="186"}} <<TAG(Advanced)>> == Importing realistic surfaces == Instead of using the default SPM canonical surfaces, you can use realistic cortex envelopes, extracted with [[http://neuroimage.usc.edu/brainstorm/Tutorials/LabelFreeSurfer|FreeSurfer]], [[http://neuroimage.usc.edu/brainstorm/Tutorials/SegBrainSuite|BrainSuite]] or [[http://neuroimage.usc.edu/brainstorm/Tutorials/SegBrainVisa|BrainVISA]]. Instead of importing the anatomy as described previously (pre MRI then post MRI), follow these steps. Note that this cannot be done with the simplified interface in the Guidelines tab. * Right-click on the subject folder > '''Import anatomy folder''': * Select file type: "BrainVISA folder" * Select folder: tutorial_epimap/anat/MRI/brainvisa/ * Number of vertices: 15000 * When the MRI viewer shows up asking for fiducial points, click on "'''Click here to compute MNI transformation'''", then click on [Save] when the computation is done. <<BR>><<BR>> {{attachment:anat_brainvisa.gif||width="361",height="194"}} * This is the anatomy of the subject (MRI pre-implantation) processed with the morphologist pipeline of BrainVISA 4.5. The MRI pre-implantation is now imported, but the post-implantation is still missing. * Right-click on the subject folder > '''Import MRI''': * Import the volume exactly as previously, following [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epileptogenicity#Post-implantation_MRI|these guidelines]]. * When importing the volumes processed with FreeSurfer, you probably need to register the volume, as FreeSurfer rewrites the volume with a different orientation. Select option [SPM] instead of [Ignore]. * In the subject anatomy folder, you can decide to use the pial surface ("cortex") or the grey-white interface ("white") for the computation of the epileptogenicity maps. As these surfaces are fairly different, it may leed to very different results. A SEEG contact close to one surface can be too far from the other to be taken into account in the computation. Make this choice carefully. To change the default surface, right-click > '''Set as default cortex''', or simply double-click on it. Just avoid selecting the high-resolution surfaces (126000 vertices) or the computation will take forever. * Then you can repeat all the steps previously presented. The results may look different depending on the surface you selected (left=cortex, right=white). <<BR>><<BR>>{{attachment:anat_brainvisa_delay.gif}} <<TAG(Advanced)>> == On the hard drive == IntraElectrodes structure <<TAG(Advanced)>> == Volume coregistration == <<TAG(Advanced)>> == Editing the contacts positions == <<TAG(Advanced)>> == Creating a new implantation file == Same as previous section, but not starting from an existing of contacts. == TODO == * Fix all the links in this page * Add lots of links from the Guidelines section to the other tutorials * Proofread and check spelling * Send for review: John, Sylvain, Martin, Richard, Francois D, Jean G, Jean-Marc, Christophe, Laurent S, Christoph, Marcel, Beth, Jeremy, Olivier, Leila, Jean-Michel, Katia, Manuel, Chauvels, Christian, Ghislaine, Stan, Vladimir, forum users posting about SEEG == Scripting == The following script from the Brainstorm distribution reproduces the analysis presented in this tutorial page: [[https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/script/tutorial_epileptogenicity.m|brainstorm3/toolbox/script/tutorial_epileptogenicity.m]] <<HTML(<div style="border:1px solid black; background-color:#EEEEFF; width:720px; height:500px; overflow:scroll; padding:10px; font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif; font-size: 13px; white-space: pre;">)>><<EmbedContent("http://neuroimage.usc.edu/bst/viewcode.php?f=tutorial_epileptogenicity.m")>><<HTML(</div >)>> <<EmbedContent(http://neuroimage.usc.edu/bst/get_feedback.php?Tutorials/Epileptogenicity)>> |
SEEG epileptogencity maps
[TUTORIAL UNDER DEVELOPMENT: NOT READY FOR PUBLIC USE]
Authors: Francois Tadel, Olivier David.
This tutorial introduces some concepts that are specific to the management of SEEG recordings in the Brainstorm environment, and explains how to compute maps of epileptogenicity from ictal recordings. It is based on a clinical case from the Grenoble University Hospital, France.
Note that the operations used here are not detailed, the goal of this tutorial is not to introduce Brainstorm to new users. For in-depth explanations of the interface and theoretical foundations, please refer to the introduction tutorials.
Warning: The same tools can be used for processing and displaying ECOG, but this hasn't been debugged properly yet. Please share with us any suggestion for improving the ECOG support.
Contents
- Dataset description
- Download and installation
- Import the anatomy
- Access the recordings
- Display the depth electrodes
- Display the SEEG recordings
- Review recordings
- Import epochs of interest
- Time-frequency analysis
- Epileptogenicity maps
- Guidelines panel
- Importing realistic surfaces
- On the hard drive
- Volume coregistration
- Editing the contacts positions
- Creating a new implantation file
- TODO
- Scripting
Dataset description
License
This tutorial dataset (EEG and MRI data) remains property of the Grenoble University Hospital, France. Its use and transfer outside the ImaGIN and Brainstorm tutorials, e.g. for research purposes, is prohibited without written consent. For questions, please contact Olivier David, PhD ( olivier.david@inserm.fr ).
Clinical description
This dataset includes recordings for a patient that was not reported in the above article, but are part of the same study. The patient presents a focal epilepsy of the left temporo-occipital junction, MRI-negative, and was implanted in the surrounding areas. The subfolder "seeg" contains the recordings of three seizures, all of them showing a propagation of high-frequency oscillations from the lesion towards the temporal lobe, bilaterally.
SEEG recordings
The depth electrodes used in this example dataset are DIXI D08-**AM Microdeep electrodes, with the following specifications:
- Diameter: 0.8 mm
- Contact length: 2 mm
- Insulator length: 1.5 mm
- Distance between the center of two contacts: 3.5 mm
- Between 8 and 18 contacts on each electrode
Files
The dataset we distribute with this tutorial follows the Brain Imaging Data Structure (BIDS) standard for neuroimaging data organization. This specification was first established for MRI and fMRI (Gorgolewski, 2016) and then refined with an extension dedicated to iEEG (Holdgraf, 2019). The files that will be imported in this tutorial are the following:
tutorial_epimap_bids/
derivatives/: Everything that cannot be considered as raw data
brainvisa/sub-01_ses-pre/: Result of the BrainVISA 4.5 segmentation for the pre-implantation T1 MRI.
sub-01/: Raw data for subject 01
ses-preimp/: Imaging exams performed before the implantation of the sEEG.
anat/sub-01_ses-preimp_T1w.nii.gz: T1-weighted MRI pre-implantation
ses-postimp/: Exams performed with the sEEG devices implanted.
anat/sub-01_ses-postimp_T1w.nii.gz: T1-weighted MRI post-implantation
ieeg/..._task-seizure_run-0*_ieeg.eeg: Three seizure recordings in BrainVision file format, one seizure per file (with the header files .vhdr and .vmrk)
ieeg/..._space-IXI549Space_electrodes.tsv: Position of the contacts in MNI space (SPM12 Segment non-linear normalization)
ieeg/..._space-ScanRAS_electrodes.tsv: Position of the contacts in world coordinates, relative to the post-implantation T1 MRI.
All the anatomical images have been de-identified with mri_deface from FreeSurfer 6.
References
The acquisition methodology is described in the following articles:
David O, Blauwblomme T, Job AS, Chabardès S, Hoffmann D, Minotti L, Kahane P, Imaging the seizure onset zone with stereo-electroencephalography, Brain. 2011 Oct;134(10):2898-911
Lamarche F, Job AS, Deman P, Bhattacharjee M, Hoffmann D, Gallazzini-Crépin C, Bouvard S, Minotti L, Kahane P, David O, Correlation of FDG-PET hypometabolism and SEEG epileptogenicity mapping in patients with drug-resistant focal epilepsy, Epilepsia. 2016 Dec; 57(12):2045–2055
Download and installation
Requirements: You have already followed all the introduction tutorials and you have a working copy of Brainstorm installed on your computer.
Go to the Download page of this website, and download the file: tutorial_epimap.zip
- Unzip it in a folder that is not in any of the Brainstorm folders (program folder or database folder)
- Start Brainstorm (Matlab scripts or stand-alone version).
Select the menu File > Create new protocol. Name it "TutorialEpimap" and select the options:
"No, use individual anatomy",
"No, use one channel file per acquisition run".
Import the anatomy
Pre-implantation MRI
Right-click on the TutorialEpimap folder > New subject > Subject01.
Keep the default options you defined for the protocol.- Switch to the "anatomy" view of the protocol.
Right-click on the subject node > Import MRI:
Set the file format: "All MRI file (subject space)"
Select the file: tutorial_epimap/anat/MRI/3DT1pre_deface.niiDo you want to apply the transformation to the MRI file? YES
The MRI viewer opens automatically. Click on "Click here to compute MNI transformation". It computes an affine transformation between the subject space and the MNI ICBM152 space, and sets default positions for all the anatomical landmarks.
- Click on [Save] to close the MRI viewer.
Post-implantation MRI
- The pre-implantation MRI will be used as the anatomical reference for this subject. We will now import a second scan done after the SEEG implantation, on which we can see the SEEG electrodes and contacts. In this dataset, the post-implantation volume is another T1 MRI scan (contacts hyposignal appear in black), but it is more commonly a CT scan (contacts hypersignal appear in white).
Right-click on the subject node > Import MRI:
Select the file: tutorial_epimap/anat/MRI/3DT1post_deface.niiDo you want to apply the transformation to the MRI file? YES
This will reorient the MRI in Brainstorm's standard orientation, so you can see the coronal/sagittal/axial views correctly oriented.How to register the new volume? IGNORE
The two volumes have already been coregistered with SPM. See the section Volume coregistration for more details on this option.Reslice the volume? YES
This will rewrite the volume with the orientation and resolution of the pre-implantation MRI, so that the two volumes can be overlaid in the MRI viewer. You may answer no to this question when the resolution of the pre-implantation MRI is very low and/or when you want to edit the positions of the fiducials in the original post-implantation volume (CT or MRI).The MRI viewer opens automatically, showing the post-implantation volume as a colored layer on top of the previous volume. Adjust the transparency and amplitude threshold of this layer in the section Data options in the Surface tab, adjust its colormap with the popup menu of the figure. Use this display to validate that the coregistration of the two volume is correct, all the parts of the head must align well.
Generate default surfaces
Right-click on the pre-implantation MRI > SPM canonical surfaces.
- Leave the default option selected (20484). This represents the resolution of SPM template surface used in this process. The higher the better, but it will slow down significantly the computation of the epileptogenicity maps.
These surfaces will be used later, in the computation of the epileptogenicity maps. Read the advanced sections of this page for information on how to use realistic surfaces from BrainVISA or FreeSurfer.
Access the recordings
Link the recordings
- Switch to the "functional data" view (2nd button, on top of the database explorer).
Right-click on the subject folder > Review raw file:
Select the file format: "SEEG: Deltamed/Micromed/..."
Select all the SEEG recordings: tutorial_epimap/seeg/*.TRC
The new files "Link to raw file" let you access directly the contents of the original SEEG files. The menu "Review raw file" does not actually copy any data to the database. More information.
Import the contacts positions
In order to generate epileptogenicity maps, we need accurate 3D positions for the contacts of the depth electrodes. Placing the contacts requires a good understanding of the implantation scheme reported by the neurosurgeon, and some skills in reading MRI scans. To make this tutorial easier to reproduce and follow, we distribute the positions of the contacts saved in a text file (folder /anat/implantation). For instructions to place the SEEG contacts using Brainstorm, read the advanced section Editing the contacts positions.
- The channel files "Micromed channels" contain the name of the channels, but not their positions. We need to import or edit separately the positions of the SEEG contacts.
- Click on the [+] next to the three SZ folders, select all the channel files simultaneously.
Right-click one channel file > Add EEG positions > Import from file:
Select the file format: "EEG: ASCII: Name, XYZ (*.*)"
Select the file: tutorial_epimap/anat/implantation/elec_pos_patient.txt
Select a scaling factor: 0.1 (keep the default selection)
The positions in this text file are in millimeters, while the expected unit for "EEG: ASCII" is the centimeter. This option means that the values will be interpreted as 0.1*cm, ie. millimeters.
Apply MRI transformation? YES
This will interpret the coordinates in the text file as positions in the referential defined by the voxel-to-world transformation (vox2ras) transformation available in the MRI, if available (in NIfTI format, this corresponds to matrices qform or sform). If you answer no here, it would load the positions as Brainstorm SCS coordinates and try to realign them based on the NAS/LPA/RPA landmarks.
- At the end you get a report indicating how many channels from the SEEG recordings were attributed a new 3D position. The channels are matched by name: the position file you import must include the labels of the electrodes and they must be named exactly in the the same way as in your recordings.
The type of the channels for which a position was not found is set to EEG_NO_LOC, so they are ignored when you process the SEEG channels. In this example dataset, the channels that are not found are "fz" and "cz", which are indeed not SEEG contacts.
You should always validate that the type of all the channels has been detected correctly. Check also that the names are correct and using the same convention for all the contact of a given electrode. These are entered manually, and typing errors are frequent. Right-click on a channel file > Edit channel file.
MNI coordinates: Note that you can also import contact positions in MNI coordinates. In this example dataset includes the positions, they are available in the file "elec_pos_patient.txt". To import this file correctly, make sure you select a file format that explicitely mentions MNI coordinates. In this example, it would be: "EEG: ASCII: Name, XYZ_MNI (*.*)".
If you don't have the positions for the SEEG contacts, or if they don't look correctly aligned, you can directly place them in the MRI viewer. See the section Editing the contacts positions.
Display the depth electrodes
3D figures
Right-click on the channel file > Display sensors > Explore all the options available.
You can render the SEEG depth electrodes in 3D together with the subject surfaces, pre- or post-implantation volumes. You can add more anatomy elements to the figure with the button "Add a surface" at the top-right of the Surface tab. For more help: Display the anatomy.
Click on contact to select it, right-click on the figure to get its name:
MRI Viewer
You can also display the contacts in the MRI viewer, on top of the the pre- or post-implantation volumes. By default, the electrode is displayed in a slice if there is a contact of attached to this electrode in the slice.
To display all the electrodes, select the option "MIP: Functional". For a glass-brain view, select at the same time the option "MIP: Anatomy".
Zoom in/out with the buttons or the associated shortcuts (Ctrl+Scroll or +/-) and explore the volume with (Shift+)x/y/z. Additional display options are available in the popup menu for this figure. All the shortcuts listed in this tutorial.
You can edit the position of a contact directly by clicking on its dot in one of the slice and moving it around. Modifications are not saved immediately and can be cancelled when you close the window. Alternatively, you can right-click on the figure > Set electrode position.
Panel iEEG
When opening SEEG/ECOG recordings, the panel iEEG is added to the Brainstorm window. You can use it to edit the display properties of the depth electrodes. In this interface, "electrode" refers to entire depth electrode implanted in the head of the patient while "contact" refers to recording sites on the electrode. There are multiple contacts on an electrode, and one contact corresponds to one channel of data in the channel file and the recordings.
SEEG depth electrodes are graphical objects, they are defined independently from the SEEG contacts available in the channel file and recordings. A contact/channel is associated to a depth electrode using the Group property of the channel, accessible with a right-click on the channel file > Edit channel file.
- In this example, the depth electrodes available in the panel iEEG have been detected automatically based on the names and positions of the data channels. In the convention used here, the contact names must start with one or more letters (the name of the electrode) followed by a number representing the index of the contact on the electrode. Contact #1 is at the tip of the electrode, and is therefore the deeper contact of the electrode. If the convention used in your recordings is different, you may have to edit the electrodes properties in order to get them displayed correctly.
- Buttons in the toolbar:
Add an electrode: Adds an entry for a new depth electrode. The new electrode will not be displayed until you set its properties and position. This will not add or remove SEEG contacts or channels of data.
Remove selected electrodes: Deletes a depth electrode from the list, but does not modify the list of SEEG contacts or channels of data.
Set color for selected electrodes: Self explanatory.
Show/hide selected electrodes: To hide an electrode in the 3D figures and MRI viewers, select it in the list then click on this button. Select all the electrodes with the standard shortcut Ctrl+A.
Display contacts as: Depth electrodes / Spheres.
Contacts > Set default positions: For each of the selected electrodes, the current positions of the SEEG contacts are discarded and replaced with the default positions of the contacts on the electrode. The properties used for setting the position of the contacts are the contact spacing, the tip of the electrode and the entry point in the skull. Contact #i is placed along the electrode at (i-1)*contact_spacing millimeters for the tip of the electrode.
Contacts > Project on electrode: For each of the selected electrodes, the contacts are projected orthogonally on the electrode. This menu can be useful for aligning contacts that were marked one by one.
Contacts > Save modifications: Save the current modifications to the channel file. Otherwise, the modifications are saved only when you close the figure (dialog box "Save modifications to channel file?")
Contacts > Export contacts positions: Save the 3D positions of the SEEG contacts in the current channel file in one of the file formats supported by Brainstorm.
Electrode properties: Properties that have an impact on the position of the contacts.
- If you edit the properties, the modifications will apply to all the selected electrodes in the current channel file. Check what is selected before making changes.
Type: SEEG/ECOG
Model: List of electrode models. If you select an entry in this menu, it will copy the default properties for this model to the selected electrodes. If you are using electrodes that are not in this list, please post on the specification of your devices on the user forum and we will add them to this list.
Number of contacts: Number of recording sites on the electrode. By default, this is set for SEEG to the maximum index found in a group of contacts. Example: electrode s' is associated to channels s'1, s'2, s'3, s'10, s'11, s'12 => detected number of contacts is 12.
Contact spacing: Distance between the centers of two consecutive contacts in the electrode. In this example dataset, the default value corresponds to the average distance observed between pairs of adjacent contacts.
Set tip: Select one electrode in the list, then move the cursor of the MRI viewer to the tip of the selected electrode (center of the first contact), and finally click on [Set tip].
Set skull entry: Select one electrode in the list, then move the cursor of the MRI viewer to the point where the depth electrode enters the skull (or the center of the screw), and finally click on [Set skull entry]. This position does not correspond to any contact, it is used only to estimate the direction of the depth electrode.
- Display options: Properties that only affect the way the electrodes are renderer graphically.
Contact length: Defines the length along the electrode axis of the yellow cylinder that represents the contacts, or the diameter of the sphere when the electrodes are not rendered.
Contact diameter: Diameter of the yellow cylinders representing the contacts. By default, this value is slightly larger than the electrode diameter so that it is rendered correctly. If you use the same value as the electrode diameter, the contacts might not be visible.
Electrode diameter: Diameter of the cylinder representing the SEEG depth electrode.
Electrode length: Length of the cylinder representing the SEEG depth electrode.
Display the SEEG recordings
SEEG time series
Right-click on any "Link to raw file" > SEEG > Display time series.
- For instructions on how to use this viewer, please refer to these tutorials:
- Typical display configuration includes:
Set the page duration tp 20s or 30s: Record tab > Page settings.
Change the display mode to "columns": Record tab > Toolbar > First button.
Change the montage (bipolar/monopolar): Record tab > Note all the default montages available for SEEG: you can display all the contacts at once, or each electrode individually.
- Set visualization filters: Filter tab.
- Disable the automatic scaling when changing page: Button [AS] in the time series figure.
- Adjust the amplitude scale: Right-click+move up/down, or buttons [^] and [v].
Set the resolution precisely: Right-click on the figure > Figure > Set axes resolution.
With the menus "3D electrodes" you can visualize the SEEG values at the current time point. Move the time cursor and it will update the values represented on the SEEG contacts.
Interpolate on the anatomy
From the same SEEG display menu, you can also project the SEEG values on the MRI or the cortex. You can edit the colormap for the displayed value like any other colormap.
MRI volume: All the voxels in the neighborhood of a contact are attributed the value associated with this contact. In the figure below, both "MIP: functional" and "MIP: anatomy" options are selected.
Cortex surface: The values of the vertices are interpolated from the nearest SEEG contacts (the magnitude decreases with the distance to the contact).
Review recordings
Bad channels
We will now to review the recordings for the three seizures recorded for this subject: SZ1, SZ2, SZ3. All the following steps are illustrated only for SZ1 but need to be reproduced for the other files.
Double-click on SZ1/Link to raw file to open the SEEG recordings for the first seizure.
We need to mark the bad channels using a "monopolar" montage (common reference). If you are currently reviewing the recordings with a bipolar montage, swith it back to "All channels", using the menu in the toolbar of the record tab or with the popup menu of the time series figure. Otherwise, marking a signal as bad (eg. "v'2-v'1") would actually mark two channels as bad ("v'1" and "v'2"), while only one contact ("v'1") is not recording properly.
Click on the channels that you consider as bad to select them. For SZ1, select v'1 and f'1.
Press the delete key, or use the popup menu Channels > Mark selected as bad.
- Close the figure and repeat for the two other files.
- Bad channels for the three seizures:
SZ1: v'1, f'1
SZ2: v'1
SZ3: o'1, t'8
Seizure onset
Two events are already available in this file: "Part1" only indicates the beginning of the file, and "Seizure" indicates approximately the onset of the first seizure. This marking was done for clinical use, to jump quickly to the page of interest, but here we need a more accurate marker. We will create a new marker "Onset" where we observe the beginning of the fast gamma activity, which is the main feature used computation of the epileptogenicity maps is based on.
Double-click on SZ1/Link to raw file to open the SEEG recordings for the first seizure, or do this immediately after marking the bad channels.
Switch to a bipolar montage: bipolar-1 is sparse (eg. g2-g1, g4-3), bipolar-2 is exhaustive (eg. g2-g1, g3-g2, g4-3), depending on how dense you want your figure to be.
In the Record tab, click on the event group "Seizure", then on the event timing. This will jump quickly to the page on which we will place our Onset marker.
Zoom around the g' contacts (using the buttons on the right of the figure or the corresponding shortcuts, indicated if you leave your mouse over the buttons for a second), or select the g' electrode in the montage menu.
- If needed, zoom locally in time in the current page (mouse wheel) and change the amplitude scale (right-click+mouse up/down).
Create an event group "Onset": Record tab > Events > Add group > "Onset", or select it.
Place the time cursor at 120.800s, add an Onset marker at this time (press the key "E", or use the popup menu Add/delete event).
If you are marking a lot of events, you might be interest in using custom shortcuts.
- Repeat for the other files. Seizure onset time for the three seizures:
SZ1: 120.800s
SZ2: 143.510s
SZ3: 120.287s
Baseline
In the following sections, we will compute a time-frequency decomposition of the seizure and normalize it with respect to a baseline level. We will identify and import this baseline now. The baseline could be a segment of 5s to 30s of recordings, typically before the seizure, that contains as little interictal epileptiform activity as possible.
The duration of the baseline influences the computation time for the following steps of this tutorial. We will work here with short segments of 5s for illustration purposes, between 72.8s and 77.8s. Use longer segments for more accurate results.
Create a new event group "Baseline".
Select the segment [72.8s, 77.8s]: Click and drag your mouse, or right-click > Time selection > Set selection manually. Then create a Baseline extended event ("E" or "Add/delete event").
- Repeat for the other files. Baselines for the three seizures:
SZ1: [72.800, 77.800]s
SZ2: [103.510, 108.510]s
SZ3: [45.287, 50.287]s
Close the viewer to save the modifications, or use the menu File > Save modifications.
Import epochs of interest
At this point of the analysis, we are still looking at the original files, no SEEG data was copied to the database. The montages are saved in the Brainstorm preferences, the bad channels and new events are saved in the links of the database but not eported to the original .TRC files. If you delete your protocol at this point, you would only lose the event marking and bad channel selection.
We are now going to import two segments of recordings for each seizure file: the seizure (10s before and 40s after the onset) and the baseline (all the segment selected). This will make real copies of the data in the database, so we can run additional processes on them.
Import in database
Right-click on the SZ1 / Link to raw file > Import in database:
- Time window: All, the only interesting point is to have access to the Onset marker.
- Split in time blocks: Disabled
Use events: Enabled, select Onset
Epoch time: [-10000, +40000] ms (imports -10s to 40s around the event "Onset")
- Remove DC offset: Disabled
- Resample: Disabled
Create a separate folder for each event type: Disabled
- Repeat the last operation to import the baseline, modify only the following options:
Use events: Select Baseline
- Epoch time: Not applicable, the event Baseline already defines a start and an end
- Repeat for the three seizures.
- At the end, you should have three new folders SZ1/SZ2/SZ3, the same name as the original .TRC files, but without the tag "raw" on top of it. These new folders contain copy of the SEEG recordings, if you delete these folders from the database explorer, you lose the files they contain.
The imported epochs are saved with a new timing: for the seizure onsets, the reference time t=0s is now the event "Onset", which has been removed from the list. You can still see the other marker Seizure, which should be slightly before 0s. For the baselines, the reference t=0 is the beginning of the segment.
Bipolar montage
We will run the rest of the analysis using a bipolar montage (bipolar-2). The montage selected in the Record tab is for visualization only, most processes ignore this selection and work only on the original common-reference data. To force all the processes to work on the bipolar values, we need to explicitly apply the montage to the recordings.
- In Process1, drag and drop all the imported recordings (either the folders or the files).
Run the process Standardize > Apply montage:
Montage: Subject01: SEEG (bipolar 2)
Create new folders: Enabled
This process rewrites the channel files and data files in the selected folders. The position associated with a bipolar channel in the channel file is the middle of the segment between the two contacts (eg. "b'2-b'1" is placed half-way between "b'1" and "b'2").
- If you display these new recordings and select the montage "All channels", it would now show the bipolar values. If you select a bipolar montage for these new files, it would do something you don't want, such as displaying values like "(b'4-b'3)-(b'2-b'1)".
Uniform list of channels
In this example dataset, the list of channels recorded for all the files is the same, we can directly process the three seizures together. But this is not always the case, the list of recorded channels might be different between two files. This could happen if the patient was implanted multiple times, or if not all the contacts could be recorded simultaneously due to technical limitations related with the amplifiers or the acquisition software.
For files that have different channels recorded, or the same contacts in a different order, you need to chose one of the two following approaches:
Process the two files separately: the differences will not matter, but you would obtain one epileptogenicity map for each file instead of a group result.
Process the two files together: in this case, only the contact names that are found in all the input files are kept. All the other contacts are removed from the channel files and the recordings files. This will allow the computation of possibly more stable group results, but at the cost of ignoring some of the data. This approach is acceptable only if the deleted channels are far from the seizure onset zone, or you already know they cannot be associated with any interesting information.
If you choose the second option, you need to call a process that deletes the unwanted channels. Select all the bipolar files (Onset and Baseline) in Process1, and run the process Standardize > Uniform list of channels, with the option "Keep only the common channel names".
Time-frequency analysis
The aim of this section is only to evaluate the frequency range for the computation of the epileptogenicity maps. We need to identify which frequency band is the most representation and specific of the high-frequency activity at the beginning of a seizure.
Starting from this step, you need to have the SPM12 toobox installed on your computer and added to your Matlab path. We need here the multitaper functions from the FieldTrip toolbox, which are also included in the SPM package.
- In Process1, select all the bipolar files (Epoch and Baseline).
Run the process: Frequency > FieldTrip: ft_mtmconvol (Multitaper):
Time window: [-10, 10]s
Sensor types: SEEG
Taper: hanning
Frequencies: 10:3:220
Modulation factor: 10
Time resolution: 1000ms
Measure: Magnitude
Save average: Disabled
Add the process: Standardize > Baseline normalization:
Baseline: [-10, -1]s
Method: Z-scoe transformation
Overwrite: Enabled
Add the process: Average > Average files:
Group files: Everything
Function: Arithmetic average
Run the pipeline.
- Four new files are available in the database: one for each bipolar Onset epoch, and one average, saved in folder "Intra-subject".
Right-click on the average time-frequency map > All channels. Then you can click on a channel to open it in a separate figure. Change the colormap to "GIN" and the colormap maximum to [-0.1,+0.1]*10^2 to reproduce the figures below.
- These figures are useful to identify a frequency band specific of the fast rhythmic activity after the seizure onset. To create the epileptogenicity maps in the next tutorial, we will use a frequency band for which we observe a significant increase after t=0 with the highest possible frequencies. The underlying physiological hypothesis is that the frequency is higher in the seizure onset zone, and decreases with the propagation: the highest the frequency, the highest the spatial specificity.
- Our goal is to identify a few contacts, among the ones showing a sustained significant activity after t=0, for which the spectrum expands in higher frequencies than the others. As a guideline to what is significant and what is not: the values represented here are Z-scores, and a value of Z=5 is already very significant. You can increase the saturation of the image by setting manually the highest value in the color bar (text box colour/max at the bottom of the figure).
Example of several signals, the first one possibly very close to the seizure onset zone (g'7-g'8), and the second one a bit further away (c'9-c'10). This observations leads us to consider the frequency band from 120Hz to 200Hz.
Epileptogenicity maps
The goal of this section is to create 3D maps of epileptogenicity, with the expectation they indicate the location and extent of the seizure onset zone, and maps of propagation delay in the patient's brain. The method used for computing the epileptogenicity maps is described in this article:
David O, Blauwblomme T, Job AS, Chabardès S, Hoffmann D, Minotti L, Kahane P, Imaging the seizure onset zone with stereo-electroencephalography, Brain, 2011
The first seizure is short (around 5s), without any propagation. We will first compute the epileptogenicity map for this one, without any delay map. Then we will compute the epileptogencity maps for seizures #2 and #3 together, with the associated delay maps during the first 20s of the seizure.
We can compute and display the results either in the full MRI volume, or only limited to the cortex surface. To illustrate the two approaches, we will run the first example (seizure #1) in the volume, and the second example (seizure #2 and #3) on the surface. This choice is arbitrary and for demonstration purpose only. If you decide for one approach (volume or surface), keep the same choice for all your analyses.
Volume: Seizure 1
In Process2, select the following files:
FilesA = SZ1_bipolar_2/Baseline, FilesB = SZ1_bipolar_2/OnsetRun process: Epilepsy > Epilepogenicity maps
Sensor types: SEEG
Frequency band: 120-200 Hz
Frequency band specific of the beginning of the seizure, which should be adapted for each subject manually. See previous section.Latency: 0s
List of time points for which we want to compute an epileptogenicity map, with respect to the seizure onset. There is no expected propagation here, we want to study only the first seconds immediately after the onset marker (0-3s).Time constant: 3s
Duration of the time window used to estimate the epileptogenicity map.Time-resolution: 0.2s
Each 3s window is subdivided in small blocks of 0.2s, the power in each block is estimated for the frequency band 120-200Hz, and a t-test is performed with SPM for all the 0.2s blocks in the baseline vs. all the 0.2s blocks in the time window of interest (post-onset). The result of this t-test is the epileptogenicity map.Propagation threshold: 0.05
Related to the computation of the delay map, so not applicable here. The epileptogenicity maps computed for each 3s window are thresholded using this p-value threshold, then grouped into one single delay map.Output type: Volume
The results are saved in a new folder "Epileptogenicity_volume" containing three files:
- The channel file is a copy of the channel file in folder SZ1_bipolar_2.
- The "source" file contains the epileptogenicity maps and can be displayed in the volume.
- The "recordings" file contains the epileptogenicity index associated to each bipolar contact.
- These files are time resolved when the "Latency" option is a vector of being a single time point. This will be illustrated in the next section.In this example, if you double-click on the sensor data, you get to see only flat lines because there is only one time point.
Display the two files in various ways and explore the results. From the Stat tab, edit the statistical threshold and the type of correction for multiple comparisons.
Note for the SPM experts: If you are interested in exploring all the files generated by SPM, you can access them immediately after the execution in the temporary folder $HOME/.brainstorm/tmp/ImaGIN_epileptogenicity.
Surface: Seizure 2/3
In Process2, select the following files:
FilesA = SZ2_bipolar_2/Baseline and SZ3_bipolar_2/Baseline
FilesB = SZ2_bipolar_2/Onset and SZ3_bipolar_2/OnsetRun process: Epilepsy > Epilepogenicity maps
Latency: 0:2:20 s
Computes the epileptogenicity maps for sliding windows of 3s between 0s and 20s post-seizure (ie. 0-3s, 2-5s, 4-7s, 20-23s…), then summarizes these results in delay maps with a 2s resolution.Output type: Surface
We obtain 9 files in a new folder Epileptogenicity_surface: 3x epileptogenicity index (sensor level), 3x epileptogenicity maps (volume), 3x delay maps. For each type of file, we have one result for each individual seizure (_SZ2_*, _SZ3_*) and one for the group results, ie. the two seizures processed simultaneously (_Group_*).
This time, if you double-click on the sensor data, you will observe time series corresponding to the evolution over time of the epileptogenicity index for each bipolar contact. This seems to show a propagation from electrode g' to electrode et'.
The epileptogenity maps are now time-resolved as well. Move the time cursor in the time series figure and it updates the map at the selected latency. You can create the figures below with the popup menu Snapshot > Time contact sheet.
The delay maps show a summary of the epileptogenicity maps at different time points after the seizure onset. In this example, we computed 11 epileptogenicity maps for SZ2 and SZ3, for sliding windows of 3s (t1=0-3s, t2=2-5s, t3=4-7s, …, t11=20-23s). These maps of t-statistics were thresholded under a given significance level (p<0.05). If a voxel is significantly activated in the epiptogenicity map at t=ti, the value for this voxel in the propagation map is ti, for i=1..11. At the end, the value of each voxel represents the latency for which the activity in this voxel becomes significantly higher than during the baseline. The color bar in the figures below represent the time, from 0 to 20 seconds.
Guidelines panel
In addition to this process "Epileptogenicity maps", we developped a simpler interface to reproduce the same analysis with fewer interface manipulations. We will now reproduce the same results with this simplified interface.
In the Brainstorm window, select the menu Help > Guidelines > Epileptogenicity maps. It shows a new panel at the bottom of the window, that will guide you through 6 steps. You can work with a mix of controls from this panel and the regular database explorer.
Click on [>>] to move to the next step, and [Reset] to restart the analysis from this step for the selected subject. The first step (1/6) is an introduction, nothing happens here.
Step 2: Import anatomy
Edit the mandatory inputs:
Subject name: Type "Subject02", it will create a new subject in the same protocol. We will import the same anatomy and recordings as in Subject01, it will allow us to compare the files obtained with the two methods. Later, when getting back to this step, simply select an existing subject to resume the analysis where you left it.
Pre-implantation MRI: Select tutorial_epimap/anat/MRI/3DT1pre_deface.nii
Post-implantation MRI/CT: Select tutorial_epimap/anat/MRI/3DT1post_deface.nii
MRI volumes are already registered: Select this option for this example.
When this option is not selected, Brainstorm calls SPM to coregister the pre- and post-implantation volumes. If the volumes have already been coregistered and the .nii files look correctly aligned when loaded in any other program, leave this option unchecked to use the existing registration and save some time when importing the files.
Ignore the advanced options, keep the default options:
Cortex resolution: This defines which cortex surface will be used to compute the interpolation between the SEEG contacts and the MRI volume. The first three options (5124V, 8196V, 20484V) correspond to the options available for the computation of the SPM canonical mesh of the cortex, the number indicates the number of vertices of the surface. The last one (7861V+hip+amyg) is a modified version of SPM8 canonical mesh with extra vertices to represent the hippocampus and the amygdala of both hemispheres, which was used in the reference publication for the epileptogenicity maps.
Onset event name: Name of the event representing the seizure onset in the recordings.
Baseline event name: Name of the event representing the baseline in the recordings.
Click on [>>] to validate this step, import the anatomy, and move on to the next one.
The MRI viewer opens automatically, showing the post-implantation volume as a colored layer on top of the previous volume. Adjust the transparency and amplitude threshold of this layer in the section Data options in the Surface tab, adjust its colormap with the popup menu of the figure. Use this display to validate that the coregistration of the two volume is correct, all the parts of the head must align well.
Step 3: Prepare recordings
This panel guides you to include the seizure recordings in the database, set the 3D positions of the SEEG contacts, exclude bad channels and mark onset and baseline events. The documentation below explains the role of each button in the toolbar.
Add files: Click on the first button ("Add ictal recordings for this subject")
Select the file format: "SEEG: Deltamed/Micromed/..."
Select all the SEEG recordings: tutorial_epimap/seeg/SZ*.TRC
After adding the files to the database, the channel editor is opened automatically. This corresponds to clicking on button [Channels], see below.
Channels: Opens the channel editor to edit the properties of all the channels of data that were recorded in the .TRC files. The column "#" in the Guidelines tab indicates the number of SEEG channels detected in each file. Make sure the names and types are correct for all the channels.
To edit one channel, double-click on the text to modify. To edit multiple channels, select them all and right-click > Set channel group/type.
The column Group corresponds to the name of the depth electrode. It is detected based on the channel type and name. If you include as SEEG a channel that detected as something else or rename a channel, you would need to manually update the channel name.
- If you modify the list of channels associated to the type "SEEG", when you close the channel editor and save the modifications, the number of SEEG contacts in the Guidelines tab should be updated automatically.
Note that the Guidelines tab gets updated automatically only for operations that were initiated from the Guidelines tab. If you open the channel editor from the database explorer and modify the list of SEEG channels, the number in the column "#" would not be updated automatically. The same goes for the bad channels and event markers. To force the values in the Guidelines tab to be reloaded, click [<<] and [>>] again.
- If all the files have the same list of channels (same names and same order), the modifications done for one file are reported to all the other channel files. Otherwise, it saves only the modifications for the file that was selected before clicking on [Channels]. If the channel list is different across files, you have to edit the channel file separatly for each file (select the file in the list, then click on [Channels]).
3D: Sets the positions of the SEEG contacts. In this example, we will load contact positions we obtained from another program, but you could also mark the positions using Brainstorm.
Click on [3D], then [Import]
Select the file format: "EEG: ASCII: Name, XYZ (*.*)"
Select the file: tutorial_epimap/anat/implantation/elec_pos_patient.txt
Selection default options: [0.1] and [Yes]. More details.
After importing the positions, a 3D figure shows the post-implantation volume with the imported contacts positions, and possibly the depth electrodes if the detection worked. Move thevolume slices to make sure the contact artifacts match the positions of the electrodes.
The circles in the column "3D" of the Guidelines tab turn green when the 3D positions of all the SEEG contacts is set. If it stays red after importing the positions, you have either some channels mislabelled as SEEG, or a list of a positions that does not include all the SEEG contacts. Another common issue is the use of a different labelling convention in the SEEG recordings and the file with the positions. You may have to rename the contacts either in the channel file (from Brainstorm) or in the positions file (with a text editor, before importing) in order to have them matched correctly.
- Same comment as for the button [Channels]: If all the files have the same list of channels (same names and same order), the modifications done for one file are reported to all the other channel files. Otherwise, it saves only the modifications for the file that was selected before clicking on [3D].
Review: Displays the SEEG recordings for the selected file. The goal is now to mark for each file: the bad channels, the seizure onset(s), the baseline(s).
- Select the first file SZ1, click on [Review] (or simply double-click on the first file).
Use a monopolar montage, then mark the bad channels.
If you close the figure, it saves the modifications and updates the panel.
Onset: Adds an event marker "Onset" to identify the seizure onset. The marker is placed at the current time (red cursor in the figure). If the file viewer is not opened yet, this button has the same effect as button "Review".
Follow these recommendations for selecting an appropriate seizure onset.
- When you close the figure, it saves the modifications and updates the panel. But you don't have to close and save at each step. Mark the bad channels, onset and baseline markers for a file before closing.
If you already know the bad channels/onset/baseline for a file, right-click on the file and select the appropriate menu.
Baseline: Adds an event marker "Baseline" to identify a baseline in the file. The baseline must be an extended event, selected with the mouse or with the menu "Set selection manually". If the file viewer is not opened yet, this button has the same effect as button "Review".
Follow these recommendations for selecting an appropriate seizure onset.
If you close the figure, it saves the modifications and updates the panel.
Click on [>>] after reviewing all the files.
Step 4: Import epochs
This step imports two segments of recordings for each seizure file: the seizure (duration edited in this panel) and the baseline (the segment to import is already defined). More details.
Time window: Select 10s before and 40s after the onset.
Electrode montage: Bipolar 2
Click on [>>] to import the epochs and apply the bipolar montage.
Step 5: Time-frequency
This step computes the time-frequency decomposition of the SEEG signals around the seizure onset and normalizes them based on the short baseline (10s) immediately before the seizure onset.
For information about the parameters or the display/interpretation of the results, see this section.
At the end of the computation, two figures appear, showing all the time-frequency maps averaged across all the seizures. The first window shows all the contacts individually (click on one contact to display it in a separate window), and the other one represents the average of all the contacts.
- Use these figures to identify the frequency band of interest for this subject: 120-200Hz
Step 6: Epileptogenicity
Last step of the analysis, reproduces what is illustrated in this section.
Frequency band: Enter what you visually identified previously (120-200Hz), or select the relevant part of the time-frequency map with your mouse and click on [Get].
Latency list: 0s (no propagation expected, looking only at the first 3 seconds)
Time constant: 3s (duration of the time window used to estimate the epileptogenicity map)
Propagation threshold: p-value threshold on the epileptogenicity map for the computation of the propagation maps (not applicable here, there is no propagation map computed)
Output type: Volume
File selection: Select only SZ1
Click on [>>] to start the computation. Expect it to last for a while...
In output you get exactly the same volume as what was illustrated here.
Repeat for SZ2 and SZ3, processed together, on the cortex surface instead of the volume:
Latency list: 0:2:20 s (sliding windows of 3s between 0s and 20s post-seizure)
Output type: Surface
File selection: SZ2 and SZ3
Click on [>>] to start again the computation. There is a lot more to estimate (11 epileptogenicity maps), but the computation on the surface is a lot faster.
Same results for Subject01 and Subject02, but on a different surface. The example in the previous section was using the default SPM12 canonical surface, while here we used the modified SPM8 surface including amygdala and hippocampus. Except for this, the two interfaces are equivalent.
Importing realistic surfaces
Instead of using the default SPM canonical surfaces, you can use realistic cortex envelopes, extracted with FreeSurfer, BrainSuite or BrainVISA. Instead of importing the anatomy as described previously (pre MRI then post MRI), follow these steps. Note that this cannot be done with the simplified interface in the Guidelines tab.
Right-click on the subject folder > Import anatomy folder:
- Select file type: "BrainVISA folder"
- Select folder: tutorial_epimap/anat/MRI/brainvisa/
- Number of vertices: 15000
When the MRI viewer shows up asking for fiducial points, click on "Click here to compute MNI transformation", then click on [Save] when the computation is done.
- This is the anatomy of the subject (MRI pre-implantation) processed with the morphologist pipeline of BrainVISA 4.5. The MRI pre-implantation is now imported, but the post-implantation is still missing.
Right-click on the subject folder > Import MRI:
Import the volume exactly as previously, following these guidelines.
When importing the volumes processed with FreeSurfer, you probably need to register the volume, as FreeSurfer rewrites the volume with a different orientation. Select option [SPM] instead of [Ignore].
In the subject anatomy folder, you can decide to use the pial surface ("cortex") or the grey-white interface ("white") for the computation of the epileptogenicity maps. As these surfaces are fairly different, it may leed to very different results. A SEEG contact close to one surface can be too far from the other to be taken into account in the computation. Make this choice carefully. To change the default surface, right-click > Set as default cortex, or simply double-click on it. Just avoid selecting the high-resolution surfaces (126000 vertices) or the computation will take forever.
Then you can repeat all the steps previously presented. The results may look different depending on the surface you selected (left=cortex, right=white).
On the hard drive
IntraElectrodes structure
Volume coregistration
Editing the contacts positions
Creating a new implantation file
Same as previous section, but not starting from an existing of contacts.
TODO
- Fix all the links in this page
- Add lots of links from the Guidelines section to the other tutorials
- Proofread and check spelling
- Send for review: John, Sylvain, Martin, Richard, Francois D, Jean G, Jean-Marc, Christophe, Laurent S, Christoph, Marcel, Beth, Jeremy, Olivier, Leila, Jean-Michel, Katia, Manuel, Chauvels, Christian, Ghislaine, Stan, Vladimir, forum users posting about SEEG
Scripting
The following script from the Brainstorm distribution reproduces the analysis presented in this tutorial page: brainstorm3/toolbox/script/tutorial_epileptogenicity.m