MNE cannot fully support the reading of the FIF format file generated from the 3rd generation Elekta devices

  • MNE version: e.g. 1.5.1
  • operating system: e.g. macOS 13 / Windows 10 / Ubuntu 20.04

The fif format file we use is generated from the third generation elekta device.

There are two questions we hope to get answered:
1.When executing “mne.io.read_raw_fif(fif_file_path)”,we got the following error:

Traceback (most recent call last):
  File "*****", line 7, in <module>
    raw = mne.io.read_raw_fif(fif_file)
  File "/***/envs/***/lib/python3.9/site-packages/mne/io/fiff/raw.py", line 551, in read_raw_fif
    return Raw(
  File "<decorator-gen-269>", line 12, in __init__
  File "/***/lib/python3.9/site-packages/mne/io/fiff/raw.py", line 99, in __init__
    raw, next_fname, buffer_size_sec = self._read_raw_file(
  File "<decorator-gen-270>", line 12, in _read_raw_file
  File "***/lib/python3.9/site-packages/mne/io/fiff/raw.py", line 324, in _read_raw_file
    next_fname = _get_next_fname(fid, fname_rep, tree)
  File "/***/lib/python3.9/site-packages/mne/io/open.py", line 62, in _get_next_fname
    for ent in nodes["directory"]:
TypeError: 'NoneType' object is not iterable

We have tried higher version mne(v1.8 or v1.9 ),but the question still existed.
We can only temporarily solve it by modifying raw.py as follows:

2.Lack head shape points in the coregistration result



Extra points are missing in the fif file info[‘dig’] read by mne.
However, we saw that the Elekta software(megin) deployed in the hospital can read these points. Is it that mne does not support the FIF file format of Elekta’s new equipment? Or does Elekta encrypt the data of these points?
Anyway, my question is:
can mne add support for fif format file of magnetoencephalography data from newer generation elekta devices?

Here is an anonymized and intercepted 15s of data in FIF format. demo_raw_tsss.fif

Thanks

@larsoner can you help?

In principle it should work, it sounds like we must have some bugs. Can you try re-sharing the file? The link doesn’t work for me:

demo_raw_tsss.fif

Can you please try again?

I was able to download the file, but using MEGIN’s show_fiff utility (or MNE-Python’s mne show_fiff) I don’t see any points of the type 234 (DIG_STRING) in the file, and it also doesn’t give the _get_next_fname error when I try to load it.

As my colleague raised in another topic, we found that MNE doesn’t parse data of type 234 with the ‘kind’. We decoded it ourselves and plotted the data. The picture shows that these points are exactly the head shape points. I suspect that these data were lost when raw data we’re cropped and re - saved using MNE functions.


1 Like

Yes, this is the issue I pointed out at the beginning. So we modified the raw.py in the MNE standard library temporarily.

1 Like

Can you share privately some original data from your system? For example if you can do a dummy recording with some dig points and data long enough to create a split file that would be best. That way I can test proper fixes in MNE for both bugs

1 Like

Sorry for the late reply, as I just got back from vacation. The original data comes from the hospital. Due to patient privacy protection, I am sorry that I do not have permission to share it. We have currently modified the files in the mne library to support the reading of these data. If you want to test the original data and make improvements to the official mne library, it may be more appropriate for you to obtain megin3 data directly from Elekta. Attached here are the changes we made to the library files for mne 1.5.1.
For mne/io/_digitization.py ,

For mne/io/tag.py,

Thanks

1 Like