Mixed gradiometer and magnetometer leadfield

Hi you all,

I have question regarding MEG data from Elekta-Neuromag systems. As we will soon change to Neuromag systems I have played around with Neuromag data available from Haimalaines’s MNE webpage. As I use Brainstorm in a script manner it was easy to calculate MNE solutions using the magnetometers or the gradiometers by using .ChanLocs = [1:3,1:102] for the magentometer channel positions and .ChanLocs = [1:3,1:102] for the gradiometer set 1 and .ChanLocs = [4:6,1:102] for gradiometer set 2 channel positions. However, I would like to combine gradio-and magentometers. I did it after the both steps by hand (to have a leadfield matrix for both types of sensors at the same time). It would be nice to have brainstorm doing that from the beginning (to have Channels with weights [1 -1] and [1]. In the comments in bst_headmodeler there is some comment on that and says one should use .ChanLocs = [1:3,:] for gradiometers and [4:6,NaN] for magnetometers. I do not understand this? Can somebody explain please?

Thanks for the great toolbox,

Stephan

Dear Stephen,

As I use Brainstorm in a script manner it was easy to calculate MNE solutions using the magnetometers or the gradiometers

Sorry for the indiscretion, but is there any particular reason why you are scripting calls to Brainstorm functions? It is something useful when you process tens of subjects and hundreds of files, but it doesn't seem to be your case.

What differentiates Brainstorm from the other MEG/EEG toolboxes is most of all its rich interface: easy import/epoching, quick visualization, database manager, graphic batch processing.
If your aim is to build your own processes and own figures using only a few functions from a "toolbox" for file reading and forward models, you should consider using FieldTrip, which offers more advanced command-line features.

If you want to use Brainstorm and write your own scripts anyway, please at least do not write your own calls to bst_headmodeler and bst_sourceimaging. Brainstorm changed a lot between versions 2 and 3, and now most of the functions cannot work without the support of the database.
Scripting with Brainstorm must involve database management, such as: manual creation of protocols, subjects and conditions, clean MEG imports...

Some examples of scripts are available in folder brainstorm3/toolbox/script.
Each script corresponds to a tutorial: http://neuroimage.usc.edu/brainstorm/Tutorials

It would be nice to have brainstorm doing that from the beginning (to have Channels with weights [1 -1] and [1].

Please use import_channels or import_data to read the channels positions. Brainstorm forward models are supposed to work not only with one point per sensor, but with several integration points for each coil (defined in brainstorm3/toolbox/io/private/coildef.dat).
Your channel file should look like the attached example (Neuromag 306):


In the comments in bst_headmodeler there is some comment on that and says one should use .ChanLocs = [1:3,:] for gradiometers and [4:6,NaN] for magnetometers. I do not understand this? Can somebody explain please?

I am sorry, many of the comments in bst_headmodeler and bst_sourceimaging are outdated. The direct use of those functions is not documented yet. If you want to use them by your own you will have some reverse engineering to do: place a breakpoint at the beginning of the function, start computation from the GUI, and look at what the OPTIONS structure look like.

My final advice would be: read the tutorials, try to use the GUI, read the script examples, and come back to us if you have any question or request.

Sincerely,
Francois

Hi Francios,

Thanks for your long awnser and I really agree with you ! First, the new brainstorm version is really great and the GUI is very nice and intuitive ! And made me a real bad conscience reading you response ! But for my justification using brainstorm like this I have to tell, that I use it that manner because of historical “Fieldtrip had no mne functions” …
I use Fieldtrip for my whole data analysis (reading data, averaging, single trial analysis, ploting, time frequency analysis, statistics, etc.), but I liked always the robust brainstorm minimum norm solution. So (before the brainstorm version 3), I wrote some little functions that permitted me to use the brainstorm minimum norm from my Fieldtrip structures (like doing an average with ERF = timelockanalysis(cfg, data) and then something like ERF = coregister_mne(cfg, ERF), prepare_leadfield (cfg, ERF), calulate_mne(cfg, ERF) adding all the information to the ERF structure calling old brainstorm functions.

But with brainstorm 3 times have changed and I should change as well. I will take your advice serious!

Thanks,

Stephan