|
|
# Modify the dest.txt
|
|
|
Inform AnyWave your plugin will handle command line options.
|
|
|
Add the line:
|
|
|
````
|
|
|
flags = CanRunFromCommandLine
|
|
|
````
|
|
|
Note that you can set several flags separating them by '**:**'
|
|
|
|
|
|
# Specify the command line parameters your plugin will handle
|
|
|
The plugin will receive all the default command line options handled by AnyWave but if you need to handle your own options then you must provide a file called **args.json** and put it along with desc.txt file in the plugin's folder.
|
|
|
Example of a plugin that will handle the options **eeg_file** (path to a EEG data file) and **meg_file** (path to a MEG data file):
|
|
|
````json
|
|
|
{
|
|
|
"Parameters" : [ "eeg_file", "meg_file"]
|
|
|
}
|
|
|
````
|
|
|
|
|
|
# Folder contents
|
|
|
Example of plugin folder contents compatible with BIDS pipeline (or command line execution more generally)
|
|
|
![image](uploads/b7ab2969759d292e3a89bfc596f71489/image.png)
|
|
|
|
|
|
# Handle options in your code
|
|
|
````matlab
|
|
|
function main(varargin)
|
|
|
% init function will give you back a struct filled with all you need:
|
|
|
args = anywave('init', varargin);
|
|
|
% test if command line option are set (if not we are running in normal GUI mode)
|
|
|
eeg_file = '';
|
|
|
if isfield(args, 'eeg_file')
|
|
|
% we are running in command line mode/bids pipeline
|
|
|
eeg_file = args.eeg_file;
|
|
|
else
|
|
|
% open Dialog box to get the file
|
|
|
eeg_file = uigetfile('...');
|
|
|
end
|
|
|
end
|
|
|
````
|
|
|
|
|
|
# Avoid figure and guis
|
|
|
If you want the plugin to be run as a BIDS pipeline you must not stop the execution asking for a confirmation of by displaying a Dialog Box showing errors.
|
|
|
|
|
|
# Tips about logging errors
|
|
|
The command line option output_dir will always be set by AnyWave either by the pipeline itself or by default.
|
|
|
Write a log.txt file for example in that location and report all logs for your plugin in that file.
|
|
|
|
|
|
# Call your plugin using the command line
|
|
|
If you want to run your plugin outside of BIDS Pipeline context:
|
|
|
````bash
|
|
|
anywave --run my_plugin --eeg_file <path to eeg> --meg_file <path to meg>
|
|
|
````
|
|
|
|