Matlab scripts for localizing sensors in FieldTrip [Oostenveld et al., Computational Intelligence and Neuroscience 2011].
SensorLocalization.zip contains the scripts necessary for sensor localization. The scripts in Results.zip were used to generate the results presented in the paper "On-scalp MEG sensor localization using magnetic dipole-like coils: a method for highly accurate co-registration" (Pfeiffer et al., Neuroimage 2019). The MEG and MRI data used in this study are not included due to data privacy restrictions.
ft_dipolefittingCP, dipole_fit2, and dipole_fit3 are adapted from the FieldTrip functions 'ft_dipolefitting' and 'dipole_fit'. Changes are marked by 'CP' in the comments.