Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIFF_DIG_STRING kind data analysis #13079

Open
TomCat-Vim opened this issue Jan 24, 2025 · 5 comments · May be fixed by #13083
Open

FIFF_DIG_STRING kind data analysis #13079

TomCat-Vim opened this issue Jan 24, 2025 · 5 comments · May be fixed by #13083
Labels

Comments

@TomCat-Vim
Copy link

Describe the new feature or enhancement

Recently, I acquired some data collected using the third-generation MEG device from Megin. When trying to retrieve patient scalp points via MNE, I found that the process was not as smooth as before. Through debugging, I discovered that the third-generation MEG device seems to store the patient scalp point data in a directory with the kind FIFF_DIG_STRING, and the data type is FIFFT_DIG_STRING_STRUCT. However, while MNE has defined this data type, it does not provide a method to parse it. I hope the community can add a way to parse this data type. Thank you!

Describe your proposed implementation

we can implement in mne/_fiff/tag.py, like this:

_call_dict = {
FIFF.FIFFT_STRING: _read_string,
FIFF.FIFFT_COMPLEX_FLOAT: _read_complex_float,
FIFF.FIFFT_COMPLEX_DOUBLE: _read_complex_double,
FIFF.FIFFT_ID_STRUCT: _read_id_struct,
FIFF.FIFFT_DIG_POINT_STRUCT: _read_dig_point_struct,
FIFF.FIFFT_COORD_TRANS_STRUCT: _read_coord_trans_struct,
FIFF.FIFFT_CH_INFO_STRUCT: _read_ch_info_struct,
FIFF.FIFFT_OLD_PACK: _read_old_pack,
FIFF.FIFFT_DIR_ENTRY_STRUCT: _read_dir_entry_struct,
FIFF.FIFFT_JULIAN: _read_julian,
FIFF.FIFFT_DI.G_STRING_STRUCT: _read_dig_string,
}

def _read_dig_string(fid, tag, shape, rlims):
......

in mne/_fiff/.digitization.py
for k in range(isotrak["nent"]):
kind = isotrak["directory"][k].kind
pos = isotrak["directory"][k].pos
if kind == FIFF.FIFF_DIG_POINT:
tag = read_tag(fid, pos)
dig.append(tag.data)
# elif kind == FIFF.FIFF_DIG_STRING:
# tag = read_tag(fid, pos)
# dig.append(tag.data)

elif kind == FIFF.FIFF_MNE_COORD_FRAME:
tag = read_tag(fid, pos)
coord_frame = _coord_frame_named.get(int(tag.data.item()))
elif kind == FIFF.FIFF_MNE_CH_NAME_LIST:

Describe possible alternatives

The above is just my current idea, and I don't know exactly how to implement it.

Additional context

No response

@TomCat-Vim TomCat-Vim added the ENH label Jan 24, 2025
Copy link

welcome bot commented Jan 24, 2025

Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

@larsoner
Copy link
Member

Is this the same issue as

https://mne.discourse.group/t/mne-cannot-fully-support-the-reading-of-the-fif-format-file-generated-from-the-3rd-generation-elekta-devices/10725

? If so I can look into it using the file shared there

@larsoner
Copy link
Member

... I tried using that file but it didn't contain any DIG_STRING entries, so still need someone to share a problematic file!

@larsoner larsoner linked a pull request Jan 24, 2025 that will close this issue
@TomCat-Vim
Copy link
Author

Sorry, I didn't realize that the data with kind 234 wasn't saved after the file was split. Thank you very much for helping me solve this issue. Do you still need me to provide the file? @larsoner

@larsoner
Copy link
Member

Yeah I need a file that has type 234 in it.

If you also have a file with the splitting issue (the next file error) that you could share, that would be great, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants