The below example code is hopelessly outdated (thus deprecated) and will probably not work anymore. This page is kept in place just for reference. If you ended up on this page because you are curious to learn about the creation of dipole grids from .fif mri, please look at this example script.

Doing source-analysis with the created headmodel

When you have then estimated the sources which happens in NM or CTF space, you have to replace the .pos field of the source or the result of ft_sourcedescriptives with the template_grid.pos to get it back into MNI space because the origins of the two spaces are different. When you then sourceinterpolate to the normalised mri, this should work!