Difference between revisions of "AnyWave:MATLAB Batch"

From WikiMEG
Jump to: navigation, search
(default.json)
(default.json)
Line 71: Line 71:
 
So you need to define the same keys and set a default value for them.<br/>
 
So you need to define the same keys and set a default value for them.<br/>
 
In our skeleton that will be:<br/>
 
In our skeleton that will be:<br/>
 +
<syntaxhighlight lang="java">
 +
{
 +
"input_file" : "",
 +
"hp" : 0.,
 +
"lp" : 0.
 +
}
 +
</syntaxhighlight>

Revision as of 14:55, 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

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.
}