This is an old revision of the document!

A PCRE internal error occured. This might be caused by a faulty plugin

{{tag>elekta neuromag dataformat meg}} ====== Getting started with Elekta-Neuromag data ====== ===== Introduction ===== \\ All data in Neuromag is stored in *.fif files, where the files can contain different data objects. The following data objects can be read and used in FieldTrip: MEG data, EEG data, gradiometer positions, single sphere models, BEM models (using the MEG-CALC toolbox). FieldTrip reads Neuromag fif files using low-level Matlab functions from the MNE toolbox from Matti Hamalainen, see [[|MNE software]]. This will work on any platform, as it is based on open-source m-files. To load the data into Matlab you need the MNE toolbox from Matti Hämäläinen, see [[|MNE software]]. Alternative support for Neuromag data is implemented by calling the mex files from [[|Kimmo Uutela's MEG-PD toolbox]]. The files in the MEG-PD toolbox are not included with FieldTrip, but you can download them[[|here]]. Extract the toolbox and put it on your matlab path, or copy the files into the "fieldtrip/private" directory. This is used if you select the file format as "neuromag_fif". Note that the MEG-PD toolbox will only function on 32-bit machines, and requires either a Linux or HP-UX system to run. As the mex files are compiled code, it is not possible to modify these to run on 64-bit machines (which are becoming increasingly common), at present. ===== Set Path ===== \\ To get started, you need to add the paths where the FieldTrip and MNE toolboxes can be found. In respect to FiedlTrip, you should add the FieldTrip main directory to your path, and execute the **[[:reference:ft_defaults]]** function, which sets the defaults and configures up the minimal required path settings (see the [[faq:should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path|faq]]): <code> addpath <full_path_to_fieldtrip> ft_defaults </code> ===== Reading MEG data ===== \\ The first step is to see if you can read in the data using both the toolboxes by typing the following in the command window: <code> >> hdr = ft_read_header(filename); %your fif-filename >> hdr hdr = label: {317x1 cell} nChans: 317 Fs: 1000 grad: [1x1 struct] unit: {1x317 cell} nSamples: 396000 nSamplesPre: 0 nTrials: 1 orig: [1x1 struct] </code> The header contains a lot of information about the measurement parameters. In this example 317 channels were recorded, the sampling frequency was a 1000 Hz and in the field hdr.grad you can find information about the sensor-locations, for example. The field 'hdr.orig' contains all the original header information. <code> >> dat = ft_read_data(filename); >> size(dat) ans = 317 396000 </code> The variable 'dat' contains all the data for 317 channels for all samples. This is a recording of 396 seconds sampled at 1000 Hz. When this works you are sure that fieldtrip can handle your dataset and you can start to analyse your data as described [[tutorial/introduction|here]]. ===== Special issues ===== * Reading .fif mri-data with fieldtrip and making a single shell headmodel (example script can be found [[example/read_neuromag_mri_and_create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space|here]]). Not yet documented or fixed but encountered: * read_trigger, this function assumes that event_values below 5 are noise. In the new system (Elekta Neuromag VectorView 306) this is not always the case.