Tutorial 9: Select files and run processes

Authors: Francois Tadel, Elizabeth Bock, Sylvain Baillet

The Brainstorm window includes a graphical batching interface. With the two tabs Process1 and Process2 in the lower part of the window, you can easily select files from the database explorer and assemble a processing pipeline. Most of the operations available in the interface can also be executed this way, including everything we've been doing with Brainstorm so far.

On the other hand, some features are only available this way. It is the case for the frequency filters we will need for the pre-processing of our auditory recordings. This tutorial is a parenthesis to explain how to select files and run processes on them, the cleaning of the recordings will resume in the next tutorial.

Selecting files to process

The tab Process1 contains a empty box in which you can drag and drop any number of files or folders from the database explorer. The easier way to understand how it works is to try it.

Filter the files by name or comment

When you have lots of files in a folder, like multiple source reconstructions of time-frequency files for each trial, it is difficult to grab just the ones you are interested in. After selecting your files in the Process1 box, you can refine the selection by entering something in the Filter search box at the bottom-right of the Brainstorm window.

The options offered in the Filter menu are:

Running a process

[START FROM HERE]

  1. When you select a process, a list of options specific to this process is shown in the window.
    • To delete a process: Select it and press the Delete key, or the big cross in the toolbar.

    • With the "up arrow" and "down arrow" buttons in the toolbar, you can move up/down a process in the pipeline.
  2. Now add the following processes, and set their options:
    • Pre-process > Band-pass filter: 2Hz - 30Hz

      • In some processes, you can specify the type(s) of sensors on which you want to apply the process. This way you can for instance apply different filters on the EEG and the MEG, if you have both in the same files.
    • Extract > Extract time: 40.00ms - 49.60ms, overwrite initial file

      • This will extract from each file a small time window around the main response peak.
      • Selecting the overwrite option will replace the previous file (bandpass), with the output of this process (bandpass+extract). This option is usually unselected for the first process in the list, then selected automatically.
    • Average > Average over time: Overwrite initial file

      • Compute the average over this small time window.

      pipeline2.gif

  3. Save your pipeline: Click on the last button in the toolbar > Save > New... > Type "process_avg45".

Creating a pipeline

Saving/exporting a pipeline

The last button in the the toolbar offers a list of menus to save, load and export the pipelines.

Here is the Matlab script that is generated automatically for this pipeline.

Click on Ok, in the pipeline window. After a few seconds, you will see two new files in the database, and the "Report viewer" window.

Process: Select files with tag

You can get to the exact same result by adding the process "File > Select files with tag" before the process you want to execute, to keep only a subset of the files that were placed in the Process1 list. It is less convenient in interactive mode because you don't see immediately the effect of your file filter, but it can be very useful when writing scripts.

selectFiles.gif

To see the list of files that was selected by the process, you can open the report viewer (File > Report viewer). This lists the input files (all the files) and the final files (the selected files), with a summary of how many files where selected on the top.

selectReport.gif

After

This process is useless if it is not followed immediately by another process that would do something with the selected files. An application can be the deletion of some files, by adding the process "File > Delete files".

How to control the output file names

If you are running two processes with different parameters but that produce exactly the same file names and file comments, you wouldn't be able to select them with this process. But immediately after calling any process, you can add the process "File > Add tag" to tag one specific set of files, so that you can re-select them easily later.

Example: you run twice the time-frequency decomposition with different options on the same files, tag the files after calculating them with different tags.

addTag.gif

Report viewer

Each time the pipeline editor is used to executed to run a list of processes, a report is generated and saved in the user home folder (/home/username/reports/). The report viewer shows as an HTML page some of the information saved in this report structure: the date and duration of execution, the list of processes, the input and output files. It reports all the warning and errors that happen during the execution.

The report viewer does not necessarily appear automatically at the end of the last process: it is shown only when more than one processes were executed, or when any of the processes returned an error or a warning.

When running processes manually from a script, the calls bst_report(Start, Save, Open) explicitly indicate when the logging of the events should start and stop.

You can add images to the reports for quality control using the process "File > Save snapshot".

output.gif

After you close the report window, you can re-open the last report with the main menu of the Brainstorm window: File > Report viewer.

With the buttons in the toolbar, you can go back to the previous reports saved from the same protocol.

PROCESSES AND PLUG-INS

The available processes are organized in a plug-in structure. Any Matlab script that is added to the plug-in folder (brainstorm3/toolbox/process/functions/) and has the right format will be automatically detected and made available in the GUI. This mechanism makes the contribution from other developers to Brainstorm very easy.

REPORT: OTHER TUTORIALS








Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):


Tutorials/PipelineEditor (last edited 2015-02-28 00:14:07 by FrancoisTadel)