Difference between revisions of "AnyWave:H2"

From WikiMEG
Jump to: navigation, search
Line 2: Line 2:
 
The plugin computes the connectivity between channels using h2/r2 algorithms.<br/>
 
The plugin computes the connectivity between channels using h2/r2 algorithms.<br/>
 
It will produce a .mat file containing the results. This file can be then processed either in MATLAB or by the Correlation Graphs plugin of AnyWave.<br/>
 
It will produce a .mat file containing the results. This file can be then processed either in MATLAB or by the Correlation Graphs plugin of AnyWave.<br/>
==Data input==
+
=Data input=
===channels===
+
==channels==
 
This plugin requires at least two channels as input.<br/>
 
This plugin requires at least two channels as input.<br/>
 
The user can select the channels of interest in the signal view before running the plugin.<br/>
 
The user can select the channels of interest in the signal view before running the plugin.<br/>
 
'''NOTE:''' if no selection exists when running the plugin then ALL the channels will be set as input: A warning prompt will ask you to confirm that.<br/>
 
'''NOTE:''' if no selection exists when running the plugin then ALL the channels will be set as input: A warning prompt will ask you to confirm that.<br/>
===markers===
+
==markers==
 
The user may also used markers to select the different part of data on which to compute.<br/>
 
The user may also used markers to select the different part of data on which to compute.<br/>
 
It is possible to run the plugin on selected markers or to use the Main GUI once the plugin has started to specify the data input.<br/>
 
It is possible to run the plugin on selected markers or to use the Main GUI once the plugin has started to specify the data input.<br/>
 
'''NOTE:''' if there is no suitable marker (either no markers at all or markers with no duration) then the plugin will compute on the whole data.<br/>
 
'''NOTE:''' if there is no suitable marker (either no markers at all or markers with no duration) then the plugin will compute on the whole data.<br/>
==How to run==
+
=How to run=
 
''Step 1 - Selected channels of interest'':<br/>
 
''Step 1 - Selected channels of interest'':<br/>
 
Before running the plugin, make sure you have selected the channels of interest.<br/>
 
Before running the plugin, make sure you have selected the channels of interest.<br/>
Line 23: Line 23:
 
* Running using the Processes menu of AnyWave.
 
* Running using the Processes menu of AnyWave.
 
* Running from the markers GUI.
 
* Running from the markers GUI.
===Run from the menu===
+
==Run from the menu==
 
[[File:h2Menu.png]]<br />
 
[[File:h2Menu.png]]<br />
===Run from markers===
+
==Run from markers==
 
Select the markers of interest in the widget, then right click and pick the plugin to run.<br/>
 
Select the markers of interest in the widget, then right click and pick the plugin to run.<br/>
 
[[File:LaunchUsingMarkers.png]]<br />
 
[[File:LaunchUsingMarkers.png]]<br />
  
===Main GUI===
+
==Main GUI==
 
[[File:H2GUI.png]]<br />
 
[[File:H2GUI.png]]<br />
 
<br/>
 
<br/>
Line 55: Line 55:
 
'''IMPORTANT''': If you dont specify markers to use, the plugin will use ALL the markers available (with a duration). <br/>
 
'''IMPORTANT''': If you dont specify markers to use, the plugin will use ALL the markers available (with a duration). <br/>
  
===Frequency bands===
+
==Frequency bands==
 
You can compute the connectivity on different frequency bands.<br/>
 
You can compute the connectivity on different frequency bands.<br/>
 
By default, the ''AnyWave band'' is selected which means the filter options set in AnyWave will be used.<br/>
 
By default, the ''AnyWave band'' is selected which means the filter options set in AnyWave will be used.<br/>
 
You can enable the different predefined bands and even change the frequency boundaries.<br/>
 
You can enable the different predefined bands and even change the frequency boundaries.<br/>
  
==Run in batch mode==
+
=Run in batch mode=
 
The plugin is able to run in batch mode.<br/>
 
The plugin is able to run in batch mode.<br/>
 
You will need to write a shell script and create a json file.<br/>
 
You will need to write a shell script and create a json file.<br/>
Line 111: Line 111:
 
| output_prefix || prefix of resulting file name || OPTIONAL || default is no prefix.
 
| output_prefix || prefix of resulting file name || OPTIONAL || default is no prefix.
 
|}
 
|}
===Example===
+
==Example==
 
using this json file:<br/>
 
