Plot2d Manual



Contents:




1. Getting started

2. Filtering and segmentation

3. Artifact detection

4. Averaging

5. 2d visualization

6. 3d visualization



1. Getting Started

The plot2d programs consist of data extraction, editing, averaging, visualization modules as well as modules for further analysis. Unfortunately, for most modules manuals are not available.
The procedure used for artifact detection is described in detail in
Junghfer, Elbert, Tucker & (2000) Junghfer, M., Elbert, T., Tucker, D. M., & Rockstroh, B. (2000). Statistical control of artifacts in dense array EEG/MEG studies. Psychophysiology, 37, 523-532.

SCADS in the following will be used for  Statistical Control of Artifacts in Dense array Systems, and stands for the entire set of matlab scripts in the plot2d-package.
When first using SCADS programs, set the Matlab search path to include all subfolders of the Plot2d3d folder. After this, all SCADS functions are available, and you can start with the data analysis. Functions (like all matlab functions) can be called by typing their name in the command window and pressing return. The most important functions and their names are now summarized to give you a first orientation:

FilterNetFile.m filters EGI Raw data sets.
You might try to use the TransNetGeoHist.m file as example how to extract EGI session data out of EGI Raw data, based on the trigger information given in the corresponding history files.
Use NeuroScan2Egis.m as example how to extract EGI session data out of continuous Neuroscan data.
CalcAutoEditMat.m calculates the parameter of interest important for the later editing process (absolute maximum, temporal gradient, standard deviation, power of given frequency interval).
FindBadChan.m identifies sensors bad across the whole session.
FindBadChanTrial.m identifies bad sensors within individual trials.
You might use Batch.m as an example how to run the data preprocessing in batch mode.
Use EditAEM.m in order to edit the parameter of interest.
Use AvgApprox.m in order to average the data.
Use MergeAvgFiles in order to calculate grand means (in batch mode).
Use CalcAvgDiff in order to calculate differences between data sets (in batch mode).
Use WaveApp.m in order to calculate wavelet analysis.
Use  CalcAvgScadsTStats.m in order to calculate t-tests across SCADS average files.
Use  CalcAppScadsTStats.m in order to calculate t-tests across SCADS session files.
To display averaged data use Plot2d.m.

2. Filtering and segmentation

Command: FilterNetFile


3. Artifact detection

Commands: calcautoeditmat, findbadchan, findbadchantrial, editaem
4. Averaging
Commands: avgapprox, mergeavgfiles, calcavgdiff



5. 2d visualization

Command: plot2d



5.1 Menus

File:Open Data Set  Open Data Set button (top right of command buttons)

Default: If Default File format is not given the file will revert to EGIS average format.

Opens FileSearchWindow  with FileMask
*.ave* if averaged EGIS file
     *.gave* if grand averaged EGIS file
     *.ses* or *.E* if EGIS session file
     * if Ascii
     * if Ascii with Header; Header: Number of Channels, Number of Points
     *.at* if SCADS Format
     *.avr* if Ascii Besa Format
     *.raw* if MEG ascii file


Reads the given data matrix of file and displays it in Actual Data (highest left button).

Open Data Set 1 Opens first data set
Shortcut: 'Apple' ('Control' on PC or Unix) plus 'h'.
Open Data Set 2 Opens second data set
Shortcut: 'Apple' ('Control' on PC or Unix) plus 'j'.
Open Data Set 3 Opens third data set
Shortcut: 'Apple' ('Control' on PC or Unix) plus 'k'.
Open Data Set 4 Opens fourth data set
Shortcut: 'Apple' ('Control' on PC or Unix) plus 'l'.

Open Data Set i+/-j set (SCADS format only) Asks for first file name with extension (*.at(i)*) and opens maximum additional 3 files (*.at(i+/-j)*)) as long as they exist in the identical directory.
Shortcut: 'Apple' ('Control' on PC or Unix) plus 'm'.

Open Batch Set (SCADS format only) asks for a (*.at*) batch file containing full file names (including path) of maximum 4 (*.at*) existing SCADS files to.
Shortcut: 'Apple' ('Control' on PC or Unix) plus ','.

Important
If using MEG data: Overlaying time courses of different data sets need identical sensor and head model configurations. Therefore data sets with set values higher than 1 (Data set 2; Data set 3 and Data set 4) use the sensor and head model configuration of Data set 1. If the user reads a new Data set 1 the program automatically searches for the new corresponding Sensor- and Center of Sphere configuration.

If a data file is opened without a given sensor configuration file the program searches for file
'...:Plot2d3d:Plot2dUtil:SensorCfg:Number of Channels.ecfg' Sensor configuration if SCADS Sensor configuration format.

      or
with sensor configuration with the same name as the data file and in the same folder but with extension .pmg instead of .raw if the sensor format is MEG on sphere or MEG no sphere

See 'Open Sensor Set' for other sensor configuration formats

If the sensor configuration file does not exist  Open Sensor File will be activated

The program will test whether the number of channels in the data file equals the number of channels in the sensor configuration.
If no an error message will be displayed -
      'This data file contains 'Nchan' channels'
      'The sensor configuration file contains 'Nchan' channels'
      'Please choose a different data file or a different sensor configuration.'


File:Open Sensor Set

Default: If not nominated the default configuration is -
      'SCADS format' 		if  EEG data
      'MEG no sphere format'	if  MEG data

If the data file is already chosen program searches for the sensor configuration file with corresponding FileMask.
Opens FileSearchWindow  with FileMask:
'*.int2str(NChan).elp' if Besa sensor configuration
'*int2str(NChan).ecfg' if Egis sensor configuration(Eugene electrode configuration is not yet given)
'*int2str(NChan).ecfg' if sensor configuration format is 'SCADS'
'* int2str(NChan).CartAscii' if sensor configuration format is 'CartAscii'
'* int2str(NChan).SpherAscii' if sensor configuration format is 'SpherAscii'
'* int2str(NChan).AxesAscii' if sensor configuration format is 'AxesAscii'
searches for the sensor configuration with the same name as the data file and in the same folder but with extension '.pmg' instead of '.raw' if the sensor configuration format is 'MEG on sphere' or 'MEG no sphere'. If this file does not exist a FileSearchWindow will be opened with the FileMask:
'*.pmg'

