From GUI to script

If you are complete new to to Brainstorm, we strongly suggest you to reading all the introductions tutorials (section "Get started"), using the example dataset, in order to learn how to use the software. This will also give you the jargon you would need.
https://neuroimage.usc.edu/brainstorm/Tutorials

If you haven't take a look to the scripting tutorial:

Moreover, Brainstorm distribution includes scripts that reproduce the different tutorials (in folder brainstorm3/toolbox/scripts).

Try first to perform the actions from your pipeline in the GUI, then proceed to script it.


About your script:

  1. Never call clear if Brainstorm is running, it will clear variables, functions and classes that are needed in Brainstorm

  2. The call to process_import_anatomy is incorrect, it expects a folder or file with pre-processed individual MRI. As you want to use the Default anatomy, create a Subject like this:

    [sSubject, iSubject] = db_add_subject(SubjectName, [], 1, 0);

  3. The error in process_headmodel is the result of an invalid anatomy. Because it was not created in the first step.