Talk:M4d
You can import Neuromag .fif data with the fileio toolbox (import>other formats using file-io toolbox), provided that you install the mne toolbox found at http://www.nmr.mgh.harvard.edu/martinos/userInfo/data/MNE_register/index.php When you're done with this registering and download, copy the mne folder in eeglab/plugins folder. But you're not there yet...
Neuromag 306 systems have 204 gradiometers and 102 magnetometers. You don't want to analyse MEG data with EEGlab. Just in case you'd still like to take a look, you can have fun with what's below.
The sensors' positions are not encoded in a format that is suitable for eeglab. You can extract the location data by using the fieldtrip function ft_read_sens (included in your eeglab). This returns a structure that contains position and orientation of 510 coils hidden in the MEG helmet. Plus a linear transformation that allows you to switch to 306 sensor sensors.
sens = ft_read_sens('yourdata.fif'); SensorsPositions = sens.tra*sens.coilpos; SensorsPositions = SensorsPositions(3:3:end,:);
will keep the position of the magnetometers (beware if you have some STI or EOG channels at the end of your dataset, you'll need to do something smarter than that). You want to copy all these coordinates into the EEG.chanlocs.X .Y and .Z, multiplied by 10 because the distance unit (says ft_read_sens) is cm in fieldtrip and mm in eeglab.
Then we want to coregister these sensors with the head and orient the nose along +Y.
EEG = pop_chanedit(EEG,'nosedir','+Y','eval','chans = pop_chancenter( chans, [],[]);'); [dum] = coregister(EEG.chanlocs); for i = 1:size(dum.pnt,1) EEG.chanlocs(i).X = dum.pnt(i,1); EEG.chanlocs(i).Y = dum.pnt(i,2); EEG.chanlocs(i).Z = dum.pnt(i,3); end EEG=pop_chanedit(EEG,'convert','cart2all');
Note that in EEG, the head of the subject does not move with respect to the sensor space. In MEG it does. This is why you might have localized the head of your subject and traced it during recordings. You might want to maxfilter your data first.
-- max Maximilien Chaumon 20 November 2010 (UTC)
This is a message from Brian Murphy <brian.murphy at unitn.it>
I'm attaching the scripts.
ftp://sccn.ucsd.edu/pub/ArchiveElectra.zip
Like Max's solution they rely on FileIO and MNE routines. But mine are more involved, since they were developed in particular for simultaneous MEG/EEG recordings, where the EEG electrode positions have been digitised with a Polhemus device.
- fixElektaEvents.m: converts Elekta bitwise triggers into EEGLAB-friendly events, and deletes the now superfluous trigger channels
- fixElektaScales.m: crude normalisation of EEG, gradiometer and magnetometer channel scaling by simple multiplying factor, so that the signals have similar magnitude to make visualisation possible (of course, this changes the scale of the units - beware)
- fixElektaChannels.m: transform EEG locations into MEG-device coordinates (this should be unnecessary, but an apparent bug means that the EEG device coordinates are wrong), and then move all (EEG and MEG) locations into EEGLAB head-coordinates (using cardinal points), and fill in appropriate channel labels
- readElekta2ICA.....m: an example preprocessing script that shows how all these can be used.
BTW, it might be nice if EEGLAB allowed you to set a scaling factor for display of each channel, so that fixing the scales in the crude way I do is unnecessary.
As I mentioned these are preliminary and I wouldn't expect them to work off the bat, but I'm happy to walk people through them, if they need help,
(please post more comments on this page if you come up with better solutions)