using this json file:<br/>
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">

Revision as of 15:02, 9 August 2019

Purpose

The plugin computes the connectivity between channels using h2/r2 algorithms.
It will produce a .mat file containing the results. This file can be then processed either in MATLAB or by the Correlation Graphs plugin of AnyWave.

Data input

channels

This plugin requires at least two channels as input.
The user can select the channels of interest in the signal view before running the plugin.
NOTE: if no selection exists when running the plugin then ALL the channels will be set as input: A warning prompt will ask you to confirm that.

markers

The user may also used markers to select the different part of data on which to compute.
It is possible to run the plugin on selected markers or to use the Main GUI once the plugin has started to specify the data input.
NOTE: if there is no suitable marker (either no markers at all or markers with no duration) then the plugin will compute on the whole data.

How to run

Step 1 - Selected channels of interest:
Before running the plugin, make sure you have selected the channels of interest.
If no channels are selected before running the plugin, you will get a warning message. Computing on many channels can lead to long calculation as many pairs of channels must be considered.
Step 2 - Select data of interest:
Mark the data of interest with one or more markers.
It's a good practice to give the markers an explicit name.
Step 3 - Run the plugin:
There are two ways to run the plugin:

  • Running using the Processes menu of AnyWave.
  • Running from the markers GUI.

Run from the menu

H2Menu.png

Run from markers

Select the markers of interest in the widget, then right click and pick the plugin to run.
LaunchUsingMarkers.png

Main GUI

H2GUI.png

Computation parameters:
Change here the computation method (h² or r²) and the timing parameters.

Data input:
- Step 1 (OPTIONAL) : reduce computation time by downsampling the data.
By default the ratio is 1 meaning that no downsampling will be applied.
Change the ratio if you want to reduce computation time.

- Step 2 : skip AND/OR use markers (this section will be hidden if you have launched the the plugin using the markers).

Avoiding artefacted data (OPTIONAL):
Pick a marker name that matches an artefacted region in the data and click the skip button to add it to the main list of markers to avoid.
All the markers with that name will be skipped.
H2skipmarker.png

Using markers:
Pick a marker name that matches data region you want to use and click the Use button to add the name to the main list of markers to use.
H2usemarker.png

In our example we will compute the correlations on all markers named h2 avoiding markers named artefact that may overlapped the h2 markers.

IMPORTANT: If you dont specify markers to use, the plugin will use ALL the markers available (with a duration).

Frequency bands

You can compute the connectivity on different frequency bands.
By default, the AnyWave band is selected which means the filter options set in AnyWave will be used.
You can enable the different predefined bands and even change the frequency boundaries.

Run in batch mode

The plugin is able to run in batch mode.
You will need to write a shell script and create a json file.

See this section for more details

json settings for h2/r2:

{ 
"plugin" : "h2",
"algorithm" : "r2",
"time_window" : 4,
"max_lag" : 0.1,
"step" : 1,
"downsampling_factor" : 2,
"output_prefix" : "my_result"
}

Common options that can also be specified in the command line if you want to apply them to a specific file and not ALL the files:

key description default behavior
marker_file path to the .mrk file to use if not specified, AnyWave will try to locate the .mrk associated with the data file and use it.
use_markers array of marker labels to use optional but may required marker_file option.
skip_markers array of marker labels to SKIP (artefacts) optional but may required marker_file option.
hp high pass filter in Hz optional
lp low pass filter in Hz optional

H2 specific options:

key description requirement default behavior
plugin Name of plugin MANDATORY n/a
time_window the time window in s. MANDATORY n/a
max_lag maximum lag in s. MANDATORY n/a
step step in s. MANDATORY n/a
downsampling_factor downsampling data OPTIONAL default is 1. 2 means the sampling rate of the data will be divided by 2.
output_prefix prefix of resulting file name OPTIONAL default is no prefix.

Example

using this json file:

{ 
"plugin" : "h2",
"algorithm" : "r2",
"time_window" : 4,
"max_lag" : 0.1,
"step" : 1,
"downsampling_factor" : 2,
"output_prefix" : "my_result",
"use_markers" : [ "EI" ]
}

We will compute on a file stored in D:\Data\

anywave --run h2.json --input_file d:\data\data_file.eeg --marker_file d:\data\data_file.mrk --hp 1 --lp 45

This will compute compute r2 values for the file data_file.eeg using 1-45Hz frequency band only on data marked by EI markers.