[FieldTrip] matrix multiplication error in ft_sourcedescriptives
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Wed Nov 11 09:32:21 CET 2020
Hi Philip,
It could be that your error is caused by the fact that you computed your forward model (ft_prepare_leadfield), using cfg.backproject = ’no’. Consequently, the dipole specific leadfields are of dimensionality Nchan x 2, rather than the ’normal’, Nchan x 3. Some of the derived measures obtained from ft_sourceanlaysis (using the Nchan x 2 leadfields) then have dimensions that are 2 x something, or something x 2, rather than the more conventional … x 3. One of these derived measures might be the ‘ori’ field, that ft_sourcedescriptives complains about. Long story short, the cfg.backproject = ’no’ option in ft_prepare_leadfield is apparently incompatible with the computation of the ‘phi’ variable in ft_sourcedescriptives.
The phi variable seems to quantify the (cosine of) the angle between the orientation of the reconstructed source, and the local normal of the cortical sheet. With un-backprojected (and rank reduced) leadfields, the (implicit) axes of the coordinate system that spans the plane in which the leadfield lives are incompatible with the implicit axes of the coordinate system that spans the 3D space in which the cortex lives. In other words, the issue is not only an incompatibility between the numbers 2 and 3, but it goes a bit deeper than that.
Assuming that my diagnosis is correct, the short term solution for you would be to re-run the source reconstruction pipeline (including the ft_prepare_leadfield step with cfg.backproject = ‘yes’).
The somewhat longer term solution would be to implement an error check (dispreferred because it’s more like a band aid), or impose some stricter consistency between the assumed coordinate systems of the different attributes of individual dipoles.
Best wishes,
Jan-Mathijs
On 11 Nov 2020, at 04:12, Philip Cho <pnc9 at georgetown.edu<mailto:pnc9 at georgetown.edu>> wrote:
Hello Fieldtrip Community,
I'm a new Fieldtrip user, and I'd appreciate any help I can receive. I'm currently working on MEG source reconstruction of an averaged event-related field from a single subject. I believe I have completed most of the steps, and I'm able to view my results at a given time using ft_plot_mesh. What I want to do now is view a movie of the activity, but for reasons I do not fully understand, I am having trouble obtaining the descriptive parameters of my results, which I believe is a parameter I must feed into ft_sourcemovie.
In particular, when I run ft_sourcedescriptives, I obtain the following error:
Error using *
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
'.*'.
Error in ft_sourcedescriptives (line 619)
source.avg.phi(diplop) = source.avg.ori{diplop}*nrm(diplop,:)';
Error in mous_sourcemovie (line 7)
sd = ft_sourcedescriptives(cfg,source_allWords);
It looks like source.avg.ori{diplop} is a 1x2 array, while nrm(diplop,:)' is a 3x1 array. Please let me know if there is a possible fix to this error. If any additional information is needed, I would also be happy to send it out. Any advice would be deeply appreciated.
Best,
Philip
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201111/8aa9a280/attachment.htm>
More information about the fieldtrip
mailing list