Command: emegs3d
The Emegs3d Menu is the menu to plot all surfaces of interpolated or approximated 'Scalp- Potentials /Magnetic Fields distributions', of 'Laplacian' (in case of EEG this is equivalent to 'Current Source Density' (CSD)) and performs 'intracranial potential/filed estimation'. An inverse L2Minimum Norm solution is also available.
Attention: Calculation of Spherical Spline Interpolations, Laplacians, Cortical Maps and L2-Min.-Norms depend on leadfield calculations, which again depend on the actual sensor configuration. In order to minimize calculation time Emegs3d saves calculated leadfield coefficients in the Emegs3dCoeff40 as well as Emegs3dInvCoeff folder. Prior leadfield calculation Emegs3d checks for possibly existing coefficient files for the particular sensor configuration in these folders and reads them in, instead of calculate them again. Therefore, the user must not name different sensor configurations identically. The program would use the original existing (now wrong) coefficients, as it is not able to check if the sensor configuration were changed. In case the user would like to keep sensor configuration names and change the configuration he or she has to delete all corresponding leadfield coefficient files in the folders mentioned above. Leadfield coefficient file names contain the configuration names e.g Scalp_129_32_15 corresponds to the sensor configuration 129.ecfg.
The files DLoc_*.* in folder Emegs3dInvCoeff contain the inverse leadfield dipole positions and must not be deleted.
DLoc_655_4_Cart.ascii: 655 dipole locations arranged on four shells with 2, 4, 6, and 8 cm radius. (Hauk et al. Min.-Norm)
DLoc_350_1_Cart: 350 dipole locations arranged on one single shell with 8 cm radius.
DLoc_197_1_Cart: 197 dipole locations arranged on one single shell with 6 cm radius.
Menus
File :Open file matrix
Using this feature its possible to read or create a file matrix (containing a number of file names and their paths) to run special calculations (=> Emegs3d:Calculate) in batch mode. The program displays a dialog box for the user to fill in a file name or search for an existing file. The program tests whether this file is of file matrix style (an ascii text file containing a number of paths and names of existing files (Important: Each file has to be existing). If this is not the case the file chosen first builds the first row of a new file matrix. Add as much files into this matrix as you want and stop adding using the 'Escape' button. The matrix will be shown in an additional help window. If you would like to save this file matrix use: Save file matrix. Attention: To use this files in batch mode you have to choose the 'Emegs3d: Use file matrix' menu otherwise all (or the) data set(s) given in the menu 'Emegs2d:Actual Data Set' will be used in batch mode. However, an additional help text informs you about the data sets or files and the procedure, which will be used in batch mode.
File :Save file matrix
If a file matrix (compare with: Open file matrix) is already imported the user could save this file matrix into a file of file matrix style (an ascii text file containing the file names and paths). The user will be asked for the filename and path of this file using a dialog box. The default filename is FileMatrix.txt.
File :Add file to file matrix
If a file matrix (compare with: Open file matrix) is already imported the user could add additional file names to file matrix.
File :Use file matrix
If a file matrix (compare with: Open file matrix) is already imported the user can chose to use the files of this matrix in all features running in batch mode. This will be marked by a pointer. If this menu is not marked all data sets given in the menu 'Emegs2d:Actual Data Set' will be used.
Style:Flip Color Map:
Flips the chosen color map.
Style:Text: Sensors
Indicates the actual sensor positions as names, circles or asterisks.
Export:Calculated distribution
Exports the calculated distribution (scalp potential, laplacian etc.) in a file. This file can later be used to do difference calculation. (for further information look at: Calculate:Difference)
The default file name depends on the method of calculation
'Untitled.Scalp' if Scalp Potential was chosen
'Untitled.Lap if Laplacian was chosen
'Untitled.Cort if Cortical mapping was chosen
'Untitled.PScalp if Perrin Scalp Potential was chosen
'Untitled.PLap if Perrin Laplacian was chosen
'Untitled.IMN1 if Inverse Minimum Norm of the 1 Shell (8cm) was chosen
'Untitled.FMN1 if Forward Minimum Norm of the 1 Shell (8cm) was chosen
Calculate:Scalp, Lap., Cort => Pic
Calculates
the scalp potential or the laplacian or the intracranial potential
estimation (cort) or the Perrin style scalp potential or the Perrin
style laplacian depending on the chosen method in the Emegs3d main
window menu, creates 3d plots (sphere model) of the first chosen
intervall and saves these plots in a jpg-file. This will be done in
batch mode for all data
sets which are given in the file matrix. All files have
to have the format of the actual given data set in the
'Emegs2d:File:Data Format' menu (right now only the 'SCADS', 'Egis
averaged' and 'Egis grand average' formats are supported), and Emegs3d
settings have be set to the RenderModel 'Sphere' and SurfView 'Head
View'. If the
'Emegs2d:Calc. Baseline' radio button is 'on' the data sets will be
baseline corrected using the in Emegs2d given baseline interval. Please
remember that all calculations depend on the selected lambda
approximation value given in the Emegs3d main window menu. You will be
prompted for the number of subjects and the number of conditions per
subject, that are needed for arranging the plots.
The plots will be stored in jpg image file
with (n = the number of
subjects) columns and (m = the number of conditions) rows. Coloring of the plot can be scaled
for each subject or globally, using the actual amplitude settings in
Emegs3d.
Calculate:Scalp, Lap., Cort => File
Calculates the scalp potential or the laplacian or the intracranial potential estimation (cort) or the Perrin style scalp potential or the Perrin style laplacian depending on the chosen method in the Emegs3d main window menu. These calculations will be done in batch mode for all data sets which are either given in the file matrix (if the menu 'Emegs3d:File:Use file matrix' is marked) or given in the 'Emegs2d:Actual Data Set' menu (if the menu 'Emegs3d:File:Use file matrix' is not marked). In case of using a file matrix all files have to have the format of the actual given data set in the 'Emegs2d:File:Data Format' menu (right now only the 'SCADS', 'Egis averaged' and 'Egis grand average' formats are supported). If the 'Emegs2d:Calc. Baseline' radio button is 'on' the data sets will be baseline corrected using the in Emegs2d given baseline interval. Please remember that all calculations depend on the selected lambda approximation value given in the Emegs3d main window menu. Using 'Scalp, Lap., Cort => File:Use channel groups' the program calculates the average over all channels given in the channel group file (Use 'Emegs2d:Calcculate:Channel groups:Open group file'). The number of time points or time intervals depends on the given Min. Time, Max. Time, Dist. Point interval values and the 'Calc. Mean (point interval)' radio button selection given in the main Emegs3d figure menu. The results will be stored electrode or group wise in an ascii text file which format is described in its one column main header. The default file name is ''Method'.txt'. (Method as chosen above) The values following each electrode or group header (also one column) correspond to the calculated values of each of the given time points or time intervals.
A second file with the additional extension '.rms' stores the root mean square values 'RMS' (compare with RMS of Emegs2d) based on all electrode values of the calculated method and its sum over the whole time interval.
If the user calculates the mean over intervals (in Emegs3d main window menu) he/she should remember that this calculation of the mean acts prior to the root mean square calculation! Concerning the RMS values this order is of importance.
Attention: The RMS of Emegs2d (domain 'time') is identical with the RMS of Emegs3d (method 'scalp') without use of approximation. Using approximation the 'RMS' of Emegs3d is always smaller than the 'RMS' of Emegs3d (not approximated).
Calculate:Min. Norm => File
Calculates the L2-minimum-norm absolute values (not the orientations; please compare with the 'Emegs3d: L2.-Min.-Norm' Menu) of all data sets which are either given in the file matrix (if the menu 'Emegs3d:File:Use file matrix' is marked) or given in the 'Emegs2d:Actual Data Set' menu (if the menu 'Emegs3d:File:Use file matrix' is not marked). In case of using a file matrix all files have to have the format of the actual given data set in the 'Emegs2d:File:Data Format' menu (right now only the 'Scads', 'Egis averaged' and 'Egis grand average' formats are supported). If the 'Emegs2d:Calc. Baseline' radio button is 'on' the data sets will be baseline corrected using the in Emegs2d given baseline interval. Please remember that the calculation of the minimum norm depends on the selected shell ('L2-Min.-Norm') and the selected lambda approximation value given in the Emegs3d figure menu. Using 'Min. Norm => File:Use channel groups' the program calculates the average over all channels given in the channel group file (Use 'Emegs2d:Calcculate:Channel groups:Open group file'). The number of time points or time intervals depends on the given Min. Time, Max. Time, Dist. Point interval values and the 'Mean' as well as 'MN Mean' radio button selection given in the main Emegs3d figure menu. The calculation of the mean across a given interval in time, std, frequency or PCA domain is identical to the calculation of the mean in the minimum norm source domain. The results will be stored electrode or group wise in an ascii text file which format is described in its one column main header. The default file name is 'MinNorm.txt'. The values following each electrode or group header (also one column) correspond to the calculated values of each of the given time points or time intervals.
'MN Mean' radio button: While calculation of the L2-Min-Norm is a simple multiplication of the inverse leadfield matrix with the data and thus linear, the intensity calculation of the L2-Min-Norm is not (the vector length sqrt(x^2+y^2+z^2) is always positive). Calculation of the mean in time or frequency domain and than the Min-Norm (MN(mean(A)) differs from a mean across the Min.-Norms of every single point in time or frequency (mean(MN(A)). If 'MN Mean' is set 'On' the program calculates mean(MN(A)) and MN(mean(A)) if 'Off'.
A second file with the additional extension 'rms' stores the root mean square values 'RMS' (compare with RMS of Emegs2d) based on all electrode values of the calculated method which is the sum across the whole time interval.
To simplify the import of the calculated data into statistic programs two additional files (extension 'dat') will be written containing just the calculated values without any header.
If the user calculates the mean across intervals (in Emegs3d main window menu) he/she should remember that this calculation of the mean acts prior to the root mean square calculation! Concerning the RMS values this order is of importance.
Calculate:Minimum Norm => File: Save MN to sensor configuration.
Projects the calculated Min.-Norm of the actual MN shell (all shells is not possible) onto the actual sensor configuration and saves the result as an SCADS average file.
Calculate:Minimum Norm => File: Save MN to actual shell.
Saves the calculated Min.-Norm of the actual MN shell (all shells is not possible) as an SCADS average file.
Calculate:Minimum Norm => File: Save MN to Analyse.
Saves the calculated Min.-Norm (only possible for L2, All shells, 4 shells) as an 'Analyse' data (*.img) and corresponding header (*.hdr) file. Please use the Matlab program SPM (Statistical Parametric Mapping, Welcome Department London) for further analysis based on this results.
Calculate:Minimum Norm => File: Regions of interest: Read regions of interest file.
Read C3-C4-20-ROI.txt in the folder 'Rois' as an example for two regions of interest with 20 degree circles around C3 and C4. Replace or add your own regions of interest using the given format. The first value has to be the number of regions (NRoi). The second number has to be 4 since the following matrix defining the regions of interest has to be of NRoi x 4 style.
The first and second row define the spherical coordinates theta and phi of the center of the regions of interest. The third row has to stay at 0.092 m (radius of given model). The fourth row defines the extent of the circle around the given center defining the region of interest.
Calculate:Minimum Norm => File: Regions of interest: Use regions of interest.
In addition to the four files explained above you will get a file (extension 'roi') writing the following information in three loops: Time, Region, Dataset (time running fastest)
1 Point (or interval) of time;
2,3,4 Location of maximum in cartesian coordinates.
5,6,7 Location of maximum in spherical coordinates
8 Maximum absolute value
9 Mean value
10 RMS value
The sixth and last file (extension 'dat') contains all these data in a following stream in order to simplify the import into statistic programs.
Calculate:Minimum Norm => File: Indices of interest: Read indices of interest file.
Indices of interest indicate Min.-Norm dipole positions of interest. The indices depend on the actual dipole set and the chosen shell. The user has to define a matrix with 'number of groups' columns and 'maximum number of dipoles in a group' rows. If any group contains less dipoles than the 'maximum number of dipoles in a group' please use zeros as placeholder. Please read LB-RB-LF-RF-MN7-IOI.txt in the folder Iois using 'ReadAscii' as an example (type ReadAscii in the command line and choose the LB-RB-LF-RF-MN7-IOI.txt file). The matrix contains indices of the 655 dipole positions containing Min-Norm Matrix (indicated by MN7). The first column indices all dipole positions in the right frontal area, the second all in the left frontal, the third all in the left back and the fourth all in the right back. The areas in the back contain 148 dipoles each, the frontal areas contain 9 dipoles less (139). Min.-Norm values will be averaged across all dipole positions in a group and exported as mentioned above.
Calculate:Minimum Norm => File: Indices of interest: Use indices of interest file
Min.-Norm values will be averaged across all dipole positions in a group and exported as mentioned above (Use regions of interest).
Calculate:Absolute or Calculate:Inverse
Calculates the absolute or inverse of the calculated distribution. (Scalp, CSD or Min-Norm). Remember that this is not the same as the calculation of the distribution of the inverted or the absolute of the original data (Use Calculate:Absolut or Calculate:Inverse in the Emegs2d Menu to do this) .
Attention: Take care if you calculate the absolute values in Emegs2d and do a laplacian calculation based on this data set. Calculating the absolute value changes not only the polarity of the amplitudes and the polarity of the spatial gradients but also changes the distribution gradient in the zero value region (the greater the gradient the stronger the gradient change in the zero value region). Since the calculation of the Laplacian is the second spatial gradient of the scalp distribution (a kind of spatial high-pass filtering) the calculation of the absolute value will result in severe errors in the regions in which there are transitions from positive to negative values.
Calculate:Difference:Actual-File or Calculate:Difference:File-Actual
If the user would like calculate difference maps of two conditions they may either calculate the difference of the original data sets using Calculate:Difference:File1-File2 or Calculate:Difference:File2-File1 in the Emegs2d version and plot this difference using Emegs3d (Surfaces) or ...
The user should perform the surface plot of the first data set (first condition) (using any method: Scalp, Laplacian, Cort Map or Min Norm) and export this data using Export:Calculated distribution. Then the same calculation method (it is possible to choose a different method but in most cases this comparison wouldn't make sense) is carried out for the with the second data set (change actual data set in Emegs2d to the second data set and press Get2dData in the Emegs2d Main window menu)
Then the calculation is performed by choosing Calculate:Difference:Actual-File or Calculate:Difference:File-Actual . Now the difference (cond1-cond2 is in this case File-Actual and cond2-cond1 is in this case Actual- File) of the given calculated distributions will be plotted.
Attention: Please remember that this difference distribution is not necessarily identical with the distribution of the difference calculation of the original data sets. This depends on the chosen calculation method. In case of Scalp Potential the distributions of both methods should be identical (if weight vectors or lambda values are different they could differ minimally). In case of the laplacian or cortical mapping values should be similar. However the differences might be bigger. In the case of the Minimum Norm calculation the results might look totally different. Since this Minimum Norm calculation is a kind of an absolute power of sources it is not possible to decide in which condition the additive sources occur if you take the difference waves of the original data sets. i.e. you should get the same effect with both differences (cond1 - cond2 or cond2 - cond1). To visualize the polarity of the differences in dipole moment distribution (to decide in which condition is more or less activity at special positions) its necessary to do the difference calculation mentioned above Calculate:Difference:Actual-File or Calculate:Difference:File-Actual.
UIControls
Scalp, Lap, Cort:
This is the popupmenu to choose the method.
L2-Min.-Norm This is the popupmenu to choose the Minimum Norm leadfield configuration (conventional single shell or Hauk et al. four shells) as well as the actual shell to visualize.
L2; Shell xxx cm; 4 Shells: Calculates the MN based on 655 dipoles positioned on four shells with 8, 6, 4, and 2 cm and extracts the results of shell with xxx cm. The most superficial 8 cm shell contains 350 dipoles, the second 6 cm shell 197 dipoles.
L2; Shell 8 cm; 1 Shell: Calculates the MN based on 350 dipoles positioned on a shell with 8 cm radius.
L2; Shell 6 cm; 1 Shell: Calculates the MN based on 197 dipoles positioned on a shell with 6 cm radius.
L2; All Shell; 4 Shells: Calculates the MN based on 655 dipoles positioned on four shells with 8, 6, 4, and 2 cm. Results can not be visualized but extracted by using indices of interest (see above) or save the result as Analyse files (see above).
With first use of this feature using a new sensor configuration the calculation of the leadfield matrices could take a while (depending on your system and the number of sensors between up to 3 minutes).
Special Tasks: Several shortcuts. SLC = Scalp,Lap,Cort (depends on the chosen method). MN = Min-Norm (depends on the chosen MN dipole configuration and/or shell)
Orientations (quiver) radio button
Using the L2-Min.-Norm method the user can choose whether not only the absolute value distributions of the calculated 'sources' but also their spatial orientations using arrows will be shown. The arrows are automatically scaled to fit.
Point Interval:
If the distance is chosen to SampRate/1000 (ms per point of time) each time point of your chosen time interval will be plotted. If distance is bigger than SampRate/1000 plotting will start with the first time point but leaves the distance*SampRate/1000- 1 time points. If distance is 2*SampRate/1000 for instance only every second point of time will be plotted. If the Calc. mean radio button is 'On' the program calculates the mean of the interval from one point of time to the next but the next excluded. Once more: If the distance is 2*SampRate/1000 and Calc. mean radio button is 'On' the first plot will be the mean of the first and the second point of time, the second plot the mean of the third and the fourth etc. If the distance is chosen to SampRate/1000 the calculation of the mean is discarded.
View:
Spec Surf shows only the special Head View chosen using the popupmenu at the right of this button.
All Surf I (3d) plots all views (top, bottom, left, right, front, back) in addition.
All Surf I| (3d) does the same as All Surf I (3d) except the bottom view because this view is often not that informative other than for synthetic data.
Plot (2d) plots a time course of maximum 10 time points using the chosen Head View
HeadView does the same as Spec Surf without plotting additional latency and global power information.
Columns and Rows does the same as Plot (2d) without plotting additional latency and global power information and without limit on the number of time points or intervals chosen.
Head View:
As described above. If you want to choose a special view please insert the wished Theta und Phi values in the following edit menu.
Plot Sensors / Plot Contour.
Just in first view: Plots sensor positions / head contours only in the first axes (view).
In all views: Plots electrodes positions / head contours in all axes (views).
Do not plot electrode positions: Does not plot electrode positions \ head contours in all axes (views).
Choose type of sensor index by top menu Style:Text:Sensors
Plot Lateny.
Plots or extracts latency information of chosen points or intervals in all views.
Save data:
Stores data to ascii or float32 header file with first value: Number of locations or sensor second value: Number of time points or dimension of locationsValues at scalp locations: Stores the calculated values (Scalp,CSD, Cort,MinNorm) at 932 scalp positions. (Save the scalp positions in ascii format if these locations are wanted)
Values at sensor /leadfield locations: Stores the calculated values (Scalp,CSD, Cort,MinNorm) at the NChan sensor locations (if Scalp,CSD or Cort was chosen) or the NLeadField leadfield locations (if MinNorm was chosen),. (Save the scalp/sensor/leadfield locations in ascii format if these exact locations are needed)
Values at special scalp/leadfield location: As with 'Values at scalp location' but now it is possible to choose special locations ! If for example only the top and back scalp locations are to be saved choose first 'Top' than choose the 'Additional choice' and choose 'Back' . If you choose first 'Left' than choose the 'Additional choice' and choose 'Right' the matrix of scalp locations will be empty.
Values at spec. sensor locations: Using this feature the first time choose: 'Create a new file' Now choose the special sensor positions of which you want to save the calculated Scalp,CSD or Cort values. If you would like to do this process several times it might be helpful to save this sensor status configuration. Doing this it is possible to choose 'Choose an existing file' next time and load this configuration directly.
Color Map:
Choose the Matlab color maps.
Flip Color Map:
Flips the chosen Matlab color map.
N-Color:
Defines the number of different colors in the colormap
N-Color by Amp:
Defines the number of colors by bins of amplitude.
Amplitudes:
as in Emegs2d
Center Amplitude:
If this is chosen the amplitudes will be centered.
Special Amplitude:
If Spec. Amplitude is set 'off' the optimal color map for each time point is used.
Thus, the color versus amplitudes will change from one point to the next.
Auto Amp:
If the user carries out any kind of new calculation and 'Auto Amp.' is set 'on' the program will automatically calculate the minimum and maximum of the calculated values and use these values to set Minimum / Maximum Amplitude. Please switch 'Auto Amp.' off in order to use an identical amplitude range for several calculations and/or data sets.
Time interval:
as in Emegs2d
Length of interval: (e.g. Dist. Time):
calculates intervals with given interval length limited by Min. Point and Max. Point. The number of intervals is indicated in the number of interval edit menu.
Number of intervals:
The number of intervals limited by Min. Point and Max. Point. The program calculates the length of each interval and indicates it in the length of interval edit menu.
Mean:
If 'Mean' is set 'On' the program calculates the mean across all points within a given interval. If 'Mean' is set 'Off' only the interval borders (special points) are calculated.
'MN Mean' radio button:
While calculation of the L2-Min-Norm is a simple multiplication of the inverse leadfield matrix with the data and thus linear, the intensity calculation of the L2-Min-Norm is not (the vector length sqrt(x^2+y^2+z^2) is always positive). Calculation of the mean in time or frequency domain and than the Min-Norm (MN(mean(Data)) differs from a mean across the Min.-Norms of every single point in time or frequency (mean(MN(Data)). If 'MN Mean' is set 'On' the program calculates mean(MN(Data)) and MN(mean(Data)) if 'Off'.
Use Approximation/Normalization with SLC Lambda
This defines the degree of approximation in the spline interpolation normalization (Scalp, Laplace, Cortical Mapping). The over all SLC Lambda value has to be set using the SLC Lambda edit menu. Use bigger values for stronger smoothing, smaller values for regional effects of interest. The optimal SLC Lambda value depends on the signal to noise ratio.
Use Approximation/Normalization with MN Lambda:
This defines the degree of approximation in the degree of normalization of the inverse minimum norm matrix. The over all MN Lambda value has to be set using the MN Lambda edit menu.
In order to visualize the Min. Norm results Emegs3d uses an additional SLC spline interpolation. Therefore, changing the SLC Lambda value with Minimum Norm calculations changes the smoothness of the visualization of the Min. Norm results but not the actual MN values, which might be exported.
Use app vector and Use app. matrix:
This does only make sense if the noise differs across sensors (vector) and/or time (matrix). You could make use of this additional information if the std matrix is given (as described in our processing paper) or if some other noise information is given (e.g noise in baseline etc.)
If Use app. Vector or Matrix is chosen the user has to choose the minimum value of the beta vector or beta matrix . If 0.8 is chosen the worst sensor is weighted with 80% of the best. If 0.0 is chosen the worst electrode is not used for interpolation.
Beta weight method:
Calculates the weight vector on the basis of the beta vector.
Print to file Method:
If this is chosen each window of the chosen time interval will be stored in a file of the chosen format. The user has to set the path and file name of the movie pictures first.
Choose the PrintFile folder. The pictures of the movie are allocated the following numbers.
Print file compression:
JPEG 100 is no compression, 0 is maximum compression. The file size and resolution decreases with increasing compression (decreasing compression value). The default value is 80.
TIFF 100 is 100 dots per inch. The default value is 150.
EPS or EPS & TIFF preview Print file compression doesn't matter
Movie Pause
If 'Movie Pause' is set 'on' the program stops after each figure presentation waiting for a 'Return' button press to continue. Switch the break 'off' if you do not want to inspect the results but only export them e.g. as a movie.
Apply:
Choose Apply if only display changes have been performed. After calculation changes (like a new data set, Lambda value, calculation method etc.) this is not possible. The user must choose the calculation method once more.
Actual data set:
Like 'Actual data set' in 'Emegs2d'. Using this button its possible to switch between the data sets given in Emegs2d. Adding or changing data sets in Emegs2d does not automatically add or change data sets in Emegs3d. Use 'Actual data set' in Emegs3d in order to actualize the given data sets.