|
|
[[_TOC_]]
|
|
|
|
|
|
# Introduction
|
|
|
This plugin allows for users to combine scripts into pipelines, and run a series of process all at once on a set of data files.
|
|
|
# Introduction
|
|
|
This EEGLAB extension provides an easy to use interface for generating script pipelines and executing them on multiple data files.
|
|
|
|
|
|
# Pipeline Basics
|
|
|
text
|
|
|
![PIPLELINE_CHART](/uploads/462408d7a3e809082e2bb8f8d2ee4504/PIPLELINE_CHART.png)
|
|
|
|
|
|
# Swap String
|
|
|
String swapping is an essential aspect of creating a well functioning pipeline. It works by writing the scripts filled with strings in [ ] brackets rather than values. The script will not be able to run on its own, but when using it in conjunction with the configuration file and the batch context plugin you can rapidly create unique .m scripts for each of your dataset files. You can also adjust the the script functions without permanently changing the code.
|
|
|
Below we have a .htb pipeline script that is looking for 5 swap string inputs 4 from the config file, and 1 from the dataset file name. The configuration swap string section should look like this:
|
|
|
```
|
|
|
[in_path],analysis/data/1_init
|
|
|
[low_bound],.1
|
|
|
[high_bound],30
|
|
|
[out_path],analysis/data/2_preproc
|
|
|
```
|
|
|
The swap string [batch_dfn] is special as it automatically takes its information from the loaded dataset files.
|
|
|
***
|
|
|
|
|
|
Please refer to Configuration]() for more information on how change your swap string values.
|
|
|
Continue to learn about how to place the [strings] in your scripts.
|
|
|
***
|
|
|
|
|
|
![strswapbasics](/uploads/0410ed896b2d2e37cb20a7b6b0c993e5/strswapbasics.png)
|
|
|
Now when these .m files are executed they will apply the script filters too each of the dataset files.
|
|
|
|
|
|
You can have any number of swap strings and for any type of variable, as the strings are swapped out for their values before the code is run.
|
|
|
:b: The swap strings for *s1_scalpart.htb*, the first script in the pipeline.
|
|
|
|
|
|
```matlab
|
|
|
%replace_string comments:
|
|
|
% in_fname_key = [in_fname_key] - key string for the input file..[batch_dfn,_,-1]_mrg.set
|
... | ... | @@ -19,7 +46,10 @@ This plugin allows for users to combine scripts into pipelines, and run a series |
|
|
% epoch_trim = [epoch_trim] - Percentage trim for confidence intervals during channel neighbour r criteria (10 = 5% top and bottom)
|
|
|
% min_gap_ms = [min_gap_ms] - Minimum time (ms) to allow between periods marked for rejection
|
|
|
```
|
|
|
|
|
|
## Looking into the Example Further
|
|
|
This is the code taken from the graphic above. As you can see the [strings] have been replace with the correct 'strings' or values.
|
|
|
**Loading Data Files:**
|
|
|
**Before string swap:** The strings [batch_dfn] and [in_path] are waiting to be replaced.
|
|
|
```matlab
|
|
|
%%LOAD DATASET...
|
|
|
disp('Loading set file: [batch_dfn]...');
|
... | ... | @@ -29,17 +59,19 @@ EEG = eeg_checkset( EEG ); |
|
|
disp('TIME TO: LOAD DATASET...');
|
|
|
toc
|
|
|
```
|
|
|
|
|
|
|
|
|
```matlab
|
|
|
%%SAVE IC DATA SET...
|
|
|
**After string swap:** You can see that the previous [batch_dfn] and [in_path] have been exchanged out for the correct unique strings.
|
|
|
```matlab
|
|
|
%%LOAD DATASET...
|
|
|
disp('Loading set file: datafile1.set...');
|
|
|
tic;
|
|
|
EEG = pop_saveset( EEG, 'filename','[batch_dfn,_,-1]_comp2.set','filepath','[out_path]');
|
|
|
disp('TIME TO: SAVE IC DATA SET...');
|
|
|
EEG = pop_loadset('filename','datafile1_mrg.set','filepath','analysis/data/1_init');
|
|
|
EEG = eeg_checkset( EEG );
|
|
|
disp('TIME TO: LOAD DATASET...');
|
|
|
toc
|
|
|
```
|
|
|
|
|
|
|
|
|
**Filling in Variables:**
|
|
|
**Before string swap:** The string [low_bound] is waiting to be replaced with a number.
|
|
|
```matlab
|
|
|
%%FILTER HIGH PASS...
|
|
|
disp('High pass filtering the data...');
|
... | ... | @@ -50,17 +82,38 @@ EEG = eeg_checkset( EEG ); |
|
|
disp('TIME TO: FILTER HIGH PASS...');
|
|
|
toc
|
|
|
```
|
|
|
|
|
|
**After string swap:** You can see that the previous [low_bound] has been replaced with a number .
|
|
|
```matlab
|
|
|
% remove comps manually
|
|
|
disp('REMOVE MARKS AND COMPS');
|
|
|
% remove marks
|
|
|
%%FILTER HIGH PASS...
|
|
|
disp('High pass filtering the data...');
|
|
|
tic;
|
|
|
EEG.setname='filtHP';
|
|
|
EEG = eeg_checkset( EEG );
|
|
|
disp('TIME TO: FILTER HIGH PASS...');
|
|
|
toc
|
|
|
```
|
|
|
|
|
|
%WAIT FOR SCROLL PLOT TO CLOSE...
|
|
|
uiwait;
|
|
|
## Building in Manual Steps
|
|
|
Running a pipeline with manual steps is also possible. In the example below the batch will automatically open the file and do a plot. It will then wait for the user to type in the *ms* time they would like to investigate. It then proceeds to open that time frame for inspection. Once the first plot is closed, the next .m file will run loading the next dataset.
|
|
|
|
|
|
```matlab
|
|
|
% LOAD DATASET FILE...
|
|
|
EEG = pop_loadset('filename','[batch_dfn]','filepath','[batch_dfp]');
|
|
|
EEG = eeg_checkset(EEG);
|
|
|
h1=figure; pop_timtopo(EEG, [-200 600], [100], 'ERP data and scalp maps of En');
|
|
|
ms = input('TYPE IN MS TO PLOT TOPO\n');
|
|
|
% Stops and waits for input
|
|
|
h2=figure;pop_topoplot(EEG,1, ms,'[batch_dfn],[1 1]' ,0,'electrodes','labels');
|
|
|
% Stops and waits until window is closed
|
|
|
uiwait(gcf);
|
|
|
% Proceeds to next data file
|
|
|
```
|
|
|
|
|
|
![PIPLELINE_CHART](/uploads/462408d7a3e809082e2bb8f8d2ee4504/PIPLELINE_CHART.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
text here
|
|
|
# Saving scripts (*.htb files)
|
|
|
|
... | ... | |