Pipeline development

Hello,
I am facing few problems when trying to build a Pipeline. Below is the pipeline that I wanted to use. I generated a MATLAB script from this pipeline.


When I tried to run the script without starting Brainstorm, I am encountering the following error (I added Brainstorm to my MATLAB path using addpath & genpath)

  1. Does this mean that, Brainstorm cannot run without GUI as it needs a protocol to be created.

  2. After, the above scenario, I started the GUI and ran the script again, this time it worked, however, I encountered the following error.


    I added the default channel locations from Brainstorm (Colin27 Easycap 128) in the pipeline then how come I get this error, Am I missing something here?

  3. The subject's data with whom I am working now, has nearly 45 runs (each run is of 10~20mins) duration. I am planning to extract source (scout) time series for 68 parcellations. I presume that I have to build forward model for each run and then extract sources through which I can get the scout time series, am I correct here?

  4. Now that I have 45 runs per patient, in this situation I wanted to use a distributed system without GUI (again going back to Question 1). I want to generate the scout time series for every run and then concatenate them at the end (I can do this concatenation offline-without using Bst). Can I use BST without GUI on distributed systems without GUI?

Many thanks in advance.
Regards,
Sri.

Hello,
I just updated my pipeline (in the earlier one, I did not refine the head positions). Here is the new one.

But the error still persists

.

Regards,
Sri.

  1. Does this mean that, Brainstorm cannot run without GUI as it needs a protocol to be created.

Brainstorm needs to be started in order to process scripts, otherwise the database engine is not accessible. You can run brainstorm without the GUI with "brainstorm nogui" or "brainstorm server".
I recommend you start by reading the Scripting tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Starting_Brainstorm

  1. I added the default channel locations from Brainstorm (Colin27 Easycap 128) in the pipeline then how come I get this error, Am I missing something here?

You probably selected a template where the electrodes names do not match the names of the data channels in your recordings.
If you import the individual anatomy for a subject, it's not recommended you use directly the default positions, you should align manually the positions of the electrodes and project them on the scalp (https://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy#Prepare_the_channel_file).
You should try to reproduce with a script only an analysis pipeline that you have fully prototyped with the interactive interface.

  1. The subject's data with whom I am working now, has nearly 45 runs (each run is of 10~20mins) duration. I am planning to extract source (scout) time series for 68 parcellations. I presume that I have to build forward model for each run and then extract sources through which I can get the scout time series, am I correct here?

Yes. There were several posts recently on this topic, search for additional information there. Follow the introduction tutorials at least until #23 using the example dataset, and you will learn how to do this.
https://neuroimage.usc.edu/brainstorm/Tutorials

If you are expecting to run any for of continuous data analysis, you should also read the resting state tutorial:
https://neuroimage.usc.edu/brainstorm/Tutorials/RestingOmega

  1. Can I use BST without GUI on distributed systems without GUI?

https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Running_scripts_on_a_cluster

I just updated my pipeline (in the earlier one, I did not refine the head positions)

This process "Refine registration" works only when the two surfaces you register match exactly. If your case this is not the same subject. You need some manual processing here. Or you drop completly the individual anatomy...

Thank you for the reply, Francois. I did not understand what exactly do you mean by "two surfaces".
I thought that this step is done to register EEG electrodes with MRI (if it was done manually, then right click on channel file>MRI Registration>Edit/Refine using Head Position). Can you please clarify.

You probably selected a template where the electrodes names do not match the names of the data channels in your recordings.

I have 27 channels of which I do not have locations for 8 of them (such as F11, F12, P11, P12, etc. I am in the process of acquiring them) and when I import a channel file 19 of them are recognised as EEG and 8 of them recognised as EEG_NO_LOC, of which I have an ECG channel also included. When I am scripting SSP: ECG, why is this not getting recognised. Is this happening because all 27 channels are not recognised?
I scripted my own channels (20 of them icludes ECG as [0 0 0], not 27 electrode locations) and used it as input, it is detecting ECG, but the error is occuring at the same point as earlier when trying to remove ECG artefacts (SSP:ECG).
Regards,
Sri.

Surface 1 = the head surface extracted from the MRI of your subject (which you import with process "Import anatomy folder")
Surface 2 = the surface of the digitized head points (which apparently you don't have: what you seem to be using here as this surface is a template set of electrodes positions aligned on the MNI Colin27 brain)

First one comes from your subject anatomy, second one comes from an MNI template. Aligning them with a rigid-body transformation (rotation-translation) used in "Refine with head points" won't work.

I recommend you start by following all the introduction tutorials (at least until #23) followed by the EEG-Epilepsy tutorial and the Scripting tutorial, using the example datasets and not your own data.
https://neuroimage.usc.edu/brainstorm/Tutorials
https://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

Then, in general for all type of analysis you want to perform as a batch in Brainstorm: start prototyping your analysis with the interactive interface. Then we you know exactly what you want to do (and when you understood what you can do and what you can't), you can try repeating this analysis with a script.

Thank you, Francois.