You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: getting_started/othersoftware/mne.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ FieldTrip and MNE-Python have conceptually similar but not identical processing
36
36
37
37
In order to import data from MNE-python into FieldTrip, it is most straightforward to save the data as a fif-file in MNE-python, and read it into FieldTrip using **[ft_preprocessing](/reference/ft_preprocessing)**. A FieldTrip data structure can be exported to a fif-file using the **[fieldtrip2fiff](/reference/fieldtrip2fiff)** function. Alternatively, MNE-python has functionality to read in mat-files that contain a FieldTrip data structure. In this latter case, however, only the time series information will be imported, and the original header information of the raw data file will often be needed to obtain relevant metadata (or this metadata needs to be handcrafted in MNE-python). **[fieldtrip2fiff](/reference/fieldtrip2fiff)** tries to write channel positions (and events/headshape information) directly into the fif-file, provided that this information is present in the data.
38
38
39
-
Below are some practical examples that demonstrate how to export FieldTrip data to a fif-file. For this we use the example data of [dataset 10](/faq/datasets#meg-tactile_dipole_fitting). If you want to try this out yourself, please download [SubjectBraille.zip](https://download.fieldtriptoolbox.org/tutorial/SubjectBraille.zip) and extract the `.ds` folder in a convenient location.
39
+
Below are some practical examples that demonstrate how to export FieldTrip data to a fif-file. For this we use the [SubjectBraille.ds](/faq/datasets/#meg-tactile_dipole_fitting) dataset. If you want to try this out yourself, please download [SubjectBraille.zip](https://download.fieldtriptoolbox.org/tutorial/SubjectBraille.zip) and extract the `.ds` folder in a convenient location.
40
40
41
41
### Example: export raw - single trial - data structure
42
42
@@ -54,16 +54,17 @@ As a first example, we read the data as a continuous chunk. Note that the exampl
54
54
cfg.channel = {'MEG', '-MLP31', '-MLO12'};
55
55
data = ft_preprocessing(cfg);
56
56
hs = ft_read_headshape(cfg.dataset); % let's also read this information
57
+
event = ft_read_event(cfg.dataset);
57
58
58
59
We can now export the data to a fiff file, pretending as if it's raw data. Note that the original fiff-file definition stores the data in single precision (32-bit per data point) format. By default, FieldTrip stores the data in the same precision of the actual data, which usually is double (and even complex-valued). MNE-python should be capable of dealing with this type of numeric precision, but other software might not. If the data needs to be stored in single precision, you can use the key-value pair `'precision', 'single'`. Also, note that the current example is a bit silly, given that MNE-python is perfectly capable of reading in native CTF data. Here, it is presented as a proof-of-principle.
save(fullfile(datadir, 'ctf-raw.mat'), 'data'); % for comparison
63
64
64
65
Including the headshape information as an extra input argument will result in the fif-file to also contain the information about the location of the HPI-coils. This might be relevant for a smooth experience in MNE-python, e.g., if one wishes to apply tSSS to the data.
65
66
66
-
Also, **[fieldtrip2fiff](/reference/fieldtrip2fiff)** will attempt to create an event file (provided the data object has an event structure buried somewhere in the processing history, called `'ctf_raw-eve.fif'`. The events will be represented as numbers, in a Nx3 matrix, where the first column contains the sample index of the event, and the third column contains the value. As of April 2023, also an interpretative comment will be saved in the event file, that allows to map the numbered events in the event file back onto the FieldTrip-style event representation.
67
+
Also, **[fieldtrip2fiff](/reference/fieldtrip2fiff)** will add the events as specified in the event-structure to the data, provided it is passed as an additional argument to the function. The events will be represented as numbers, in a Nx3 matrix, where the first column contains the sample index of the event, and the third column contains the value. As of April 2023, also an interpretative comment will be saved in the data file (i.e. the mapping from numeric events to annotations), that allows to map the numbered events in the event file back onto the FieldTrip-style event representation.
67
68
68
69
### Example: export raw - multiple trial - data structure
0 commit comments