If no data file is chosen the command window displays options for nominating file with sensor configuration.  The FileMask for the type of data must be nominated in the 'Dateityp' window.  e.g if SCADS format is used the sensor configuration may be nominated by searching for the file named '...:Plot2d3d:Plot2dUtil:SensorCfg...' the options available for sensor configuration will be displayed.
Opens FileSearchWindow with FileMask:
      '* elp' if sensor configuration format is 'Besa'
      '* ecfg' if sensor configuration format is 'SCADS'
      '* CartAscii.ecfg' if sensor configuration format is 'CartAscii'
'* SpherAscii.ecfg' if sensor configuration format is 'SpherAscii'
'* AxesAscii.ecfg'  if sensor configuration format is 'AxesAscii'
'*.pmg' if the sensor format is 'MEG on sphere' or 'MEG no sphere'.


If the sensor locations are not positioned onto a sphere the user will be asked whether this is required.
If a sensor weighting file is available it has to be of the Header Ascii Matrix form.
These values are used to weight the sensor positions in the best sphere fit calculation.
If no weighting file is used all sensor positions are weighted with a value of 1.
CSD or Intracranial mapping of scalp potentials must be represented in the spherical form as calculations for these are limited to the spherical form.  However, it is possible to calculate 'Minimum Norm' with this configuration.
This is especially of importance if the sensor configuration is of MEG type.

In case of MEG sensor configuration:
'MEG on sphere' - the sensor positions will automatically be projected onto a sphere. Now interpolated field maps, laplacians and intracranial field estimations are possible since these methods require spherical models.
The calculation  of 'Minimum Norm' uses the original not projected sensor configuration.

'MEG no sphere' -  these methods are not available. However, the calculation  of 'Minimum Norm' using this original not projected sensor configuration is more reliable than the projected one.

In the next step the program searches for the MEG center of spherical head model information with the same name as the data file and in the same folder but with extension '.cot' instead of '.raw' if the sensor configuration format is 'MEG on sphere' or 'MEG no sphere'.
If such a file does not exist is not possible to correct the MEG sensor positions. The center of sphere will be assumed to the origin [0 0 0].



File: Data Format

This command allows the type of data collected to be nominated and searches for the appropriate data under the following FileMasks.

If Data Format is AUTO FileMask is *.*. Data Set Format will be chosen automatically depending on the files extension.

NeuroScan Average
Opens FileSearchWindow  with FileMask  '*.avg*' (ReadNeuroscanStruct.m)

NeuroScan Continous
Opens FileSearchWindow  with FileMask  '*.cnt*' (ReadNeuroscanStruct.m)
Manual needs to be written

SCADS Wavelet Amplitude
 file (Result of SCADS WaveApp.m based on SCADS .app files, results of AvgApprox.m)
Opens FileSearchWindow  with FileMask  '*.awa*'

SCADS Wavelet Phase
 file (Result of SCADS WaveApp.m based on SCADS .app files, results of AvgApprox.m)
Opens FileSearchWindow  with FileMask  '*.pwa*'

EGIS Average file
Opens FileSearchWindow  with FileMask  '*.ave*'
Now the ActualData button  (highest left button in MainWindow) becomes  the first cell and first subject and OpenData (Averaged file) menu (highest right button in MainWindow) will show all possible cells and subjects of this data file. Now the user can choose any of these cells and subjects for a given ActualData number or choose a new file using the New File choice  given in the OpenData (Averaged file) menu .
=> Starts again File:Data format.

Egis Grand Average
Opens FileSearchWindow  with FileMask  '*.gave*'

EGIS Session file
Opens FileSearchWindow  with FileMask  '*.E*'
Now the ActualData  (highest left button in MainWindow) becomes  the first Cell and first subject and OpenData menu (highest right button in MainWindow) will show all possible cells and trials of this data file. Now the user can choose any of this cells and trials for a given ActualData file number or choose a new file using the New File choice  given in the OpenData menu .
=> Starts again: File:Data format

SCADS
Opens FileSearchWindow  with FileMask  '*.at*'

Ascii Matrix
Opens FileSearchWindow  with FileMask  '*'
Opens a special window named Import Ascii File Information.
This window shows the number of all read data points = NCount.
Number of sensors is set to default 129
Number of conditions  is set to default 1
The number of points per condition will be calculated. If this number is odd => Error message. The user has to change the number of sensors or conditions until (Number of sensors*Number of Channels*Number of Conditions)=NCount
The Conditions-Channels-Time menu defines the ordering of Condition, Channel and Points given in the file.
If Number of Channels*Number of Points.*Number of Conditions=NCount
the user is allowed to choose one of these data sets and this data will be set to the given ActualData number in the MainWindow (top left button)

Ascii Header Matrix File
In this case the first ascii value in the ascii file defines the number of channels and the second the number of points.
The following (Number of Channels*Number of Points) value becomes the new data matrix .
If Ncount (number of all read data points)  > (Number of Channels*Number of points)--> Error message
If Ncount (number of all read data points)  > (Number of Channels*Number of points)+2--> Warning

Float32 Matrix
As with Ascii Matrix but Float32 binary data

Float32 HeaderMatrix
As with Ascii Header Matrix but Float32 binary data

Ascii Besa
Opens FileSearchWindow  with FileMask  '*.avr*'

MEG BTI Raw Ascii
Opens FileSearchWindow with FileMask  '*.raw'

