Error during process ft_dipolefitting with openMEEG head model

Hi Brainstorm people,

I am trying to run the process ft_dipolefitting on EEG data using an openMEEG head model. I get the following error in the report :

Line 492: *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.

Call stack:
>ft_compute_leadfield.m at 492
>ft_dipolefitting.m at 392
>process_ft_dipolefitting.m>Run at 213
>process_ft_dipolefitting.m at 28
>bst_process.m>Run at 196
>bst_process.m at 36
>panel_process1.m>RunProcess at 151
>panel_process1.m at 26
>gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 759
>bst_call.m at 28
>gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 292

Using matlab's degubber mode I figured that, in the openmeeg case, ft_compute_leadfield.m expects to find some option 'lf' containing the leadfield in the input arguments, which is missing in the present case. I don't know whether this is a shortcoming from ft_dipolefitting or from process_ft_dipolefitting, so I try a first shoot here.

My matlab version is 2018b, and my fieldtrip version is 20181218.

Thanks in advance for any help.

After performing some tests, I realized that there are indeed major issues in the computation of forward models (and hence dipole fits) with FieldTrip functions on EEG recordings.
I will investigate these problems and get back to you soon.

One thing you can already forget about is the OpenMEEG online computation for dipole fitting. This will not work, and would run forever even if it worked. I will add an explicit error message about this incompatibility.

1 Like

Dear Francois,
Thanks for the reply. I look forward to news from you.

In the mean time, could you please specify what you mean by online computation ? I thought the dipole fitting was based on an already-computed head model.

The FieldTrip dipole fitting algorithm is an iterative procedure that recomputes the leadfield of the dipoles estimated at each iteration.

In Brainstorm, you need a "head model" file computed in your database before running this dipole fitting algorithm, but this is actually only to get the actual "head model" (ie. the geometry of the head) and pass it to FieldTrip, the leadfield available in the Brainstorm is not used.
In FieldTrip, head model and leadfield are two separate steps that produce two different types of structures. In Brainstorm, the two concepts are grouped under the the step "Compute head model", we don't really have a way to dissociate the two steps in the interface. Hence this confusing implementation.

1 Like

Bug fixed:

You can update Brainstorm and try again.

1 Like

Thank you !