Difference between revisions of "AnyWave:H2"

From WikiMEG
Jump to: navigation, search
(A script example)
(A script example)
Line 10: Line 10:
 
For each data sets, we saved a montage and a marker file along with the data file.<br />
 
For each data sets, we saved a montage and a marker file along with the data file.<br />
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
var h2 = anywave.getProcess("H2");
+
// all AnyWave methods or properties are accessible from the anywave object.
if (h2) {
+
var h2 = anywave.getProcess("H2"); // Here we ask anywave for the H2 plugin object.
// set process parameters
+
if (h2) { // If the plugin is availablen do the computation
 +
// set process parameters. All the parameters are specific to the H2 plugin.
 
h2.windowSize = 4;
 
h2.windowSize = 4;
 
h2.step = 2;
 
h2.step = 2;
Line 19: Line 20:
 
h2.matlabFile = "H2output_HP15Hz_LP45Hz";  // defines the Matlab base file name.
 
h2.matlabFile = "H2output_HP15Hz_LP45Hz";  // defines the Matlab base file name.
  
// set files as input
+
 
var fi = anywave.getFileInput();
+
// set files as input (montage and marker files to use)
 +
var fi = anywave.getFileInput(); // get the anywave file input object
 
// only take .eeg files as input
 
// only take .eeg files as input
fi.addFileExtension("*.eeg");  
+
fi.addFileExtension("*.eeg"); // here we set all the .eeg to be used as data sets.
 
// Define a base folder where to look for data. All sub folders will be explored.
 
// Define a base folder where to look for data. All sub folders will be explored.
 
fi.setRootDir("d:\\data\\H2");
 
fi.setRootDir("d:\\data\\H2");
// Defining how to filter data before processing them.
+
// Defining how to filter data before processing them. Here we filter SEEG channels only.
 
fi.setFilters("seeg", 45, 15);  
 
fi.setFilters("seeg", 45, 15);  
 
// run the H2 process on data
 
// run the H2 process on data
 
anywave.runProcess(h2, fi);
 
anywave.runProcess(h2, fi);
 +
        // Change filter options and rerun the H² process
 
fi.setFilters("seeg", 0, 15);  
 
fi.setFilters("seeg", 0, 15);  
h2.matlabFile = "H2output_HP15Hz";
+
h2.matlabFile = "H2output_HP15Hz"; // change the output matlab file to reflect the filter options
anywave.runProcess(h2, fi);
+
anywave.runProcess(h2, fi); // run the plugin again.
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 10:22, 27 March 2017

How to use the plug-in

How to script the H² computation

AnyWave allows to script some compatible plug-ins (and H² is compatible) in order to batch the computations of several data sets.
The script file is a JavaScript file that will be executed by AnyWave this way:
Execute script.png

A script example

In our example, we have to compute the H² on three data sets. We first have to select the channels, and one or more time selections for these channels.
To do so, we previously prepared a montage file (that will inform about what channels to use in the computation) and for each data set we also prepared a marker file containing the time selections.
For each data sets, we saved a montage and a marker file along with the data file.

// all AnyWave methods or properties are accessible from the anywave object.
var h2 = anywave.getProcess("H2"); // Here we ask anywave for the H2 plugin object.
if (h2) {  // If the plugin is availablen do the computation
	// set process parameters. All the parameters are specific to the H2 plugin.
	h2.windowSize = 4;
	h2.step = 2;
	h2.maxLag = 0.1;
	h2.saveToMatlabFile = true;  // process will output data to Matlab file.
	h2.matlabFile = "H2output_HP15Hz_LP45Hz";  // defines the Matlab base file name.
 
 
	// set files as input (montage and marker files to use)
	var fi = anywave.getFileInput(); // get the anywave file input object
	// only take .eeg files as input
	fi.addFileExtension("*.eeg"); // here we set all the .eeg to be used as data sets.
	// Define a base folder where to look for data. All sub folders will be explored.
	fi.setRootDir("d:\\data\\H2");
	// Defining how to filter data before processing them. Here we filter SEEG channels only.
	fi.setFilters("seeg", 45, 15); 
	// run the H2 process on data
	anywave.runProcess(h2, fi);
        // Change filter options and rerun the H² process
	fi.setFilters("seeg", 0, 15); 
	h2.matlabFile = "H2output_HP15Hz";  // change the output matlab file to reflect the filter options
	anywave.runProcess(h2, fi);  // run the plugin again.
}