AnyWave:CLI runPlugin

From WikiMEG
Jump to: navigation, search

AnyWave can also process data files, running a specific process (plugin) to a bunch of files or directories.
The keyword to do that kind of opteration is :
--run <plugin name | json file | json string>
To run a plugin, the user must set all the required parameters as well as input and output options.
The other requirement is that the plugin CAN run in batch mode.

List of compatible plugins

ICA CLI options h2 CLI options
EEGInto4D CLI options

Setup parameters and run a processing plugin

Processing a file relies on a specific plugin which need to be setup using specific parameters.
There are several ways to setup plugin parameters and run it:
1. use a json file to describe all the parameters.
2. use a json string to describe all the parameters.
3. use a plugin which declares its parameters.

Suppose we want to run a processing using a plugin named ProcessPlugin.
This ProcessPlugin requires two parameters, a time window (s) and a threshold value.
The expected parameters are : time_window, threshold.
If the plugin published its required arguments to AnyWave, you can do :

anywave --run ProcessPlugin --input_file d:\data\my_file.eeg --time_window 4 --threshold 0.3

Note the input_file common keyword that set the data file to be processed by the plugin.
If the command fails, you'd probably need to use the json way:
Create a parameters.json file as follow:

"plugin" : "ProcessPlugin",
"time_window" : 4,
"threshold" : 0.3

and use the command line:

anywave --run parameters.json --input_file d:\data\my_file.eeg

This way AnyWave will read the parameters from the json file and setup the plugin accordingly.
Note the you can also use the common keywords inside your json file:

"plugin" : "ProcessPlugin",
"input_file" : "d:\\data\\my_file.eeg",
"time_window" : 4,
"threshold" : 0.3

Although it does not make sense there to specify input_file, you can do it. You can also write down the json string on the command line after the --run keyword:

anywave --run "{ """plugin""" : """ProcessPlugin""", """time_window""" : 4, """threshold""" : 0.3 }" --input_file d:\data\my_file.eeg