branelab / SimMEEG

Software for simulating MEG and EEG event-related responses. functional connectivity, and phase-amplitude coupling
Other
3 stars 5 forks source link

Loading FieldTrip without overriding Matlab functions #6

Closed ftadel closed 2 years ago

ftadel commented 2 years ago

From Brainstorm, FieldTrip is initialized by calling ft_defaults.m. https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/core/bst_plugin.m#L445

However, @rcassani discovered that by default this adds to the path some external subfolders that shadow Matlab functions. Example: after running ft_defaults, the function filtfilt points at fieldtrip/external/signal/filtfilt.m instead of the implementation of the Matlab Signal Processing Toolbox.

This is probably not what we want to do, as it impacts other functions in Brainstorm. For example: we don't want the decoding processes to be behave differently depending on whether the FieldTrip is loaded as a plugin or not.

We can disable this behavior by calling ft_default.toolbox.signal='matlab'; ft_defaults; instead.

@robertoostenveld @schoffelen 1) Is there any particular reason why you decide to use the FieldTrip implementations instead of the native ones? 2) Can we safely expect that all the shadowed functions are exact replacements for the Matlab versions? (all the combinations of parameters are supported) 3) If we set ft_default.toolbox.signal='matlab', but the Signal Processing Toolbox is not available on the computer: does FieldTrip default it back to the FieldTrip implementation, or do we have to test for this beforehand? 4) What is the exhaustive list of toolboxes that we should prevent FieldTrip from overloading?

Thanks!

ftadel commented 2 years ago

Sorry: closing this and opening it on the Brainstorm repo: https://github.com/brainstorm-tools/brainstorm3/issues/474