= Tutorial 12: Signal Space Projections (SSP) = ''Authors: Francois Tadel, Elizabeth Bock, John C Mosher, Sylvain Baillet'' As previously said, the frequency filters are not adapted to remove artifacts that are transient or overlapping in frequency domain with the brain signals of interest. Other approaches exist to correct for those artifacts, based on the spatial signature of the artifacts. If an event is very reproducible and occurs always at the same position (eg. eye blinks and heartbeats), the sensors will always record the same values when it occurs. We can identify the topographies corresponding to this artifact (ie spatial distributions of values at one time point) and remove them from the recordings. This spatial decomposition is the basic idea behind two widely used approaches: the '''SSP '''(Signal-Space Projection) and '''ICA '''(Independent Component Analysis) methods. This introduction tutorial will focus on the SSP approach, as it is a lot simpler and faster but still very efficient for removing blinks and heartbeats from MEG and high-density EEG recordings. You will be able to read later about the ICA decompositions in the advanced tutorials. <> == Overview == The general SSP objective is to identify the sensor topragraphies that are typical of a specific artifact, then to create spatial projectors to remove the contributions of these topographies from the recordings. 1. We start by identifying many examples of the artifact we are trying to remove. This is what we've been doing in the previous tutorial with the creation of the "cardiac" and "blink" events. 1. We extract a short time window around each of these event markers and concatenate in time all those small blocks of recordings. 1. We run a principle components analysis (PCA) on the concatenated artifacts in order to get a decomposition in various spatial components. 1. We should find in the first few principal components some topographies that are very specific of the type of artifact we are targetting. We select those components to remove. 1. We compute a linear projector for each spatial component to remove and save them in the database (in the "Link to raw file"). They are not applied immediately to the recordings. 1. Whenever some data is recordings are read from this file, the SSP projectors will be applied on the fly to them, to remove the artifact contributions. This approach is fast and memory efficient.<
><
> {{attachment:ssp_intro.gif}} == The order matters == This procedure has to be repeated separately for each artifact type. The order in which you process the artifacts matters, because for removing the second artifact we typically use the recordings cleaned with the first set of SSP projectors. We have to decide which one to process first. It works best if each artifact is defined as precisely as possible, and as independently as possible from the other artifacts. If the two artifacts happen simulateneously, the SSP projectors calculated for the blink may contain some of the heartbeat topography and vice versa. When trying to remove the second artifact, we might not be able to isolate it clearly anymore. Because the heart beats every second or so, there is a high chance that when the subject blinks there is a heartbeat not too far away in the recordings. Therefore a significant number of the blinks will be contaminated with heartbeats. But we have usually a lot of "clean" heartbeats, we can start by removing those ones. To isolate correctly these two common artifacts, we recommend the following procedure: * Remove the markers "cardiac" that are occurring during a blink (done in the previous tutorial), * Compute the '''cardiac SSP''' (with no eye movements, because we removed the co-occurring events), * Compute the '''blink SSP''' (with no heartbeats, because they've already been taken care of). If you have multiple modalities recorded simultaneously, for example MEG and EEG, you should run twice thiswhole procedure twice, once for the EEG only and once for the MEG only. You will always get better results if you '''process the different types of sensors separately'''. Same thing when processing Elekta-Neuromag recordings, you should process separately the magnetometers (MEG MAG) and the gradiometers (MEG GRAD). == SSP: Heartbeats == Double-click on the link to show the MEG sensors for '''Run #01'''.<
>In the Record tab, select the menu: '''"Artifacts > SSP: Heartbeats"'''. * '''Event name''': Name of the event to use to calculate the projectors, enter "'''cardiac'''" * '''Sensor types''': Type of sensors for which the projection should be calculated ("'''MEG'''"). Note that you will always get better results if you process the different types of sensors separately. * '''Compute using existing SSP projectors''': You have the option to calculate the projectors from the raw recordings, or from the recordings filtered with the previously computed SSP projectors. Unless you have a good reason for not considering the existing SSP projectors, you should always select this option. <
><
> {{attachment:ssp_ecg_process.gif}} After the computation is done, a new figure is displayed, that lets you select the active projectors. * '''One the left''': The projector categories where each row represents the result of an execution of a SSP process (usually one for each sensor type and each artifact). * '''On the right''': The spatial components returned by the PCA decomposition. The percentage indicated between brackets is the singular value for this each component, normalized for this decomposition (percentage = '''S'''i / sum('''S'''i), see details at the end of this page). * '''Percentage''': More practically, it indicates the amount of signal that was captured by this projector during the decomposition. The highest it is, the more the projector is representative of the artifact recordings that were used to calculate it. In the good cases, you would typically see one to three components with values that are significantly higher that the others. * '''Default selection''': The software selects '''the components with values superior to 12%''' and leaves the others unselected. '''This threshold is completely empirical''' '''and depends on the acquisition device''', you should always review manually the components that you want to remove. * When a component is selected, it means that it is removed from the recordings. A spatial projector is computed and applied to the recordings on the fly when reading from the continuous file. => REPRENDRE A PARTIR D'ICI <= {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEcgSelect.gif|sspEcgSelect.gif|height="206",width="386",class="attachment"}} For the cardiac event, none of the components show a value superior to 12%, therefore the entire "cardiac" projector category was unselected. This doesn't mean that none of those components is actually interesting for us, let's investigate this. A list of buttons is available to manipulate the projector categories: load, save, rename, delete, and '''display component topography'''. The last one is one of the most useful tool to understand those results. Select the category ("cardiac") to enable the list on the right, click on the first component, then click on the toolbar button to display its topography. Do it again for components #2 and #3 (the components don't need to be active for that). The other button [No interp] displays the same results without the magnetic field smoothing that is applied by default to MEG topographies. It may help understand some difficult cases. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEcgCheck.gif|sspEcgCheck.gif|height="207",width="390",class="attachment"}} {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEcgComp.gif|sspEcgComp.gif|class="attachment"}} None of those topographies can be clearly related to a cardiac component. This can have two interpretations: the cardiac artifact is not very strong for this subject and the influence of the heart activity over the MEG sensors is completely buried in the noise or the brain signals, or the characterization of the artifact that we did was not so good and we should refine it by selecting for instance smaller time windows around the cardiac peaks. Here, it's probably due to the subject's morphology. Some people generate strong artifacts in the MEG, some don't. In this case, it is safer to '''unselect '''this "cardiac" category, rather than removing randomly spatial components that we are not sure to identify. == SSP: Eye blinks == Let's try the same thing with the eye blinks. Select the process "'''SSP > Compute SSP: Eye blinks'''". Run it on the event type "blink", that indicate the peaks of the EOG signal. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEogFile.gif|sspEogFile.gif|class="attachment"}} {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEog.gif|sspEog.gif|height="214",width="307",class="attachment"}} In this specific case, there is one value that is much higher than the others (21%), and it is selected by default because it is superior to 12%. The first component is most likely a good representation of the artifact we are trying to remove. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEogSelect.gif|sspEogSelect.gif|height="214",width="384",class="attachment"}} Select the cardiac category, and display the topographies for the first three components. Component #1 is clearly related with the ocular activity occurring during the blinks, the others are not as clear. Conclusion: the default proposition was good (only component #1 selected). Setting this first projector as active removes from the MEG signals the contributions related with the spatial topography we can see in the first figure, ie. a spatial distribution of sensor values related specifically to the eye blinks. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEogComp.gif|sspEogComp.gif|class="attachment"}} While the recordings are displayed in the file viewer, the selection of the active projectors interactively updates the recordings. Go to the first detected "blink" event ('''t=33.600s'''), and select the left frontal sensors ('''Shift+B''' or right-click > Display setup > CTF LF). Then play with the checkboxes to change the active projectors, and see how well this first component of the blink category removes the ocular artifact. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspEogMeg.gif|sspEogMeg.gif|class="attachment"}} Select the projector category "blink", select the first component, and click on Save, to validate your changes. Starting from now, all the successive operations you apply on this file will integrate this eye blink correction, including the calculation of other projectors. After you closed this window, you can get back to it by selecting the menu "'''SSP > Select active projector'''" in the Record tab, and change again the selection of active projectors. We are not going to calculate the SSP for the other category of events identified on the EOG, the group "'''blink2'''". The events classified in this group could represent eye saccades or other types of blinks, it is not very clear that they correspond to the same physiological event. Most of them do not seem to create any obvious contamination on the MEG recordings, there is probably no need to consider them now. == Run #02: Running from a script == Let's perform the same detection operations on '''Run #02''', using this time the '''Process1''' box. * Close everything with the [X] button at the top-right corner of the Brainstorm window. * Select the run '''AEF #02''' in the Process1 box, then select the following processes: * '''Events > Detect heartbeats:''' Select channel '''ECG''', check "All file", event name "cardiac". * '''Events > Detect eye blinks:''' Select channel '''VEOG''', check "All file", event name "blink". * '''Events > Remove simultaneous''': Remove "'''cardiac'''", too close to "'''blink'''", delay '''250ms'''. Always check visually the results of the SSP cleaning executed from a script. * Open the MEG sensors for Run #02. * In the Record tab, menu Artifacts > '''Select active projectors'''. <> == SSP: Generic == The calculation of the SSP for the heartbeats and the eye blinks are shortcuts to a more generic algorithm "'''Compute SSP: Generic'''". We do not need it here, but the illustration of its properties is interesting to understand the correction of ocular and cardiac artifacts: * '''Event name''': Markers that are used to characterize the artifact * '''Time window''': Time segment to consider before and after each event marker. We want this time window to be longer than the artifact effect itself, in order to have a large number of time samples representative of a normal brain activity. This helps the SVD decomposition to separate the artifact from the ongoing brain activity. * '''Frequency band''': Definition of the band-pass filter that is applied to the recordings before calculating the projector. Usually you would use the same frequency band as we used for the detection, but you may want to try to refine this parameter if the results are not satisfying. * '''Sensor types or names''': List of sensors for which to calculate the projector. You can get better results if you process one sensor type at a time. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=sspGeneric.gif|sspGeneric.gif|height="328",width="330",class="attachment"}} <> == Evaluation == === Eye blinks === One efficient way of representing the impact of this artifact correction is to epoch the recordings around the artifacts before and after the correction. Use the same time window as the one used in the SSP options around each marker, and average all the segments of recordings. Those operations are detailed in the next tutorial, we are just presenting the results. You don't need to reproduce them at this time, just remember that it is doable, in case you need it with your own data. This is what the database would look like after those operations: {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=blinkDb.gif|blinkDb.gif|height="263",width="283",class="attachment"}} The following image represents the file '''"blink_uncorrected / Avg: blink"''', which is the average of the 18 identified blinks '''before''' the SSP correction, [-200,+200]ms around the "blink" events. The time series, the 2D topography at the peak (t = 0ms), and the mapping on the cortex of those fields, using the basic inverse model calculated in the previous tutorial. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=blinkBefore.gif|blinkBefore.gif|height="177",width="533",class="attachment"}} The next image represents the file '''"blink_ssp / Avg: blink"''', which is the exact same thing, but '''after '''the SSP correction. The artifact is gone. If you do this and you can still see some clear evoked component in the time series figure, the SSP correction was not efficient: the artifact is not properly identified, or you should select different components using the "Select active projectors" window. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=blinkAfter.gif|blinkAfter.gif|height="177",width="533",class="attachment"}} === Heartbeats === We can do the same thing with the heartbeats: epoch [-40,+40]ms around the "cardiac" events, average the trials, and review the event-related fields at three instants: The peak of the '''P wave''' (t = '''-30ms'''): {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=cardiacP.gif|cardiacP.gif|height="178",width="534",class="attachment"}} The peak of the '''QRS complex''' (t = '''0ms'''): {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=cardiacQRS.gif|cardiacQRS.gif|height="178",width="534",class="attachment"}} The peak of the '''T wave''' (t = '''25ms'''): {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutRawSsp?action=AttachFile&do=get&target=cardiacT.gif|cardiacT.gif|height="178",width="534",class="attachment"}} Those peaks may look big, but they are in fact much smaller (300 fT for the average of 346 repetitions) than what we observed for the eye blinks (1500 fT for 18 repetitions). You can notice that none of those topographies are similar to the components we obtained after calculating the SSP for the cardiac artifact. We don't know how to correct this artifact, it doesn't look too bad in terms of recordings contamination, so we just leave it uncorrected. <> == Troubleshooting == You have calculated the SSP as indicated here but you don't get any good results. No matter what you do, the topographies don't look like the targeted artifact. You can try the following: * Review one by one the events indicating the artifacts, remove the ones that are less clear or that occur close to another artifact. * Select or unselect the option "Compute using existing SSP". * Use the process "Compute SSP: Generic" and modify some parameters: * Reduce the time window around the peak of the artifact. * Use a narrower frequency band: especially the EOG, if the projectors capture some of the alpha oscillations, you can limit the frequency band to [1.5 - 9] Hz. * Change the method: Average / SSP. * If you have multiple acquisition runs, you may try to use all the artifacts from all the runs rather than processing the files one by one. For that, use the Process2 tab instead of Process1. Put the "Link to raw file" of all the runs on both side, Files A (what is used to compute the SSP) and Files B (where the SSP are applied). Always look at what this procedure gives you in output. Most of the time, the artifact cleaning will be an iterative process where to need several time to adjust the options and the order of the different steps in order to get good results. <> == Theory == The Signal-Space Projection (SSP) is one approach to rejection of external disturbances. Here is a short description of the method by '''Matti Hämäläinen''', from the [[http://www.martinos.org/meg/manuals/MNE-manual-2.7.pdf|MNE 2.7 reference manual]], section 4.16. Unlike many other noise-cancellation approaches, SSP does not require additional reference sensors to record the disturbance fields. Instead, SSP relies on the fact that the magnetic field distributions generated by the sources in the brain have spatial distributions sufficiently different from those generated by external noise sources. Furthermore, it is implicitly assumed that the linear space spanned by the significant external noise patterns has a low dimension. Without loss of generality we can always decompose any ''n''-channel measurement '''b'''(''t'') into its signal and noise components as: . '''b'''(''t'') = '''b'''<)>>''s''<)>>(''t'') ''+'' '''b'''<)>>''n''<)>>(''t'') Further, if we know that '''b'''<)>>''n''<)>>(''t'') is well characterized by a few field patterns '''b'''<)>>''1''<)>>...'''b'''<)>>''m''<)>>, we can express the disturbance as . '''b'''<)>>''n''<)>>(''t'') = '''Uc'''<)>>''n''<)>>(''t'') ''+'' '''e'''(''t'') , where the columns of '''U''' constitute an orthonormal basis for '''b'''<)>>''1''<)>>...'''b'''<)>>''m''<)>>, '''c'''<)>>''n''<)>>(''t'') is an ''m''-component column vector, and the error term '''e'''(''t'') is small and does not exhibit any consistent spatial distributions over time,'' i.e.'', '''C'''<)>>''e''<)>> = ''E''{'''ee'''<)>>''T''<)>>} = '''I'''. Subsequently, we will call the column space of '''U''' the noise subspace. The basic idea of SSP is that we can actually find a small basis set '''b'''<)>>''1''<)>>...'''b'''<)>>''m''<)>> such that the conditions described above are satisfied. We can now construct the orthogonal complement operator . '''P'''<)>>⊥<)>> = '''I''' - '''UU'''<)>>T<)>> and apply it to '''b'''(''t'') yielding . '''b'''(''t'') ≈ '''P'''<)>>⊥<)>>'''b'''<)>>''s''<)>>(''t'') , since '''P'''<)>>⊥<)>>'''b'''<)>>''n''<)>>(''t'') = '''P'''<)>>⊥<)>>'''Uc'''<)>>''n''<)>>(''t'') ≈ 0. The projection operator '''P'''<)>>⊥<)>> is called the signal-space projection operator and generally provides considerable rejection of noise, suppressing external disturbances by a factor of 10 or more. The effectiveness of SSP depends on two factors: 1. The basis set '''b'''<)>>''1''<)>>...'''b'''<)>>''m''<)>> should be able to characterize the disturbance field patterns completely and 1. The angles between the noise subspace space spanned by '''b'''<)>>''1''<)>>...'''b'''<)>>''m''<)>> and the signal vectors '''b'''<)>>''s''<)>>(''t'') should be as close to π/2 as possible. If the first requirement is not satisfied, some noise will leak through because '''P'''<)>>⊥<)>>'''b'''<)>>''n''<)>>(''t'') ≠ 0. If the any of the brain signal vectors '''b'''<)>>''s''<)>>(''t'') is close to the noise subspace not only the noise but also the signal will be attenuated by the application of '''P'''<)>>⊥<)>> and, consequently, there might by little gain in signal-to-noise ratio. Since the signal-space projection modifies the signal vectors originating in the brain, it is necessary to apply the projection to the forward solution in the course of inverse computations. <> == Algorithm == We have now 346 examples of heartbeats, 18 examples of blinks, and 12 examples of saccades. Those are sufficient numbers of repetitions to calculate reliable signal-space projections. The logic of the computation is the following: 1. Take a small time window around each marker to capture the full effect of the artifact, plus some clean brain signals before and after. The default time window is [-200,+200]ms for eye blinks, and [-40,+40]ms for the heartbeats. 1. Filter the MEG or EEG signals in a frequency band of interest, in which the artifact is the most visible. 1. Concatenate all those time blocks into a big matrix '''A''' = ['''b'''<)>>''1''<)>>, ..., '''b'''<)>>''m''<)>>] 1. Compute the singular value decomposition of this matrix '''A''': ['''U''','''S''','''V'''] = '''svd'''('''A''', 'econ') 1. The singular vectors '''U'''i with the highest singular values '''S'''i are an orthonormal basis of the artifact subspace that we want to subtract from the recordings. The software selects by default the vectors with eigenvalues above a certain threshold: '''S'''i > 12% * sum('''S'''i)<
>Then it is possible to redefine interactively the selected components. 1. Calculate the projection operator:''' P'''<)>>⊥i<)>> = '''I''' - '''U'''i'''U'''i<)>>T<)>> 1. Apply this projection on the MEG or EEG recordings '''F''': '''F''' = '''P'''<)>>⊥i<)>>'''F''' 1. The process has to be repeated '''separately '''several times: * for each sensor type (EEG, MEG magnetometers, MEG gradiometers) and * for each artifact, starting with the one that leads to the strongest contamination in amplitude on the sensors (in the case: the eye blinks) * If you have difficulties removing one artifact or the other, you may try to process them in a different order. You may also try removing some of the artifact markers in the case of co-occurring artifacts. If a lot of the blinks happen at the same time as heartbeats, you may end up calculating projectors that mix both effects, but that do not remove efficiently one or the other. In this case, remove all the markers that happen in the segments contaminated by multiple artifacts. Steps #1 to #5 are done automatically by the processes "SSP > Compute SSP" in the Record tab: the results, the vectors '''U'''i, are saved in the database link ("Link to raw file") and in the channel file. Steps #6 and #7 are calculated on the fly when reading a block of recordings from the continuous file: when using the raw viewer, running a process a process on the continuous file, or importing epochs in the database. Step #8 is the manual control of the process. Take some time to understand what you are trying to remove and how to do it. Never trust blindly any fully automated artifact cleaning algorithm, always check manually what is removed from the recordings, and do not give up if the first results are not satisfying. <> == References == For more information on the SSP method, please consult the following publications: * C. D. Tesche, M. A. Uusitalo, R. J. Ilmoniemi, M. Huotilainen, M. Kajola, and O. Salonen, "Signal-space projections of MEG data characterize both distributed and well-localized neuronal sources," Electroencephalogr Clin Neurophysiol, vol. 95, pp. 189-200, 1995. * M. A. Uusitalo and R. J. Ilmoniemi, "Signal-space projection method for separating MEG or EEG into components," Med Biol Eng Comput, vol. 35, pp. 135-40, 1997. <> == Additional documentation == * Forum: [[http://neuroimage.usc.edu/forums/showthread.php?1272|Refining the pre-processing pipeline]] * McGill guidelines * SSP cookbook * Alpha and cardiac overlapping? <> <>