Reading Neuromag FIF files into SPM5

If you want to read Neuromag MEG *.FIF files into SPM5, you can download the relevant functions from http://imaging.mrc-cbu.cam.ac.uk/svn/spm5_cbu_updates/devel

The main files are spm_eeg_rdata_FIF.m, spm_eeg_rdata_FIF_channels.m, spm_eeg_wdata_FIF.m, and FIF306_setup.mat, cbu_meg_124eeg_montage.mat, though other functions there may be of interest (and not yet part of the official SPM5 package).

Note that they utilise Uetela's mex files, which you also need to download and install from here.

The main function is "spm_eeg_rdata_FIF.m". This can read in FIF averaged or raw files. It also extracts the sensor positions and orientations in Head space, as well as HPI coil positions and any Isotrak points (if you want to attempt source localisation). It also reads in EOG channels, plus any EEG channels you have. Note that the EEG data will be stored in a separate SPM *.mat/*.dat file from the MEG data (the EOG channels are stored in both).

It requires that the SPM template files "FIF306_setup.mat" and " cbu_meg_124eeg_montage.mat" (for Display), which is included in the above bundle, to be put into the "EEGtemplates" subdirectory of your local SPM5 installation.

NB: It has only been tested on *.FIF data from a 306 channel NeuroMag VectorView system, so may not work for *.FIF data from other machines!

Also bundled is spm_eeg_wdata_FIF.m which will write FIF files from SPM files (though only the raw data; some other FIF fields are lost, eg any associated SSP vectors).

Please email me if you find any "unwanted features" (ie bugs)!