= Tutorial 22: Source estimation [TODO] = ''Authors: Francois Tadel, Elizabeth Bock, Rey R Ramirez, John C Mosher, Richard Leahy, Sylvain Baillet'' You have in your database a forward model that explains how the cortical sources determine the values on the sensors. This is useful for simulations, but what we need is to build the inverse information: how to estimate the sources when we have the recordings. This tutorials introduces the tools available in Brainstorm for solving this inverse problem. __'''WARNING'''__: The new interface presented here do not include all the options yet. The sLORETA normalization or the mixed head models are not supported: to use them, use the old interface (menu "Compute sources" instead of "Compute sources 2016", described in the [[Tutorials/TutSourceEstimation|old tutorials]]). <> == Ill-posed problem == Our goal is to estimate the activity of the thousands of dipoles described by our forward model. However we only have a few hundred variables in input (the number of sensors). This inverse problem is ill-posed, meaning there is an '''infinite number of combinations''' of source activity patterns that can generate exactly the same sensor topography. Inverting the forward model directly is impossible, unless we add some strong priors to our model. Wikipedia says: "Inverse problems are some of the most important and well-studied mathematical problems in science and mathematics because they tell us about parameters that we cannot directly observe. They have wide application in optics, radar, acoustics, communication theory, signal processing, medical imaging, computer vision, geophysics, oceanography, astronomy, remote sensing, natural language processing, machine learning, nondestructive testing, and many other fields." . {{http://neuroimage.usc.edu/brainstorm/Tutorials/HeadModel?action=AttachFile&do=get&target=forward_inverse.gif|forward_inverse.gif|class="attachment"}} Many solutions have been proposed in the literature, based on different assumptions on the way the brain works and depending on the amount of information we already have on the effects we are studying. Among the hundreds of methods available, two classes of inverse models have been widely used in MEG/EEG source imaging in the past years: '''minimum-norm solutions''' and '''beamformers'''. Both approaches have the advantage of being '''linear''': the activity of the sources is a linear recombination of the MEG/EEG recordings. It is possible to solve the inverse problem independently of the recordings, making the data manipulation a lot easier and faster. Both are available in Brainstorm, so you can use the one that is most adapted to your recordings or to your own personal expertise. Only the minimum norm estimates will be described in this tutorial, but the other solutions work exactly the same way. == Source estimation options [TODO] == Before we start estimating the sources for the recordings available in our database, let's start with an overview of the options available. The screen capture below represents the basic options for the minimum norm estimates. The options for the other methods will be described in advanced tutorials. {{attachment:minnorm_options.gif}} === Method [TODO] === * '''Minimum norm''': __Priors, justification, application case?__<
> Require an estimation of the noise at the level of the sensors (noise covariance matrix). * '''LCMV beamformer''': __?__<
>Require both a noise covariance matrix and a data covariance matrix (representation of the effect we are trying to localize in the brain, covariance of the latencies of interest). * '''Dipole modeling''': __?__<
>Warning: This is not a imaging method! * __'''Recommended option'''__: Provided that we know at which latencies to look at, we can compute a correct data covariance matrix and may obtain a better spatial accuracy with a beamformer. However, in many cases we don't exactly know what we are looking at, therefore the risks of misinterpretation of badly designed beamforming results are high. Brainstorm tends to favor minimum norm solutions, which have the advantage of needing less manual tuning for getting acceptable results. === Measure [TODO] === The minimum norm estimates produce a measure of the current density flowing at the surface of the cortex. To visualize these results and compare them between subjects, we can normalize the MNE values to get a standardized level of activation with respect to the noise or baseline level (dSPM, sLORETA, etc). * '''Current density map''': Whitened and depth-weigthed linear L2-minimum norm estimates algorithm inspired from Matti Hamalainen's MNE software. For a full description of this method, please refer to the [[http://www.nmr.mgh.harvard.edu/meg/manuals/MNE-manual-2.7.pdf|MNE manual]], section 6, "The current estimates". <
>Units: picoamper per meter (pA.m). * '''dSPM''': Noise-normalized estimate (dynamical Statistical Parametric Mapping [Dale, 2000]). Its computation is based on the MNE solution. <
>Units: Unitless ratio [ '''???''' ] * '''sLORETA''': Noise-normalized estimate using the sLORETA approach (standardized LOw Resolution brain Electromagnetic TomogrAphy [Pasqual-Marqui, 2002]). sLORETA solutions have, in general, a smaller location bias than either the expected current (MNE) or the dSPM. The noise covariance is not used at all for the standardization process, it is purely based on the smoothness of the maps. <
>Units: Square root of units of current (MNE/sqrt(MNE) => (pA.m)^1/2^). * __'''Recommended option'''__: Discussed in the section "Source map normalization" below. === Source orientation === * '''Constrained: Normal to cortex''': Only one dipole at each vertex of the cortex surface, oriented normally to the surface. This is based on the anatomical observation that in the cortex, the neurons are mainly organized in macro-columns that are perpendicular to the cortex surface.<
>Size of the inverse operator: [Nvertices x Nchannels]. * '''Unconstrained''': At each vertex of the cortex surface, we define a base of three dipoles with orthogonal directions, then we estimate the sources for the three orientations independently. <
>Size of the inverse operator: [3*Nvertices x Nchannels]. * '''Loose''': A version of the "unconstrained" option with a weak orientation constraint that emphasizes the importance of the sources with orientations that are close to the normal to the cortex. The value associated with this option set how "loose" should be the orientation constrain (recommended values in MNE are between 0.1 and 0.6, --loose option). <
>Size of the inverse operator: [3*Nvertices x Nchannel]. * __'''Recommended option'''__: The constrained options use one dipole per grid point instead of three, therefore the source files are smaller, faster to compute and display, and more intuitive to process because we don't have to think about recombining the three values into one. On the other hand, in the cases where its physiological assumptions are not verified, typically when using a MNI template instead of the anatomy of the subject, the normal orientation constraint may fail representing certain activity patterns. Unconstrained models can help in those cases. == Computing sources for an average == * In Run#01, right-click on the average response for the '''deviant''' stim > '''Compute sources [2016]'''.<
>Select the options: '''Minimum norm''' imaging, '''Current density''' map, '''Constrained''': Normal to cortex. <
><
> {{attachment:minnorm_single.gif||height="433",width="529"}} * The other menu "Compute sources" brings the interface that was used previously in Brainstorm. We are going to keep maintaining the two implementations in parallel for a while for compatibility and cross-validation purposes. * The result of the computation is displayed as a dependent file of the deviant average because it is related only to this file. In the file comment, "MN" stands for minimum norm and "Constr" stands for "Constrained: normal orientation". <
><
> {{attachment:minnorm_single_tree.gif}} == Display: Cortex surface == * Right-click on the sources for the deviant average > Cortical activations > '''Display on cortex'''.<
><
> {{attachment:minnorm_single_popup.gif||height="167",width="380"}} * Double-click on the '''recordings '''for the deviant average to have a time reference. <
>In the filter tab, add a '''low-pass filter at 40Hz'''.<
><
> {{attachment:display_cortex.gif||height="163",width="482"}} * Change the current time (click on the time series figure or use the keyboard arrows) and note it updates the source maps in the 3D figure. You can also use all the menus and shortcuts introduced in the anatomy tutorial (like setting the view with the keys from 0 to 6). * You can edit the display properties in the Surface tab: * '''Amplitude''': Only the sources that have a value superior to a given percentage of the colorbar maximum are displayed. * '''Min size''': Hide all the small activated regions, ie. the connected color patches that contain a number of vertices smaller than this "min size" value. * '''Transparency''': Change the transparency of the source activity on the cortex surface. * Take a few minutes to understand what the '''amplitude threshold''' represents. * The colorbar maximum depends on the way you configured your ''Sources ''colormap. If the option "Maximum: Global" is selected, the maximum should be around 130 pA.m. This value is a rough estimate of the maximum amplitude, and this default value is not always adapted to your figure. To edit the maximum value, use the colormap option "Maximum: Custom". * On the screen capture below, the threshold value is set to 20%. It means that only the sources that have a value over 0.20*130 = 26 pA.m are visible. <
>The threshold level is indicated in the colorbar with a horizontal white line. * At the first response peak (91ms), the sources with high amplitudes are located around the primary auditory cortex, bilaterally, which is what we are expecting for an auditory stimulation. <
><
> {{attachment:display_sliders.gif||height="215",width="509"}} == Why does it look so noisy? == The source maps look very noisy and '''discontinuous''', they show a lot of disconnected patches. This is due to the '''orientation constraint''' we imposed on the dipoles orientations. Each value on the cortex has to be interpreted as a vector, oriented perpendicular to the surface. Because of the brain circumvolutions, all the sources have different orientations, two adjacent sources have very little chance to have the same orientation in this model, therefore the minimum norm method may attribute completely different values to them. This causes all these gaps we see here. Visually, you should not always interpret disconnected colored patches as independent sources. You cannot expect a very spatial resolution with this technique (~5-10mm). Most of the time, a cluster of disconnected source patches in the same neighborhood that show the same evolution in time can be interpreted as "there is some significant activity around here, but we don't know where exactly". To get more continuous maps for visualization or publication purposes, you can either smooth the values explicitly on the surface (process "'''Sources > Spatial smoothing'''") or use '''unconstrained source models'''. For data exploration, this is a good enough representation of the brain activity, mostly because it is fast and efficient. You can get a better feeling of the underlying brain activity patterns by making '''short interactive movies''': click on the figure, then hold the left or right arrows of your keyboard. Activity patterns will also look sharper when we compute normalized measures (later in this tutorial). In most of the screen captures in this following sections, the contrast of the figures has been enhanced for illustration purposes. Don't worry if it looks a lot less colorful on your screen. == Display: MRI Viewer == * Right-click on the source file > Cortical activations > '''Display on MRI (MRI Viewer)'''. * The MRI viewer was introduced in tutorials [[Tutorials/ImportAnatomy|#2]] and [[Tutorials/ExploreAnatomy|#3]]. <
>Additionally you can change the current time and amplitude threshold from the Brainstorm window. * This figure shows the sources computed on the cortical surface and re-interpolated in the MRI volume. If you set the amplitude threshold to 0%, you would see the thin layer of cortex in which the dipoles where estimated. <
><
> {{attachment:display_mriviewer.gif||height="356",width="330"}} * You can configure this figure with the following options: * '''MIP Anatomy''': Checkbox in the MRI Viewer figure. For each slice, display the maximum value over all the slices instead of the original value in the structural MRI ("glass brain" view). * '''MIP Functional''': Same as for MIP Anatomy, but with the layer of functional values. * '''Smooth level''': The sources values can be smoothed after being re-interpolated in the volume. Right-click on the figure to define the size of the smoothing kernel (in number of slices). * '''Amplitude threshold''': In the Surface tab of the Brainstorm window. * '''Current time''': At the top-right of the Brainstorm window (or use the time series figure). * {{attachment:display_smooth.gif||height="356",width="363"}} == Display: MRI 3D == * Right-click on the source file > Cortical activations > '''Display on MRI (3D)'''. * This view was also introduced in the tutorials about MRI and surface visualization.<
>Right-click and move your mouse to move the slices (or use the Resect panel of the Surface tab). <
><
> {{attachment:display_mri3d.gif||height="203",width="405"}} == Sign of constrained maps == You should pay attention to the sign of the current amplitudes that are given by the minimum norm method: they can be positive or negative and they oscillate around zero. Display the sources on the surface, set the amplitude threshold to 0%, then configure the colormap to show relative values (uncheck the "Absolute values" option), you would see those typical '''stripes of positive and negative values '''around the sulci. Double-click on the colorbar after testing this to reset the colormap. . {{attachment:display_negative.gif||height="173",width="452"}} This pattern is due to the '''orientation constraint''' imposed on the dipoles. On both sides of a sulcus, we have defined dipoles that are very close to each other, but with opposite orientations. If we have a pattern of activity on one side of a suclus that can be assimilated to an electric dipole (green arrow), the minimum norm model will try to explain it with the dipoles that are available in the head model (red and blue arrows). Because of the dipoles orientations, it translates into positive values (red arrows) on one side of the sulcus and negative on the other side (blue arrows). . {{attachment:minnorm_sketch.gif||height="155",width="467"}} When displaying the cortical maps at one time point, we are usually not interested by the sign of the minimum norm values but rather by their amplitude. This is why we always display them by default with the colormap option "'''absolute values'''" selected. However, we cannot simply discard the sign of these values because we need them for other types of analysis, typically time-frequency decompositions and connectivity analysis. For estimating frequency measures on the source maps, we need to keep the oscillations around zero. == Unconstrained orientations == In the cases where the orientation constraint imposed on the dipoles orientations looks too strong, it is possible to relax it partially (option "loose constraints") or completely (option "unconstrained"). This is typically something to consider when using a MNI template instead of the subject's anatomy, or when studying deeper or non-cortical brain regions for which the normal to the FreeSurfer cortex surface is unlikely to match any physiological reality. In terms of data representation, the option "unconstrained" and "loose constraints" are very similar. Instead of using one dipole at each cortical location, a base of three orthogonal dipoles is used. <
>Here we will only illustrate the fully unconstrained case. * In Run#01, right-click on the average response for the '''deviant''' stim > '''Compute sources [2016]'''.<
>Select the options: '''Minimum norm''' imaging, '''Current density''' map, '''Unconstrained'''. * Double-click on the new source file for the deviant average, open the time series simultaneously. The two brain maps below represent the same file at 91ms, with different colormap options (absolute values on the left, relative values on the right). Explanations below. <
><
> {{attachment:minnorm_unconstr_all.gif||height="413",width="652"}} * We have to be careful with the visual comparisons of constrained and unconstrained source maps displayed on the cortex surface, because they are very different types of data. In unconstrained source maps, we have '''three dipoles with orthogonal orientations at each cortex location''', therefore we cannot represent all the information at once. To display them as an activity map, Brainstorm computes the '''norm of the vectorial sum of the three orientations at each vertex'''. <
>S = sqrt(Sx^2^ + Sy^2^ + Sz^2^) <
><
> {{attachment:minnorm_unconstr_sketch.gif||height="158",width="476"}} * This explains that we only observe '''positive values''' (no blue values when the colormap is set to display positive and negative values): the norm displayed at each vertex is always positive. The underlying values along each orientation (x,y,z) can be positive or negative and oscillate around zero in time, but we cannot get access to this information with these static cortical maps. * The maps we observe here look a lot '''smoother''' than the constrained sources we computed earlier. This can be explained by the fact that there is no sharp discontinuity between two adjacent points of the grid, while the normal to the surface between two nearby points can be very different. * '''Delete''' the unconstrained file, we will not explore this option in the introduction tutorials. You can refer to the tutorial [[http://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy|EEG and epilepsy]] for an example of analysis using unconstrained sources. == Source map normalization == The current density values returned by the minimum norm method have a few problems: * They depend a lot on the SNR of the signal, which may vary significantly between subjects.<
>Their amplitude is therefore difficult to interpret directly. * The values tend to be higher at the surface of the brain (close to the sensors). * The maps are sometimes patchy and difficult to read. Normalizing the current density maps with respect to a reference level (estimated from noise recordings, pre-stimulus baseline or resting state recordings) can help with all these issues at the same time. Some normalizations can be computed independently from the recordings, and added to the linear inverse operator (dSPM or sLORETA). Another way of proceeding is to divide the current density maps by the standard deviation estimated over a baseline (Z-score). The normalization options do not change the temporal dynamics of your results, they are just different ways for looking at the same minimum norm maps. If you look at the time series associated with one given source, it would be exactly the same for all the normalizations, except for a scaling factor. Only the relative weights change between the sources, and these weights do not change over time. ==== dSPM, sLORETA ==== * In Run#01, right-click on the average recordings for the '''deviant''' stim > '''Compute sources [2016]'''.<
>Select successively the two normalization options: dSPM, sLORETA, ('''constrained''').<
><
> {{attachment:minnorm_normfiles.gif}} * Double-click on all of them to compare them (screen capture at '''143ms'''): <
><
> {{attachment:minnorm_normalized.gif||height="156",width="628"}} * '''Current density maps''': Tends to highlight the top of the gyri and the superficial sources. * '''dSPM''': Tends to correct this behavior and may give higher values in deeper areas. The values obtained are unitless and similar to Z-scores, therefore they are easier to interpret. * '''sLORETA''': Produces smoother maps where all the potentially activated area of the brain (given to the low spatial resolution of the source localization with MEG/EEG) is shown as connected, regardless of the depth of the sources. However, the units are difficult to interpret. ==== Z-score ==== * The '''Z-transformation''' converts the current density values to a score of deviation from a baseline. We define a baseline period in our file (in this case, the pre-stimulus baseline) and compute the average and standard deviation for this segment. Then for every time point we subtract the baseline average and divide by the baseline standard deviation. '''Z = (Data - <>) / <>''' * This measure tells how much a value deviates from the baseline average, in number of times the standard deviation. This is done independently for each source, so the sources with a low variability during baseline will be more salient in the cortical maps post-stimulus. * In Process1: Select the constrained current density maps (file ''MN: MEG(Constr)''). * Run process "'''Standardize > Baseline normalization'''", '''[-100,-1.7]ms''', '''Z-score transformation''' <
>Do not select "Use absolute values": We want the sign of the current values.<
><
> {{attachment:zscore_process.gif||height="530",width="558"}} * Double-click on the new normalized file to display it on the cortex (file with the "| zscore" tag). <
><
> {{attachment:zscore_cortex.gif||height="153",width="657"}} * You can see that the cortical maps obtained in this way are '''very similar''' to the other normalization approaches, especially with the dSPM maps. The units are different but the global observations are the same. * A value of 3 in this figure means: at this vertex, the value is 3 times higher than the standard deviation from zero during the baseline. If the values during the baseline follow a normal distribution '''N(<>,<2)>>)''', then the values we computed follow a N(0,1)='''Z distribution'''. We can get a level of significance from this well known distribution, for instance a value Z=1.96 corresponds to a p-value of 0.05. These questions will be discussed in more details in the statistics tutorial. * The Z-normalized source maps are '''not impacted by the''' '''visualization filters'''. If you open simultaneously the time series and all the files you have now (MN, dSPM, sLORETA, Z-score) and modify the options in the Filter tab, all the figures are updated except for the Z-score one. We can filter easily all the linear models (MN, dSPM, sLORETA), but we would lose the interesting properties of the Z-values if we were filtering them (the values would not follow a Z-distribution anymore). * If the baseline and the active state are not in the same file, you can use the '''Process2 tab''': place the baseline in the left list (Files A) and the file to normalize in the right list (Files B). ==== Typical recommendations ==== * Use non-normalized '''current density maps''' for: * Computing shared kernels applied to single trials. * Averaging files across MEG runs. * Computing time-frequency decompositions or connectivity measures on the single trials. * Use '''normalized maps''' (dSPM, sLORETA, Z-score) for: * Estimating the sources for an average response. * Exploring visually the average response (ERP/ERF) at the source level. * Normalizing the subject averages before a group analysis. * Recommended normalization approach: * It is difficult to declare that one normalization technique is better than another. They have different advantages and may be used in different cases. Ideally, they should all converge to similar observations. If you obtain results with one method that you cannot reproduce with the others, you should question your findings. * dSPM and sLORETA are linear measures and can expressed as imaging kernels, therefore they are a lot easier to manipulate in Brainstorm. sLORETA maps can be smoother but its units are difficult to understand. dSPM units are much easier to understand and interpret. * Z-normalized current density maps are also easy to interpret. They represent explicitly a "deviation from experimental baseline" while dSPM indicates a "deviation from noise" (as represented by the noise covariance matrix). == Delete your experiments == * Select all the source files you computed until now and '''delete''' them. <
><
> {{attachment:delete_norm.gif||height="172",width="474"}} == Computing sources for single trials == Because the minimum norm model is linear, we can compute an inverse model independently from the recordings and apply it on the recordings when needed. We will now illustrate how to compute a shared inverse model for all the imported epochs. * Right-click on the '''head model''' or the '''folder '''for Run#01 > '''Compute sources [2016]'''.<
>Select: '''Minimum norm''' imaging, '''Current density''' map, '''Constrained''': Normal to cortex<
><
> {{attachment:minnorm_shared_popup.gif||height="273",width="500"}} * Because we did not request to compute and inverse model for a specific block of recordings, it computed a '''shared inverse model'''. If you right-click on this new file, you get a warning message: "Inversion kernel". It does not contain any source map, but only the inverse operator that will allow us to convert the recordings into source maps.<
><
> {{attachment:minnorm_shared_kernel.gif}} * The database explorer now shows one '''source link''' to this inverse model for each block of recordings available in this folder, single trials and averages. These links are not real files saved on the hard drive, but you can use them exactly like the previous source files we calculated for the deviant average. If you load a link, Brainstorm loads the corresponding MEG recordings, loads the inverse kernel and multiplies the two on the fly before displaying it. This optimized approach saves a lot of computation time and lot of space on the hard drive.<
><
> {{attachment:minnorm_links.gif||height="176",width="513"}} == Averaging in source space == ==== Computing the average ==== * First compute the same source model for the the second acquisition run.<
>In Run#02, right-click on the '''head model''' or the '''folder '''> '''Compute sources [2016]'''.<
>Select: '''Minimum norm''' imaging, '''Current density''' map, '''Constrained''': Normal to cortex<
><
> {{attachment:minnorm_run02.gif||height="242",width="245"}} * Now we have the source maps available for all the trials, we can '''average them in source space''' across runs. This allows us to average MEG recordings that were recorded with different head positions (in this case Run#01 and Run#02 have different channel files so they could potentially have different head positions preventing the direct averaging at the sensor level). * Thanks to the linearity of the minimum norm model: MN(Average(trials)) = Average(MN(trials))<
>The two following approaches are equivalent: 1. Averaging the sources of all the individual trials across runs, 1. Averaging the sources for the sensor averages that we already computed for each run. * We will use the second option: using the sources for the sensor-level averages. <
>It is a lot faster because it needs to read 4 files (one average file per run and per condition) instead of 456 files (total number of good trials in the two runs). * Drag and drop to the Process1 tab the average recordings for '''Run01 '''and '''Run02''', then press the ['''Process sources'''] button on the left to select the source files instead of the MEG recordings. * Run process "'''Average > Average files'''": <
>Select "'''By trial group (subject average)'''" to average together files with similar names. <
>Select "'''Weighted average'''" to account for the different numbers of trials in both runs.<
><
> {{attachment:average_process.gif||height="565",width="526"}} * The two averages that are produced (one for each condition) are saved in the folder '''Intra-subject'''. This is where all the files computed using information from multiple folders within the same subject are saved. If you prefer to have them somewhere else, you can create new folders and move them there, just like you would do with a regular file explorer. <
><
> {{attachment:average_files.gif||height="159",width="268"}} * The file comments say "2 files" because they were computed from two averages each (one from each run), but the number of corresponding trials is correctly updated in the file structure. <
>Right-click on each of them > File > View file contents, and check the '''nAvg''' field: <
>78 trials for the deviant condition, 378 trials for the standard condition. * Double-click on the source averages to display them (standard=top, deviant=bottom). <
>Open the sensor-level averages as a time reference. <
>Use the predefined view "Left, Right" for looking at the two sides at the same time (shortcut: "7").<
><
> {{attachment:average_display_mn.gif||height="296",width="530"}} ==== Visualization filters ==== * Note that opening the source maps can be very long because of the filters for visualization. Check in the '''Filter''' '''tab''', you may have a''' '''filter applied with the option "'''Filter full source files'''" selected. In the case of averaged source maps, the 15,000 source signals are filtered on the fly when you load a source file. This filtering of the full source files can take a significant amount of time, consider unchecking this option if the display is too slow on your computer. <
><
> {{attachment:filter_sources.gif||height="191",width="202"}} * It was not a problem until now because the source files were saved in the compact form (Kernel*recordings) and the visualization filters were applied on the recordings, then projected to the source space. This fast option is not available anymore with these averages across runs. * The visualization filters will not be available anymore after we apply a Z-score normalization. If we want to display Z-score source maps that are smoothed in time, we will have to apply explicitly the filters on the file, with the Process1 tab. ==== Z-score normalization ==== * Clear the Process1 list, then drag and drop the new averages in it. * Select process "'''Standardize > Baseline normalization'''", baseline='''[-100,-1.7]ms, ''''''Z-score.''' <
>Do not run the computation, we will add the low-pass filter immediately after.<
><
> {{attachment:average_zscore.gif||height="302",width="507"}} * Add process "'''Pre-process > Band-pass filter'''": [0,40] Hz<
><
> {{attachment:average_filter.gif||height="277",width="508"}} * Four new files are accessible in the database: two filtered and two filtered+normalized. <
><
> {{attachment:average_zscore_files.gif||height="205",width="341"}} * Double-click on the source averages to display them (standard=top, deviant=bottom).<
><
> {{attachment:average_display_zscore.gif||height="295",width="530"}} * The Z-score source values at 90ms are higher for the standard condition (~25) than for the deviant condition (~15). We observe this because the two conditions have very different signal-to-noise ratios. The standard condition has about 5x more trials, therefore the standard deviation over the baseline is a lot lower, leading to higher Z-score. * '''Delete''' the non-filtered normalized files, we will not use them in the following tutorials. <
><
> {{attachment:average_zscore_files2.gif||height="147",width="294"}} <> == Averaging normalized values == Averaging normalized source maps within a single subject requires more attention than averaging current density maps. The amplitude of the normalized measures increase with the SNR of the signal, the higher the SNR the higher the normalized score. For instance, the average of the dSPM for the single trials is lower than the dSPM of the averaged trials. '''dSPM''' * From the expression of the dSPM, we know exactly what factor should be applied to compensate for this effect. When computing the average of dSPM or other normalized values, we have to also multiply the average with the square root of the number of files averaged together. * MinNorm(Average(trials)) = Average(MinNorm(trials))<
>dSPM(Average(trials)) = '''sqrt(Ntrials)''' * Average(dSPM(trials)) * This can be done automatically during the averaging for dSPM values, it corresponds to the option: "'''Adjust normalized source maps for SNR increase'''":<
><
> {{attachment:dspm_average.gif||height="129",width="339"}} '''Z-score''' * The same SNR issues arise while averaging Z-scores: the average of the Z-scores is lower than the Z-score of the average. But this time we do not have an easy analytical expression to compensate for the modifications in SNR, the average would not be reflecting the increase in SNR. * When computing averages at the subject level: Always '''avoid averaging Z-score maps'''. <
>Average the current density maps, then normalize. '''sLORETA''' * This normalization is not based on the SNR of signal, but rather on the smoothness of the maps. There is no problem related with the average of sLORETA-normalized source maps. * sLORETA(Average(trials)) = Average(sLORETA(trials)) <> == Display: Contact sheets and movies == A good way to represent what is happening in time is to generate contact sheets or videos. Right-click on any figure and go to the menu Snapshot to check out all the possible options. For a nicer result, take some time to adjust the size of the figure, the amplitude threshold and the colormap options (hiding the colorbar can be a good option for contact sheets). A time stamp is added to the captured figure. The size of the text font is fixed, so if you want it to be readable in the contact sheet, you should make you figure very small before starting the capture. The screen captures below where produced with the colormap "hot". * '''Contact sheet:''' Right-click on any figure > Snapshot > '''Time contact sheet: Figure'''<
><
> {{attachment:contact_options.gif||height="209",width="128"}} {{attachment:contact_image.gif||height="249",width="405"}} * '''Movies''': Right-click on any figure > Snapshot > '''Movie (time): All figures'''<
><
> {{attachment:video_options.gif||height="263",width="126"}} [[http://neuroimage.usc.edu/wikidocs/average_sources_unconstr.avi|{{attachment:video_vlc.gif|http://neuroimage.usc.edu/wikidocs/average_sources_unconstr.avi|height="262",width="409"}}]] <> == Model evaluation == One way to evaluate the accuracy of the source reconstruction if to simulate recordings using the estimated source maps. This is done simply by multiplying the source time series with the forward model:<
>MEG_simulated [Nmeg x Ntime] = Forward_model [Nmeg x Nsources] * MN_sources [Nsources x Ntime]<
>Then you can compare visually the original MEG recordings with the simulated ones. More formally, you can compute an error measure from the residuals (recordings - simulated). To simulate MEG recordings from a minimum norm source model, right-click on the source file, then select the menu "'''Model evaluation > Simulate recordings'''". . {{attachment:model_popup.gif||height="151",width="597"}} Open side-by-side the original and simulated MEG recordings for the same condition: . {{attachment:model_results.gif||height="218",width="332"}} <> == Advanced options [TODO] == Right-click on the '''deviant average''' for '''Run#01''' > '''Compute sources [2016]'''. <
>Click on the button ['''Show details'''] to bring up all the advanced minimum norm options. . {{attachment:minnorm_details.gif||height="443",width="460"}} === Depth weighting [TODO] === The minimum-norm estimates have a bias towards superficial currents. This tendency can be alleviated by adjusting these parameters. To understand how to set these parameters, please refer to the MNE manual (options --depth, --weightexp and --weightlimit). === Noise covariance regularization [TODO] === Explain the influence of this parameter. * '''Regularize noise covariance''': Regularize the noise-covariance matrix by the given amount for each type of sensor individually (value is restricted to the range 0...1). For more information, please refer to the MNE manual, section 6.2.4 (options --magreg, --gradreg and --eegreg). * '''Diagonal noise covariance''': * '''No covariance regularization''': * '''Automatic shrinkage''': === Regularization parameter [TODO] === Explain the influence of this parameter. * '''Signal-to-noise ratio''': Fixed SNR... * '''RMS source amplitude''': === Output mode === * '''Full results''': Saves in one big matrix the values of all the sources (15,000) for all the time samples (361). The size in memory of such a matrix is about 45Mb for 600ms of recordings. This is still reasonable, so you may use this option in this case. But if you need to process longer recordings, you may face "Out of memory" errors in Matlab, or fill your hard drive quickly. * '''Kernel only''': Saves only the linear inverse operator, a model that converts sensor values into source values. The size of this matrix is: number of sources (15000) x number of MEG sensors (274). The multiplication with the recordings is done on the fly by Brainstorm in a transparent way. For long recordings or numerous epochs, this form of compact storage helps saving a lot of disk space and computation time, and it speeds up significantly the display. Always select this option when possible. * Full results [15000x361] = Inverse kernel [15000x274] * Recordings [274x361] === LCMV beamformer [TODO] === Explain the method briefly. * '''Beamformer time-series''': * '''Neural activity index''': == Equations [TODO] == ... <> == On the hard drive == ==== Constrained shared kernel ==== Right-click on a shared inverse file in the database explorer > File > '''View file contents'''. . {{attachment:kernel_contents.gif||height="342",width="669"}} ==== Structure of the source files: results_*.mat ==== Mandatory fields: * '''ImagingKernel''': [Nsources x Nchannels] Linear inverse operator that must be multiplied by the recordings in order to get the full source time series. If defined, ImageGridAmp must be empty. * '''ImageGridAmp''': [Nsources x Ntime] Full source time series, in Amper.meter. If this field is defined, ImagingKernel must be empty. * '''Time''': [1 x Ntime] Time values for each sample recorded in F, in seconds. * '''nComponents''': Number of dipoles per grid point: 1=Constrained, 3=Unconstrained, 0=Mixed. In the case of mixed head models, the atlas GridAtlas documents region by region how the list of grid points matches the list of dipoles. * '''Function''': Type of values currently saved in the file: 'mn', 'mnp', 'dspm', 'sloreta', 'lcmv', 'lcmvp', 'lcmvnai', 'lcmvpow', 'gls', 'glsp', 'glsfit', 'glschi', 'zscore', 'ersd'... * '''HeadModelType''': Type of source space used for this head model ('surface', 'volume', 'mixed'). * '''HeadModelFile''': Relative path to the head model used to compute the sources. * '''SurfaceFile''': Relative path to the cortex surface file related with this head model. * '''Atlas''': Used only by the process "Sources > Downsample to atlas". * '''GridLoc''': [Nvertices x 3], (x,y,z) positions of the grid of source points. In the case of a surface head model, it is empty and you read directly the positions from the surface file. * '''GridOrient''': [Nvertices x 3], direction of the normal to the surface for each vertex point (copy of the 'VertNormals' matrix of the cortex surface). Empty in the case of a volume head model or unconstrained sources. * '''GridAtlas''': Atlas "Source model" used with mixed source models. * '''GoodChannel''': [1 x Nchannels] Array of channel indices used to estimate the sources. * '''DataFile''': Relative path to the recordings file for which the sources where computed. If this field is set, the source file appears as a dependent of the DataFile. * '''Comment''': String displayed in the database explorer to represent this file. * '''History''': Operations performed on the file since it was create (menu "View file history"). Optional fields: * '''Options''': Structure that contains all the options of the inverse calculation. This is saved in the file only for bookkeeping. * '''Whitener''': Noise covariance whitener computed in bst_inverse_linear_2016.m * '''DataWhitener''': Data covariance whitener computed in bst_inverse_linear_2016.m * '''SourceDecompVa''': [3 x Nsources] - [TODO] * '''SourceDecompSa''': [3 x Nvertices] - [TODO] * '''Std''': For averaged files, number of trials that were used to compute this file. * '''DisplayUnits''': String, force the display of this file using a specific type of units. * '''ChannelFlag''': [Nchannels x 1] Copy of the ChannelFlag field from the original data file. * '''nAvg''': For averaged files, number of trials that were used to compute this file. For source files that are attached to a data file, we use the nAvg field from the data file. ==== Full source maps ==== In ''Intra-subject'', right-click on one of the normalized averages > File > '''View file contents'''. . {{attachment:zscore_contents.gif||height="377",width="426"}} This file has the same structure as a shared inverse kernel, with the following differences: * It contains the full time series (ImageGridAmp) instead of an inverse operator (ImagingKernel). * The Z-score process updated the field Function ('mn' => 'zscore') ==== Source links ==== * The links are not real files on the hard drive, if you select the menu "View file contents" for any of them it would display the structure of the corresponding shared kernel. * They are saved in the database as strings with a specific structure: "'''link|kernel_file|data_file'''". This string associates a shared inverse operator with some recordings. The two files have to be available to load the this file. All the functions in Brainstorm are equipped to reconstruct the full source matrix dynamically. ==== Filename tags ==== * '''_KERNEL_''': Indicates that the file contains only an inverse kernel, it needs to be associated with recordings to be opened. ==== Useful functions ==== * '''in_bst_results'''(ResultsFile, LoadFull, FieldsList): Load a source file and optionally reconstruct the full source time series on the fly (ImagingKernel * recordings). * '''in_bst'''(FileName, TimeBounds, LoadFull): Load any Brainstorm data file with the possibility to load only a specific part of the file. * '''bst_process'''(''''LoadInputFile'''', FileName, Target, TimeWindow, OPTIONS): The most high-level function for reading data files, can compute scout values on the fly. == References [TODO] == * Dale AM, Liu AK, Fischl BR, Buckner RL, Belliveau JW, Lewine JD, Halgren E<
>[[http://www.ncbi.nlm.nih.gov/pubmed/10798392|Dynamic statistical parametric mapping: combining fMRI and MEG for high-resolution imaging of cortical activity]]. Neuron 2000 Apr, 26(1):55-67 * Pascual-Marqui RD, [[http://www.ncbi.nlm.nih.gov/pubmed/12575463|Standardized low-resolution brain electromagnetic tomography (sLORETA): technical details]], Methods Find Exp Clin Pharmacol 2002, 24 Suppl D:5-12 == Additional documentation == * Tutorial: [[Tutorials/TutVolSource|Volume source estimation]] * Tutorial: [[Tutorials/DeepAtlas|Deep cerebral structures]] * Tutorial: [[Tutorials/TutDipScan|Computing and displaying dipoles]] * Tutorial: [[Tutorials/DipoleFitting|Dipole fitting with FieldTrip]] * Tutorial: [[Tutorials/TutBEst|Maximum Entropy on the Mean (MEM)]] * Forum: Minimum norm units (pA.m): [[http://neuroimage.usc.edu/forums/showthread.php?1246-Doubt-about-current-density-units-pA.m-or-pA-m2|http://neuroimage.usc.edu/forums/showthread.php?1246]] * Forum: Imaging resolution kernels: http://neuroimage.usc.edu/forums/showthread.php?1298 * Forum: Spatial smoothing of sources: http://neuroimage.usc.edu/forums/showthread.php?1409 * Forum: Units for dSPM and sLORETA: [[http://neuroimage.usc.edu/forums/showthread.php?1535-Dipole-strength-units-for-dSPM-and-sLORETA|http://neuroimage.usc.edu/forums/showthread.php?1535]] * Forum: EEG reference: http://neuroimage.usc.edu/forums/showthread.php?1525#post6718 * Forum: Sign of the MNE values: http://neuroimage.usc.edu/forums/showthread.php?1649#post7014 * Forum: Combining magneto+gradiometers: http://neuroimage.usc.edu/forums/showthread.php?1900 * Forum: Residual ocular artifacts: http://neuroimage.usc.edu/forums/showthread.php?1272 <)>> <> <>