Difference between revisions of "AnyWave:MATLAB Batch GUI"
(→Make my plugin GUI compatible) |
(→inputs) |
||
(17 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
=Introduction= | =Introduction= | ||
− | AnyWave can | + | AnyWave can run plugin code using the command line as mentioned here: [[File:Menu_cli.png|400px|link=AnyWave:CommandLine|'''The Command Line Interface of AnyWave''']]<br> |
− | + | That implies the user has to write his own shell scripts to accomplish that.<br/> | |
− | + | One alternative is to use the AnyWave built-in Batch GUI that allows to program your batch operations using a user friendly interface.<br/> | |
− | + | This features allows to run your batching operations within AnyWave, in the background with a monitoring of what it is done.<br/> | |
− | + | If we want our plugin to be processed using this feature we must make it compatible with AnyWave Batch GUI system.<br/> | |
=Make my plugin GUI compatible= | =Make my plugin GUI compatible= | ||
− | + | First, the plugin must be callable using the command line.<br/> | |
− | + | Reminder on how to do that: | |
− | + | [[File:Menu_matlab_batch.png|400px|link=AnyWave:Plugin_Batch|'''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:<br/> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
− | + | "parameters" : [ "eeg_file", "meg_file"], | |
− | " | + | "flags" : [ "use_downsampling", "vectorize_data"] |
− | " | + | </syntaxhighlight> |
− | " | + | We must add several keys to the json file:<br/> |
− | " | + | <syntaxhighlight lang="java"> |
− | "fields_ordering" : [" | + | "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 | ||
+ | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ''' | + | ===inputs=== |
− | + | The '''inputs''' key describes the argument keys that will be set up with a file path as input for the plugin to process.<br/> | |
− | + | 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.<br/> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ===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.<br/> | ||
+ | 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.<br/> | ||
+ | The special key '''fields_ordering''' defines the order from top to bottom, where the arguments will appear in the GUI.<br/> | ||
+ | ===batch_defaults=== | ||
+ | The batch_defauls key describes the default values for each arguments we want to get in our plugin.<br/> | ||
+ | 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:<br/> | ||
+ | =GUI/defaults= | ||
+ | Complete list of possible value types to be used in batch_ui key (object):<br/> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 54: | Line 60: | ||
| "string" || string value | | "string" || string value | ||
|- | |- | ||
− | | " | + | | "stringlist" || an array of strings. |
+ | |- | ||
+ | | "boolean" || a boolean value. | ||
|} | |} | ||
− | + | Example based on ica plugin:<br/> | |
− | + | ||
− | + | ||
− | + | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
{ | { | ||
− | "input_file" : "", | + | "parameters": [ "modality", "comp" ], |
− | "hp" : 0 | + | "flags": [ "infomax_extended", "skip_bad", "downsampling" ], |
− | "lp" : 0 | + | "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 | ||
+ | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | '''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.<br/> | |
− | + | 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.<br/> | |
− | + | '''Note 2''': The list type will make a combobox list selection of items. Define the possible items in default.json file:<br/> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | '''Note''': The list type will make a combobox list selection of items. Define the possible items in default.json file:<br/> | + | |
"modality" : ["MEG", "EEG", "SEEG"]<br/> | "modality" : ["MEG", "EEG", "SEEG"]<br/> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 08:57, 22 April 2020
Contents
Introduction
AnyWave can run plugin code using the command line as mentioned here:
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:
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"]