AnyWave:MATLAB Batch GUI

From WikiMEG
Revision as of 08:55, 22 April 2020 by Bruno (Talk | contribs)

Jump to: navigation, search

Introduction

AnyWave can run plugin code using the command line as mentioned here: The Command Line Interface of AnyWave
That implies the user has to write his own shell scripts to accomplish that.
One alternative is to use the AnyWave built-in Batch GUI that allows to program your batch operations using a user friendly interface.
This features allows to run your batching operations within AnyWave, in the background with a monitoring of what it is done.
If we want our plugin to be processed using this feature we must make it compatible with AnyWave Batch GUI system.

Make my plugin GUI compatible

First, the plugin must be callable using the command line.
Reminder on how to do that: Make your plugin batchable

args.json

Remember, we have defined an arg.json file to describe the command line arguments we would like AnyWave to parse for us:

"parameters" : [ "eeg_file", "meg_file"],
"flags" : [ "use_downsampling", "vectorize_data"]

We must add several keys to the json file:

"parameters" : [ "eeg_file", "meg_file"],
"flags" : [ "use_downsampling", "vectorize_data"]
  "inputs": {
    "eeg_file": "any file",
    "meg_file": "any file"
  },
  "batch_ui": {
    "use_downsampling": [ "Downsampling data", "boolean" ],
    "vectorize_data": [ "Vectorize data", "boolean" ],
    "fields_ordering": [ "use_downsampling", "vectorize_data" ]
  },
  "batch_defaults": {
     "use_downsampling": false,
     "vectorize_data": false
  }

inputs

The inputs key describes the argument keys that will be set up with a file path as input for the plugin to process.
This is a special object telling AnyWave that the GUI should allow a file selection method to set up the files to be processed by the plugin using that particular keys.

batch_ui

the batch_ui key describes how the GUI will be setup. Here we defined an alias for each argument key and a type of value.
So batch_ui object must contain the argument keys and the values must be an array containing the alias in the UI and the value type.
The special key fields_ordering defines the order from top to bottom, where the arguments will appear in the GUI.

batch_defaults

The batch_defauls key describes the default values for each arguments we want to get in our plugin.
When specifying in batch_ui a value type of list, you must describe the list of possible values in batch_defaults using the same key name:

GUI/defaults

Complete list of possible value types to be used in batch_ui key (object):

value description
"double" double precision value
"int" integer value
"list" indicates we want a combo list selection among predefined item.
"string" string value
"stringlist" an array of strings.
"boolean" a boolean value.

Example based on ica plugin:

{
  "parameters": [ "modality", "comp" ],
  "flags": [ "infomax_extended", "skip_bad", "downsampling" ],
  "inputs": {
    "input_file": "any file"
  },
  "batch_ui": {
    "hp": [ "High Pass", "double" ],
    "lp": [ "Low Pas", "double" ],
    "comp": [ "Components", "int" ],
    "modality": [ "Modality", "list" ],
    "downsampling": [ "Downsampling data", "boolean" ],
    "skip_markers": [ "Avoid markers", "stringlist" ],
    "use_markers": [ "Use markers", "stringlist" ],
    "infomax_extended": [ "Infomax extended mode", "boolean" ],
    "skip_bad": [ "Skip bad channels", "boolean" ],
    "fields_ordering": [ "comp", "hp", "lp", "modality", "skip_bad", "downsampling", "infomax_extended", "skip_markers", "use_markers" ]
  },
  "batch_defaults": {
    "input_file" :  "File",
    "hp": 0,
    "lp": 0,
    "comp": 50,
    "modality": [ "MEG", "EEG", "SEEG", "EMG" ],
    "downsampling": false,
    "skip_markers": "",
    "use_markers": "",
    "infomax_extended": false,
    "skip_bad": true
  }
}

Note 1: You can use common arguments like hp, hp. The default inputs is always the key called input_file if no inputs are specified.
That means that the default behavior for a batch processing is to have ONE input file to process held by the input_file argument key.
Note 2: The list type will make a combobox list selection of items. Define the possible items in default.json file:
"modality" : ["MEG", "EEG", "SEEG"]