Difference between revisions of "AnyWave:MATLAB Batch"

From WikiMEG
Jump to: navigation, search
(JSON Files)
(ui.json)
Line 19: Line 19:
  
 
==ui.json==
 
==ui.json==
This file will describe parameters needed by your plugin in order to run.<br/>
+
There are some impotant things to setup in ui.json file:<br/>
Use the following file as a skeleton for your needs:<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/>
We also adds two parameters, for data filtering.
+
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/>
 +
 
 +
Let's setup an example using one input file and two parameters:<br/>
 
<syntaxhighlight lang="java">
 
<syntaxhighlight lang="java">
 
{
 
{
Line 31: Line 39:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
===mandatory keys/values===
+
'''input_keys''' : mandatory key. Here, we setup only one input file, and the key is called "input_file".<br/>
There are some required keys:<br/>
+
Then we must describe that key:
'''input_keys''' : an array of string containing the key names of input files to be set by AnyWave.<br/>
+
* "Input File" is the name used in the GUI to describe the parameter.
in our skeleton, there is only one key, 'input_file'. This means you must also provide that key afterward in the json file.<br/>
+
* "check" indicates that the file MUST be a data file that AnyWave can read.
 +
'''fields_ordering''': mandatory key. Describe the GUI fields order. Here we set up HP before LP in the GUI.<br/>
 
<br/>
 
<br/>
let's have a look to our input_file key:<br/>
+
Between the mandatory keys, you have the other parameters:<br/>
The value is an array of strings:
+
* hp described as High Pass Filter, and "double" indicates this parameter is a double value.
* The first one is a Human Readable version of the key. This will be used in the AnyWave GUI.
+
* lp described as Low Pass Filter, and "double" indicates this parameter is a double value.
* 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.<br/>
+
Here, we set up hp to be first, and lp will follow.<br/>
+
This mean the GUI wil show the HP key first and then LP.<br/>
+
  
===parameters key/value===
+
Others possible parameter values:<br/>
Beside the two required keys, you can add a key/value pair for each parameter you need to use in your plugin.<br/>
+
In our example, we use lp and hp keys, for low pass and high pass filters.<br/>
+
The key must match the values in 'fields_ordering'.<br/>
+
The value must be an array of strings:<br/>
+
* 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===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-

Revision as of 16:15, 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

There are some impotant things to setup in ui.json file:
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.
This is done by creating the input_keys key.
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.
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.
Hence, AnyWave will bring a GUI to pick up all the files we want, and run our plugin on all those files.
Once you setup the FILES entries keys, you must also describe them in the file by setting two values to the corresponding key.
The first value is always the decorated readable name of the key that will be used to create the GUI.
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.

Let's setup an example using one input file and two parameters:

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

input_keys : mandatory key. Here, we setup only one input file, and the key is called "input_file".
Then we must describe that key:

  • "Input File" is the name used in the GUI to describe the parameter.
  • "check" indicates that the file MUST be a data file that AnyWave can read.

fields_ordering: mandatory key. Describe the GUI fields order. Here we set up HP before LP in the GUI.

Between the mandatory keys, you have the other parameters:

  • hp described as High Pass Filter, and "double" indicates this parameter is a double value.
  • lp described as Low Pass Filter, and "double" indicates this parameter is a double value.

Others possible parameter values:

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