(If any data file is imported without information about the sampling rate  (i.e. all imported matrices) the sampling rate value in the Plot2d menu window will be set automatically to 1. Change this value to the correct  sampling rate if known by typing the value in the sampling rate edit text menu (Plot2d menu figure)


File:Sensor Format

This command allows the sensor configuration to be selected.  The following types of sensor configuration are possibilities with this command.

Auto Axes
If no sensor location information is available or for a brief overview of the data choose this Sensor Format option.
The Plot2d Data figure will automatically be divided in a number of rows and columns showing all time courses using these axes. The use of surface methods (Plot3d) are not possible without information about the sensor locations.

MEG no sphere
.pmg ascii file from BTI
MEG on sphere
Opens  a .pmg ascii file and calculates the best fitting sphere for the sensor info. Given (if needed) and then projects sensor position onto this sphere.
BESA EEG
Number of sensors.elp filemask ascii file

EGIS
Not available at this stage

SCADS
No of channels. Ecfg binary file (SaveEcfg.m)

Cartesian Ascii
Header ascii file filemask 'cartascii.ecfg'.  No. of channels initial no. and number of rows second no. (cartesian format uses 3 x,y,z)

Spherical Ascii
Sperascii.ecfg filemask.  Header ascii file 2 possibilities 1 - 3 values, theta polar angle, phi azimutal angle, radius(defaults to 1 if radius not given).  Sphere of best fit is calculated and sensor position projected onto this sphere if radius is given.

Axes Ascii
To define the sensor axes positions  directly choose: Axes Ascii
The View will be set automatically to 'Top'.
x-position (left-right): Normalize axes positions between minimum and maximum of the first row of given ascii text file.
y-position (bottom-top): Normalize axes positions between minimum and maximum of the second row of given ascii text file.
Example: 129AxesAscii. sensor configuration.
The use of surface methods (Plot3d) are not possible without information about the sensor locations.

10/20 System
To choose electrode positions of the international 10/20 System select this menu.

10/10 System
To choose electrode positions of the international 10/20 System select this menu.

An extra window will be opened and the command given to select the order of channels in the data based on an assumed spherical head and standard 10/20 system placement (Terrence Lagerlund et  al. 1992) or Besa standard 10/10 system respectively.

The channel order has to coincide with the order in the data file, do not choose channels randomly.
After ordering the channels correctly select 'Apply'. The electrode file will be saved in SCADS binary, cartesian ascii and spherical ascii format (first filename needs to be nominated)
To change special positions that are not standard 10/20 or 10/10 positions edit the ascii files using an editor eg. word.
Use the Default file name 'NChan.ecfg' for SCADS format to use this as default.

For further details on sensor file formats
See File:Open Sensor File


File: Default File: Auto
Automatically sets nominated default values for individual files
If this feature is highlighted the program searches for a file with the name 'DataFolderName.udef' when a file is first opened. While DataFolderName is the name of the actual data file containing folder. If such a file does not exist the user is asked to open a file with the FileMask '*.udef' containing the wished View Default informations; Press escape' if you don't want to use any view default file.


File: Default File: Open
Opens the FileSearchWindow  with FileMask *.udef
Loads all given default information
See File: Default File: Save


File: Default File: Save
Stores all set values of
channels, time , amplitudes  and style information
in a file which has the FileMask *.udef
opened with the auto function when data next used with filemask.udef

File: Default File: Info
Shows the name of the View default file which is in use.


Style : Axes Width
Choose relative width of single sensor axes

Style : Axes Height
Choose relative height of single sensor axes

Style : Sensor line color
Using this feature its possible to display different sensors or sensor groups with different colors.
Flip Color Map flips the colormap if Line Color is a colormap' e.g. 'hsv, hot, cool'.

The colors are chosen based on the color map given in the Plot2d main menu window'Line Color'  (hsv, hot, cool etc.) .
The values used are:
      Use default vector => channel number
      Use number of trials vector =>  number of averaged trials
      Use Std vector => the mean standard deviation (if given)
      Use Channel Groups => channel groups (if given) colormap set automatically 'jet' and 'Line-Width' automatically '3 Act' in order to visualize channel groups

Use LineColor File
The assigned numerical values for different channels corresponding to colors on the color map could be imported using an ascii file in matrix format from the LineColor file (follow path ..Plot2dUtil: LineColor: options displayed [e.g 12Groups, VisualStdLineColor format]).
This option could be used to assign colors to groups of sensors or to highlight areas of particular interest.

Style : Text
The plot labels and additional information to be displayed may be chosen with this option.
To change more than one label choose the menu again and set the desired option.
(If Standard Deviation values are not given they will be set to 1).
(The color of Cursor Amplitudes is identical to the Actual File color).

Style : Zeroline
Display on/off and style (color and line style) of zeroline displayed

Style : Triggerline
 As above for Triggerline

Style : Cursorline
As above for Cursorline

Style : X-tick
Time intervals displayed on x-axis.

Style : Background Color
Choice of white or black.




Export: DataFile
This function allows the Actual Data Set to be exported in a variety of formats
E.g 	Export: DataFile: SCADS format
      Export: DataFile :SCADS format (for 10/20 format data)
      Export: DataFile :Ascii Header Matrix
      Export: DataFile :Ascii Besa
      Export: Datafile :Egis (not currently available)


Export: SensorFile
Function allows the exportation of the sensor configuration  in different formats:
E.g	Export: MEG BTI format
      Export: SensorFile :Besa (not currently available)
      Export: SensorFile: Egis (not currently available)
      Export: SensorFile :SCADS format
      Export: SensorFile :Cart. Ascii format
      Export: SensorFile :Spher Ascii format


Export: GP / RMS

To export GP / RMS values these values have first to be calculated using GP/RMS button in the MainWindowMenu

Export: GP / RMS :All Points
The calculated values will be exported to an ascii file. File name has to be given by user.

Export: GP / RMS :Cursor Points
GP/RMS Cursor exports only the cursor indicated on the x axis values to an ascii file.

Export: Userdata
Exports the least calculated values to either an ascii or a besa file.

Export: Userdata Info
States the nature of Userdata.


Calculate :Gradients
'All data sets' or 'actual data set' calculates the temporal gradient (gradient.m; difference from point to point) for all or just for the actual (given in actual data set menu) data set.

Calculate :Dipole Density (in progress; manual needs to be written)

Calculate :t-test (just SCADS format; under construction)
Asks for a batch file matrix containing average SCADS files (*.at*).
Paired: tests pairs of files (1 vs. 2; 3 vs .4, etc.)
Symmetry: tests for anterior-posterior or left-right asymmetry.
Absolute takes the absolute value (just positive; abs(data)) of the original data (positive and negative)

Calculate :Extreme Values
Calculates for each sensor absolute, relative or absolute of relative minimum, maximum or both in the chosen time/frequency/etc. interval.

Calculate :Absolute: The absolute maximum, minimum within the given interval. Absolute extreme values may be interval borders.

Calculate :Relative: All relative maxima, minima within a chosen interval. This calculation checks for a zero gradient. Thus, an interval border can not be a relative extreme value.

Calculate :Absolute of Relative: The absolute maximum, minimum across all relative maxima, minima.

Open identical files in actual file slot 1 and 2 and use one of the features for actual files as an example.

Using features of absolute extreme values the user may export extreme values and extreme indices (points) using the 'Export User Data' function. Please acknowledge that indices are given in points (~time, ~frequency ...) starting with the minimum interval point.
In case of maximum or minimum the first row writes extreme values, the second extreme indices for all sensors. In case of both four rows are exported. The first two rows are reserved for the maximum the third and fourth are used by the minimum values and indices.
Use 'Export Data File' function in order to export relative extreme values and indices.

Calculate : Wavelet (calls WaveApp.m)
Manual needs to be written

Calculate : X-Correlation
Manual needs to be written

Calculate :ProMax
Manual needs to be written

Calculate :VariMax
Manual needs to be written

Calculate : ICA
Manual needs to be written

Calculate :PCA
'All data sets' or 'actual data set' calculates PCA for all or just for the actual (given in actual data set menu) data set.

 'Original data set' calculates PCA based on the original loaded data set (independent of the currently visible data set)
'Actual data set' calculates PCA based on the currently visible data (and therefore based on the currently given time, frequency or PCA component interval)

Data matrix calculates PCA based on the given data matrix
Covariance matrix calculates PCA based on covariance matrix of the given data matrix
Correlation matrix calculates PCA based on correlation matrix of the given data matrix

(with choose of Domain: PCA (domain menu) the PCA of all original data sets will be calculated)

The PCA uses the Matlab program SVD:
[U,S,V] = SVD(X) produces a diagonal matrix S, of the same dimension as X and with nonnegative diagonal elements in decreasing order, and unitary matrices U and V so that X = U*S*V'.
The program calculates the variance vector (v) in the following form:
v = (diag(S)).^2/sum(diag(S).^2)

An additional figure widow will be opened. The left subplot shows the whole variance vector. The right one just the elements which are bigger than 0.01 (if all elements are bigger than 0.01 just one plot will be shown). Color and style of lines corresponds to the defined ones in the Plot2d main menu.

A second additional figure window will be opened displaying just the time courses (row vectors) of the matrix V which corresponding elements of the variance vector are bigger than 0.01. Color and style of lines corresponds to the defined ones in the Plot2d main menu.

If the given matrix X is of data matrix form (not of covariance or correlation matrix form) the matrix U will be shown in the Plot2d Data Figure changing the given domain to PCA. Color and style of lines corresponds to the defined ones in the Plot2d main menu. The minimum point will be set to its first component (the first row elements (channels)) In the same way trigger and cursor point will also be set to the first component. Since the number of rows of matrix U is equal the number of channels and the number of columns corresponds to the maximum number of PCA components (minimum of number of channels and given number of points (depending on the number of chosen points of visible interval (not the length of the interval in ms or Hz))) all data points corresponding to not existing components (components higher than the maximum number of PCA components) are set to zero (in future versions it will not be possible to choose such components).
The program calculates the significance levels (95% and 99%) for the matrix U based on the maximum number of PCA components and signs all channels which values of the given cursor component are higher ('significant') than theses levels (95%=>* and 99%=>**). The color of the stars corresponds to the defined colors in the Plot2d main menu.


Calculate :Polyfit
The Polyfit function finds the coefficients of a polynomial 'p(x)' of the given degree 'n' and fits the data 'p(x(i))' to 'y(I)' in a least square sense. The result 'p' is a row vector of length n+1 containing the polynomial coefficients in descending powers.
[i.e p(x)=p1x^n+ p2x^(n-1)+ p3x^(n-2)+...+pn+1];
The polyfit will be calculated using just the visible time interval (in the Plot2d Data figure) (not all time points). The whole data set must be made visible to use all values.
It is possible to export  the polyfit data matrix or the vector of the calculated polynomial coefficients  of each sensor using the Export UserData option (see Export; UserData).
At least the difference of the given data set and its polyfit will be plotted.
In this way it is possible to correct  drift artifacts using a degree of 1 (detrending).
Warning: Detrending should only be used on the base of the baseline interval.  Care must be taken using the whole epoch because the detrending could at least be based on real signal with a least square deviation different from zero. (e.g in the case of a large P300)



Calculate :Channel Groups
Open group file: Load a group matrix file with FileMask '.Ascii' (matrix file format) with first line the number of group and second line the sensor number. (See file '12Groups' in Plot2dUtil:Groups as an example).

Mean:		Calculates the mean over given groups of the given time interval.
		Use 'Export:User data'  to export this calculated data to file.

Sum:		Calculates the sum over given groups of the given time interval.
		Use 'Export:User data'  to export this calculated data to file.


Calculate :Egis session file:View Egis data

Calculate :Egis session file:Edit Egis data
if data format is an Egis session file this feature is enabled.
To scroll through the data trial- or view epochs use:View Egis data.
An extra window will be opened containing the following buttons:

Given: 		Shows the given Edit Status
red if bad
green if good
blue if questionable
white if not edited
Default:
(for future use; if an external edit vector is given)

>:		Scrolls to the next
good trial (if the 'Next Good' radio button is enabled)
bad trial (if the 'Next Bad' radio button is enabled)
questionable trial (if the 'Next ???' radio button is enabled)

<:		Scrolls to the last
good trial (if the 'Next Good' radio button is enabled)
bad trial (if the 'Next Bad' radio button is enabled)
questionable trial (if the 'Next ???' radio button is enabled)

>>:		Scrolls to the first
good trial (if the 'Next Good' radio button is enabled)
bad trial (if the 'Next Bad' radio button is enabled)
questionable trial (if the 'Next ???' radio button is enabled)
of the next cell.

<<:		Scrolls to the first
good trial (if the 'Next Good' radio button is enabled)
bad trial (if the 'Next Bad' radio button is enabled)
questionable trial (if the 'Next ???' radio button is enabled)
of the last cell.

To edit the data by trial groups manually use:Edit Egis data
Buttons:
As with the View Egis data option with the additional buttons:
Good Trial	sets the Edit value of this trial good
Bad Trial	sets the Edit value of this trial bad
??? Trial	sets the Edit value of this trial questionable

if the 'Auto Next' radio button is enabled the
next trial (if the 'Next Good' or the 'Next Bad' or 'Next ???'  radio button is not enabled)
next good trial (if the 'Next Good' radio button is enabled)
next bad trial (if the 'Next Bad' radio button is enabled)
next questionable trial (if the 'Next ???' radio button is enabled)
will be shown following the actual trial edition.


Calculate :Your Own: Actual Data Set
Opens the file ...Plot2d3d:Plot2dUtil: CalcUserFile.m
and does the given calculations just for the given actual file (cell)
If this calculation is not possible =>Error message

Calculate :Your Own: All Data Sets
Opens the file ... Plot2d3d:Plot2dUtil: CalcUserFile.m
and does the given calculations  for  all given files (cell)
If this calculation is not possible =>Error message

Reset Calculate: Your Own: Reset Actual Files
Sets Actual data back to the Actual  data which was given before the calculation carried out.

Calculate :Your Own: Reset All Files
Sets All data back to original status.

Calculate :Average:(Data set 1, Data set 2) => 3
Calculates the average of data set 1 and data set 2 and sets the result to actual file number 3.
Calculate :Average:(Data set 1, Data set 2) => 4
Calculates the average of data set 1 and data set 2 and sets the result to actual file number 4.

Calculate :Average: Use Standard Weight Matrix: (Data set 1, Data set 2) => 3
Calculates the average of data set 1 and data set 2 weighting each of the data points by using the given standard values and sets the result to actual file number 3.If no standard values are given all standard values are set to 1 and consequently  the weighting is meaningless.

Calculate :Average: Use Standard Weight Matrix: (Data set 1, Data set 2) => 4
Calculates the average of data set 1 and data set 2 weighting each of the data points by using the given standard values and sets the result to actual file number 4.If no standard values are given all standard values are set to 1 and consequently  the weighting is meaningless.

Calculate :Difference:Data Set 1- Data set 2 => Data set 3
Calculates the difference between Data Set 1 and Data Set 2 (Data set 1 - Data set 2) and sets the result to actual file number 3.

Calculate :Difference:Data Set 1- Data set 2 => Data set 4
Calculates the difference between Data Set 1 and Data Set 2 (Data set 1 - Data set 2) and sets the result to actual file number 4

Calculate :Difference:Data Set 2- Data set 1 => Data set 3
Calculates the difference between Data Set 2 and Data Set 1 (Data set 2 - Data set 1) and sets the result to actual file number 3.

Calculate :Difference:Data Set 2- Data set 1 => Data set 4
Calculates the difference between Data Set 2 and Data Set 1 (Data set 2 - Data set 1) and sets the result to actual file number 4.

Calculate :Absolute

Calculate :Absolute: Actual Data Sets
Calculates the absolute values of the actual file

Calculate :Absolute: All Data Sets
Calculates the absolute values of all files

Calculate :Filter
If a data set is available it is possible to

Calculate :Filter: Set filter file
set filter for high and/or lowpass filtering

Calculate :Filter: Save filter file
save filter coefficients in the file with filemask* int2str(NChan).hf for highpass or *int2str(NChan).lf for lowpass coefficients

Calculate :Filter: Open filter file
open filter coefficients in  file with filemask *int2str(NChan).hf for highpass or *int2str(NChan).lf for lowpass coefficients

Calculate :Filter: All files or Actual file.
filter the all or jsut the actual data set using the set or read filter coefficients

Calculate: Invert

Calculate :Invert : All Data Sets
Invert (Multiplication by -1) the values of All Data Sets

Calculate :Invert: Actual Data Set
Invert the values in the Actual Data Set

Calculate :Normalize
Normalizes  Actual Data Sets or All Data Sets in different ways:
      Between -1 and +1
      Between  0 and +1
      With std=1 and mean=0 (z-transformation)
or sets values
Absolute maximum of each data set to 1
Median across all absolute values of each data set to 1
Mean across all absolute values of each data set to 1

Calculate :Potential
Calculates integral or mean for each channel and each  file and shows the results in the command window.
The Integral is given in V x ms. ( the sum of all amplitudes in the chosen time interval multiplied by the sampling time (1000/SamplingRate) )
The Mean is given in V ( the sum of all amplitudes in the chosen time interval divided by the number of time points in this interval)
Transfer this data into text or statistics programs by:
      1. Using Export:User data and exporting these values to a text file.
2. Copy the values directly from the command window and paste it into a text or statistics program.

Calculate: Potential: Integral or Mean: Interactive
It is possible to choose one or more time intervals  interactively  in the command window
or by using a given file

Calculate :Potential:Integral or Mean:File
In  this case the given time intervals in the file ...: Plot2d3d:Plot2dUtil: Intervals:IntegralInterval.txt will be used.

Calculate :Potential:Integral or Mean:Default
uses the last given intervals
Important:
The time values have to be given in time points counting from the begining of data set and not in ms counting from trigger. The intervalls  may be different from the intervall which is given in the main window.

Calculate : Rereference
Rereference all files (or Cells) (using All files) or just the working file (using Actual file) using a different reference channel.  The program shows the time course of the new reference in an extra window.
If the user chooses Special, a new window will be opened in which the new reference channel or channels can be chosen. If the user chooses more than one channel the average of these two channels are used. (Linked ears uses the average of both mastoids)

Calculate: Sampling
If enable is 'on' a change of the 'Sampling rate' value in the main edit window results in a calculation of the given data sets on the base of the new sampling rate using 'interp1.m'.
If enable is 'off' a change of the 'Sampling rate' value in the main edit window does not down- or upsample the data. Just the timing will be changed.
(If any data file is imported without any information about the sampling rate, this value will be set automatically to 1000. Change this value to the correct sampling rate if known.)
=> If the user samples first down and then up using the same factor the result will not be identical to that before the sampling as information is lost with down sampling.
The other way round the result should be the same as before

Calculate : GP/RMS
see Calculate :Potential
The only difference is that GP or RMS values are used.
Important: The user has to calculate GP/RMS first.

Calculate: Symmetry
Compute a measure of symmetry for every column of a given data matrix, when a list of
pairs of channels is provided.
Depending on 'NormFlag', this measure is either the sum of differences of absolute values at corresponding sensors divided by norm of the data vector ('Abs.'), or the sum of differences of the values at the corresponding sensors, divided by the norm of the data vector ('Sign.'), or the sum of differences of the values at the corresponding sensors, each divided by the sum of the absolute values at the corresponding sensors ('Lat' => Lateralization Index) or the same as 'Lat' but after a z-normalization  of the data matrix ('Norm. Lat.') or the same as ('Norm. Lat.') but the sum of the absolute differences of the values at the corresponding sensors which always results in a positive symmetry index.
Program: 'CalcSymmetry.m'

The resulting symmetry courses as the used pairs will be plotted in an extra window.
To export the symmetry data use 'Export: User Data'

Get Pairs:	The user has to open an ascii file with given pairs of the chosen sensors configuration. Look at Plot2dUtil: SymmetryPairs :129LateralSymPairs as an example of 59 given pairs of the default 129 channel configuration to calculate  a kind of lateralization  between left and right hemispheres.
Set Pairs: 	If the pairs are not given the user could  prepare the pairs in any text file (please use the upper example) or choose a number of pairs interactively from a special sensor configuration window . If the user does the Set Pairs menu he/she is asked for a file name in which the pairs will be stored.

Calculate: Grand Mean
Calculates the grand mean over all files the user has to choose and set it to the Actual file.
The user has to choose one file first to set the plot variables. If the plot of this file is completed the user will be asked for the second file. Choose this and continue with all files you want to add to the grand average. If you have chosen the last file stop adding with 'Cancel'.
At this stage calculation of Grand Average is only available
with
'AsciiBesaVec'
'AsciiHeaderVec'
or 'SCADS' file format.

Calculate: Rotate Sensor Config.
If a sensor configuration is already set(using 'File:Open Sensor File') it is possible to rotate the configuration around the x,y or z axis. To do this input the the required values in degree and press 'Apply'. The rotation follows the right hand rule: Put the thumb of your right hand in the direction of the axis. (x=> from center to right ear, y=>from center to nose, z=>from center to vertex). The direction of the rotation corresponds to the curvature of the fingers of this hand.
Example: A z-rotation of -90 degrees rotates a nasion sensor towards the right ear. A positive rotation value leads to a counterclockwise rotation. (To save this electrode configuration and use  it in the following processing press save. The new rotated configuration will be saved in SCADS format using the filemask 'Rot 'Nchan'.sensor configuration. If you want to save it in a different sensor file format also please use 'Export:Sensor File'. Important: As long as you have not pressed 'Save'Plot2d will not use the new rotated configuration.

Calculate:
Sets all data back to the data, which was given before the calculation has been done. Reset files to previous ones

View:Negativ:Up or Down
Defines the view in the main window. .

Synthetic: Generates synthetic data (manual still under construction)
Opens a new menu figure named: Synthetic data menu (calls GenSynthData.m)
Actual dipole (like actual data set in Plot2d menu)
All changes of position, moments etc. concerns to this chosen dipole.
To get an additional dipole choose More.
The default position is [0 4 6]. The default dipole moment is [0 0 1].
To reject the last dipole choose Less.

The synthetic menu starts with two default dipoles of 100 points of time:
Dipole 1:	Position [-4 0 6] and the cartesian dipole moment [0 1 0]. The default pattern is of Cosinus style with a frquency of 1 and a phase shift of zero.
Dipole 2:	Position [+4 0 6] and the cartesian dipole moment [0 1 0]. The default pattern is of Sinus style with a frquency of 1 and a phase shift of zero.

X direction from left ear to right ear
Y direction from posterior to anterior
Z direction from inferior  to superior

You could change position, moments of the actual dipole using the position text or slider menus.
The program double checks whether the chosen dipole position lays into the given sphere with an radius of 8.15 cm. Otherwise the old position would be taken.
The dipole moments could be chosen between -1 and 1 for each direction.
If spherical coordinates are chosen the polar angle is the one from inferior to superior (-1 from superior to inferior)
The positive azimutal angle shows counterclockwise looking from top to the x-y plane.
(if the position is right ear the moment shows from posterior to anterior)
(if the position is the nasion the moment shows from right to left)
(if the position is left ear the moment shows from anterior to posterior)
(if the position is the inion the moment shows from left to right)

Pattern Style:

Linear: 		The pattern (time course) of the actual dipole strength is constant (1) across time.

Cosinus:	The pattern of the actual dipole strength is a cosinoidal function with the frequency given in the frequency text edit menu (default is 1 for both default dipoles) and the phase given in the phase text edit menu (default is 0 for both default dipoles).

Sinus:		as Cosinus but sinoidal function. Sinus with a phase of zero is of course the same as pattern style Cosinus using a phase of 180 degrees.
Interactive: 	An extra window will be opened (x-axis depends on the number of given data points, y- axis from -1 to 1) and the user has to choose amplitudes of the actual dipole moment at a number of time points (minimum 4) using the mouse and click anywhere in the given figure. Stop the interactive choice of specific amplitudes by clicking anywhere right from the maximum given time point. Now the program calculates a cubic spline fit of the given amplitude values.

File: 	Using this feature you could open an ascii header matrix format file (look for file format for further informations on this file format) containing the number of chosen time points in this menu (points of time (100 is the default value)) rows and one or three columns. If the file contains a different number of rows or columns the user gets an info and the execution of the program stops. If the file contains just one row this vector of values will be used to configurate the time course of the dipole strength for all given three directions. Therefore the dipole will be stable in direction over time. If you would use three rows the first row will configurate the time course of the first dipole moment tripel (x- direction or theta direction (depending on the chosen coordinate flag (cartesian or spherical)) the second row will configurate the y- or azimutal direction etc. If the given three vectors are not identical the dipole will change its direction (rotate) over time. Example:	Use the file YZDipRot_100_3 to rotate a dipole in the yz plane one full turn in 100 points or time (choose number of points 100 and choose Pattern Style: File to open this file, please do not the dipole moment factors have to be of cartesian type (to rotate in the given plane) and all moment factors have to be set to one(change the y or and z moment factors to -1 to change the start and rotation direction). This file was calculated using:

      DipMom=zeros(100,3);
      DipMom(:,2)=cos(linspace(-pi,pi))';
      ipMom(:,3)=sin(linspace(-pi,pi))';

Number of points and sampling rate defines these values in the Plot2d menu.
Number of trials:	 The program calculates the average and the standard deviation over the given number of trials with constant signal but variable noise. (The random matrices as described below change from trial to trial; if both 'noise to signal ratios' are zero the calculation does of course not make sense.).

Uncorrelated or correlated noise: 	Choose a 'noise to signal ratio' between 0 (no noise) and 10. If the radio button 'Mean Noise' is enabled the 'noise to signal ratio' is an average value over the whole time interval and can vary over time. If 'Mean Noise' is 'off' the 'noise to signal ratio' is constant across time. (With zero signal the 'noise to signal ratio' is not defined => If the whole signal is zero at one time point or over the whole period the noise at this time point or over the whole period is set to zero.).

Uncorrelated noise is based on a random matrix with number of channels rows and number of time points columns, chosen from a normal distribution with mean zero and variance one.
Correlated noise is based on the random activation of 22 synthetic sources positioned on a 'bucky ball' with a radius of 6 cm. The activation of the sources is based on a random matrix with 66 rows (three for each source orientation) and number of time points columns, chosen from a normal distribution with mean zero and variance one.
The Add dipoles radio button calculates the sum of the potentials if EEG (fields if MEG) of all given dipoles (in the actual dipole menu). Otherwise just the potential or field of the actual dipole would be used. These single or sum potentials (or fields) are also used with averaging.

Use the default dipoles as an example:
Press Apply.
The potential of the first given dipole will be set to the first data set of the plot2d menu.
Choose the second data set of the actual data set menu in the Plot2d menu.
Choose the second dipole in the actual dipole menu and press Apply.
The potential of the second given dipole will be set to the second data set of the plot2d menu.
Choose the third data set of the actual data set menu in the Plot2d menu.
Press the Add dipoles radio button and press Apply.
The sum of the potentials of the first and second given dipoles will be set to the third data set of the plot2d menu.
Press surface in the plot2d menu.
Choose the first data set as actual data set in the Plot3d menu.
Compare the distributions of scalp potential, CSD, intracranial potential estimation and the different shells of the L2 Minimum Norm solution for this data set.
Change the approximation value using a factor of 10 and 0.1.
Do the last three steps using the remaining two data sets.
Change time courses, dipole positions and moments or import your own dipole moment time courses to get more complex synthetic data sets.
To compare EEG with MEG take the same dipole configuration once with an EEG sensor configuration (i.e. 129 channel set (129.ecfg)) and then using a MEG sensor configuration (i.e. 148sph.pmg, choose sensor format to 'MEG on sphere' for this file because in this case the scalp potential distribution etc. Are also available (otherwise you could just compare the L2 Minimum Norm results)). Please do not forget to switch to MEG data format using the EEG/MEG button in the plot2d menu (otherwise the program would take the sensor positions as EEG although the sensor file format is MEG).

5.2 UIControls

Surfaces:
Several shortcuts for Surface calculations (see below)


Actual File:
 Sets the chosen file to actual.

Visible:
Off sets all data sets of chosen sensor invisible.  Press once more to make them visible. Invisible sensors will be extracted of all further analysis (Global Power, Surfaces, Stats etc.)

Visible Act:
Off sets only actual set chosen sensor invisible.  Press once more to make them visible.
Invisible sensors will be extracted of all further analysis (Global Power, Surfaces, Stats etc.)

LineColor:
Choice of Color of the actual file; if a color map is used please look for Style:Sensor line color in the top menu in this manual
Default for LineColor: 1 red, 2 blue, 3 black and 4 green

LineStyle:
Choice  of Linestyle  of the actual file
Default  for LineStyle is solid.


LineWidth:
Choice of LineWidth  of the actual data set (Act) or all data sets (All)
Settings will be used by 'Global Power Plot', 'Butterfly Plot' and 'Zoom Sensor Plot'


Visible Set:
Off sets all sensors of the actual data set invisible. Press once more to make them visible.

Clear Set:
Clears the actual data set (cell)  (does not delete not the original file but only the imported data matrix).

Zoom Sensor:
Mouse (is only possible  in Matlab4 because of a bug in ginput.m using Matlab5)
After choice of Zoom channel use the mouse to zoom special channels. This channel will be shown in an extra window.
Channel Name: Choose the channel you want to zoom. This channel will be shown in an extra window.

Surfaces:
Launches the Plot3d (Plot3d.m) part of the program containing the features:
Scalp potential/magnetic field interpolation
Laplacian of scalp potential/magnetic field interpolation
Intracranial scalp potential/magnetic field estimation
L2-Minimum-Norm estimations
Export of batch file calculation. (Sensors, Regions, Dipole Indices, time points or time intervals of interest. This Manual is under construction.

EEG/MEG Status:
Changes EEG/MEG Status to either EEG or MEG

View:
Top: View from top at elctrodes which  Z-value is bigger than 0 (nose to top).
Left: View from left (nose to left) at electrodes which  X-value is smaller than 0.
Right: View from right (nose to right) at electrodes which  X-value is bigger than 0.
Front: View from front (right ear to left) at electrodes which  Y-value is bigger than 0.
Back: View from back (right ear to right) at electrodes which  Y-value is smaller  than 0.
Norm (default): All electrodes are visible.

It is possible to set the positions of the time axes directly:
Choose To View in View menu
Choose the menu: File:Electrode File Format:Cart. Ascii (set the electrode format  to ascii)
Choose the menu: File:Open Electrode File
and choose the file  ...:Plot2d3d:Plot2dUtil:Box129CartAscii.ecfg

Look at this file (Box129CartAscii.ecfg ) to understand the format:
First column : x-axes runs from 1 to 10
Second column: y-axes runs from -1 to -14 (because  the channel with biggest  y-value  is set to top)
The third column does not matter (but has to be set to a value) because the view is set to Top.
In this way every user is able to create his own axis positions.


Domain:

Time (default): Shows data in time domain
Std: Shows the given data of standard deviation (if this info is not given all std values should be zero)
Power FFT: Shows power spectra of data in frequency domain
Amp. FFT: Shows amplitudes of spectra in frequency domain (sqrt(real^2+imag^2))
Phase FFT: Shows phase of spectra in frequency domain (arctan(real/imag))
PCA: Manual needs to be written
Wavelet Ampitude: Manual needs to be written
Wavelet Phase: Manual needs to be written


Min. Amp; Max. Amp:
Defines the visible interval of amplitudes

Adjust:
Adjusts visible interval of amplitudes to minimum and maximum values across all visible data.

Center:
Centers the visible interval of amplitudes

+/- 1:
Shows and changes the fast amplitude change value:

+ :
 Increases the given maximum with the given fast amplitude change value

- :
Decreases the given minimum with the given fast amplitude change value

+/- :
 Both

View:
Inverts the view: Negative Up or Negative Down.

<:
Decrease visible minimum or/and maximum (depending on +/-1)

>:
Increase visible maximum or/and minimum (depending on +/-1)

<<:
Decrease amplitude change value using a factor of 10

>>:
Increase amplitude change value using a factor of 10

Min. Time; Max. Time:
Defines the visible interval in time. Choose the time interval in ms from the given trigger point. Example: Data matrix with 500 points in time and a sampling rate of 250: The trigger occurs at the 100th point  counting from the beginning of file.
If the user would set Min. Time to zero, the first visible point of time is the trigger point.  If the user would set Min. Time to -100, the first visible point of time is the 75th point of the data matrix. The time  in ms are rounded to the next possible data point. In this example 1 or 1.9 would be rounded to zero, 2 and 3.1 would be rounded to 4 ms.

TriggerPoint:
Defines the trigger time. This point has to be given in absolute number of points counting from the beginning of the file. (not in ms)

Cursor Time:
Defines the cursor time. This time has to be given in ms from the trigger time. (compare with Min. Max Time)

Min. Baseline, Max. Baseline:
Defines the interval used for baseline correction. This time has to be given in ms from the trigger time. (compare with Min. Max Time)
If Min. or Max. Baseline are set: This does not mean that the baseline correction is done.

Calc. Baseline radio button:
Switch the radio button of baseline correction on to do the calculation. Switch the radio button off to get the original uncorrected data

Total Interval (shortcut):
 Calculates baseline across whole time interval

Sampling Rate:
look at: Calculate:Sampling

Number of points:
Shows the number of points of the actual data set.
This could change if using down- or up- sampling in the 'Calculate:Sampling' top menu

GP/RMS:
Calculates Global Power of visible files (cells) and plots them in an extra window


or Root Mean Square



M is the number of sensors
is the electrical  potential  or magnetic field of the sensor j at the point of time t.

Use the lowest menu button in this window to switch between RMS or GP.
The line style is identical with the line style in the main window.
The trigger time point is identical with the trigger time point  in the main window.
The baseline correction t is identical with the main window baseline correction.

The user could use Std weight to use the Std data to weight the channels  while calculating  the Global Power

or the Root Mean Square
.
If no Std data is available they are all set to 1. Consequently a weighting does not alter the data.


Butterfly:
Plots all visible channels of the main window in one extra window. Invisible time courses in the main window are also invisible in this extra window.
Linestyle, time intervals, baseline correction amplitudes etc. are identical with the given data in the main window.

Surf Matrix:
Surfs the Main Window  channels  in an extra Surf Data Matrix Window. Each Cell (File) will be surfed in a special subplot

Info:
Gives information about linestyle and names of all files (and/or number of cells).


Clear All:
Clears all given data.


Close All:
Closes all open Matlab windows except Command window.
Attention!! Closes also windows of different Matlab programs e.g. SPM


XCorrChan:
For your own purpose. Editing in Plot2d

MedVec (SCADS only) :
Plots information about single trial medians calculated in AvgApprox.m




6. 3d visualization

A new Plot3d Menu will open. This 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 Plot3d saves calculated leadfield coefficients in the Plot3dCoeff40 as well as Plot3dInvCoeff folder. Prior leadfield calculation Plot3d 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 Plot3dInvCoeff 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.

6.1 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 (=> Plot3d: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 'Plot3d: Use file matrix' menu otherwise all (or the) data set(s) given in the menu 'Plot2d: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 'Plot2d: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 => 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 Plot3d 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 'Plot3d:File:Use file matrix' is marked) or given in the 'Plot2d:Actual Data Set' menu (if the menu 'Plot3d: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 'Plot2d:File:Data Format' menu (right now only the 'SCADS', 'Egis averaged' and 'Egis grand average' formats are supported). If the 'Plot2d:Calc. Baseline' radio button is 'on' the data sets will be baseline corrected using the in Plot2d given baseline interval. Please remember that all calculations depend on the selected lambda approximation value given in the Plot3d 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 'Plot2d: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 Plot3d 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 Plot2d) 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 Plot3d 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 Plot2d (domain 'time') is identical with the RMS of Plot3d (method 'scalp') without use of approximation. Using approximation the 'RMS' of Plot3d is always smaller than the 'RMS' of Plot3d (not approximated).

Calculate:Min. Norm => File
Calculates the L2-minimum-norm absolute values (not the orientations; please compare with the 'Plot3d: L2.-Min.-Norm' Menu) of all data sets which are either given in the file matrix (if the menu 'Plot3d:File:Use file matrix' is marked) or given in the 'Plot2d:Actual Data Set' menu (if the menu 'Plot3d: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 'Plot2d:File:Data Format' menu (right now only the 'Scads', 'Egis averaged' and 'Egis grand average' formats are supported). If the 'Plot2d:Calc. Baseline' radio button is 'on' the data sets will be baseline corrected using the in Plot2d 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 Plot3d figure menu. Using 'Min. Norm => File:Use channel groups' the program calculates the average over all channels given in the channel group file (Use 'Plot2d: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 Plot3d 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 Plot2d) 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 Plot3d 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 Plot2d Menu to do this) .
Attention:	Take care if you calculate the absolute values in Plot2d 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 Plot2d version and plot this difference using Plot3d (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 Plot2d to the second data set and press Get2dData in the Plot2d 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.



6.2 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 Plot2d

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 Plot2d

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 Plot3d 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 'Plot2d'. Using this button its possible to switch between the data sets given in Plot2d. Adding or changing data sets in Plot2d does not automatically add or change data sets in Plot3d. Use 'Actual data set' in Plot3d in order to actualize the given data sets.
??

??

??

??

1	plot2d manual	8.2004.
