Difference between revisions of "AnyWave:MATLAB Batch"

From WikiMEG
Jump to: navigation, search
(JSON Files)
Line 17: Line 17:
 
==JSON Files==
 
==JSON Files==
 
After you've modified the desc.txt you will need to create two json files and place them in your plugin folder.<br/>
 
After you've modified the desc.txt you will need to create two json files and place them in your plugin folder.<br/>
There are some impotant things to setup in ui.json file:<br/>
 
There is a key describing the input parameters of the plugin. Suppose that you want to compute something on several files, you must then set several input_keys in the json file.<br/>
 
This is done by creating the '''input_keys''' key.<br/>
 
This key will hold the names of all the other keys that must be considered as files that AnyWave will provide to our plugin when running it.<br/>
 
In our example below, there is only ONE file key, that we called input_file which is the default key name for the file argument.<br/>
 
Hence, AnyWave will bring a GUI to pick up all the files we want, and run our plugin on all those files.<br/>
 
Once you setup the FILES entries keys, you must also describe them in the file by setting two values to the corresponding key.<br/>
 
The first value is always the decorated readable name of the key that will be used to create the GUI.<br/>
 
The second value is a string. If you set "check" as the value, that will tell AnyWave to check that the file setup is a data file and not a side car file.<br/>
 
  
 
==ui.json==
 
==ui.json==

Revision as of 16:09, 30 March 2020

Introduction

One of the features of AnyWave is to run some processes in batch.
This means that you can use a dedicated GUI to program several processing on many files and execute all this processing
This feature is accessible from here:
Process batch processing.png

Make my plugin compatible

This is quite simple. First, you need to edit the desc.txt and add the CanRunFromCommandLine flag:

edit desc.txt

Note: you can also use the NoDataRequired if your plugin does not a file to be open in AnyWave to run.
In this case the flags line will be: flags = CanRunFromCommandLine:NoDataRequired

name = MyPlugin
description = do something in MATLAB
category = Process:Test:MyPlugin
flags = CanRunFromCommandLine

JSON Files

After you've modified the desc.txt you will need to create two json files and place them in your plugin folder.

ui.json

This file will describe parameters needed by your plugin in order to run.
Use the following file as a skeleton for your needs:
We also adds two parameters, for data filtering.

{
"input_keys" : [ "input_file"],
"input_file" : ["Input File", "check"],
"hp" : ["High Pass Filter", "double"],
"lp" : ["Low Pass Filter", "double"],
"fields_ordering" : ["hp", "lp"]
}

mandatory keys/values

There are some required keys:
input_keys : an array of string containing the key names of input files to be set by AnyWave.
in our skeleton, there is only one key, 'input_file'. This means you must also provide that key afterward in the json file.

let's have a look to our input_file key:
The value is an array of strings:

  • The first one is a Human Readable version of the key. This will be used in the AnyWave GUI.
  • the second value is "check" meaning that the file must be a file AnyWave can read (and a check will be done by AnyWave).

fields_ordering : an array of strings containing all the other keys in the order we would like AnyWave will show them in the GUI.
Here, we set up hp to be first, and lp will follow.
This mean the GUI wil show the HP key first and then LP.

parameters key/value

Beside the two required keys, you can add a key/value pair for each parameter you need to use in your plugin.
In our example, we use lp and hp keys, for low pass and high pass filters.
The key must match the values in 'fields_ordering'.
The value must be an array of strings:

  • the first value is the Human Readable name of the key, that will appear in the GUI.
  • the second value is the type of the variable. Here double means we want a numeric double value.

list of possible type values for parameter keys

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.

default.json

This file comes to se the default values for parameters described in ui.json.
So you need to define the same keys and set a default value for them.
In our skeleton that will be:

{
"input_file" : "", 
"hp" : 0.,
"lp" : 0.
}