Optimization Function for Dipole fitting

@Raymundo.Cassani @francois

So, I went through the script of the dipole fitting function on Brainstorm and realized that Brainstorm calls the function from fieldtrip. The function says, we can choose between either fminunc or fmincon to perform the optimization . I was wondering if we can modify certain lines of the field trip function to change the optimization function to let's say: Genetic Algorithm and call it on Brainstorm? Or does brainstorm only accept fminunc and fmincon as optimization methods?

Brainstorm does not offer the option to change the optimization function. In general, we try to hard-wire many possible options in order to reduce the complexity of the decision-making during the analysis, and reduce the risks of making bad choices.

If you want to change the option "optimfun" that is passed from Brainstorm to FieldTrip, here is how you can proceed:

  • make a copy of the function process_ft_dipolefitting.m into your user process folder ($HOME/.brainstorm/process)
  • rename the function (otherwise it would shadow completely the original function)
  • change the Comment field in the function GetDescription, in order to identify your modified process
  • at lines 216-220: replace the existing definition of the optimfun parameter that is given to FieldTrip.

Whether you can use other values than fminunc or fmincon: I don't know.
This is a question for the FieldTrip developers.