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

Error: read_source_spaces #16

Open
sivyobe opened this issue Sep 26, 2017 · 8 comments
Open

Error: read_source_spaces #16

sivyobe opened this issue Sep 26, 2017 · 8 comments

Comments

@sivyobe
Copy link

sivyobe commented Sep 26, 2017

Hello,
I try to read in matlab (with the mne-matlab tool) a source created in MNE-python with the additional information of patch.
I use in python the command mne.setup_source_space(sj, fname=True, spacing='ico4', subject_dir=<my_path>, add_dist=True), followed by mne.write_source_spaces(...) to have the fif file with patch information.
But when I read the file in matlab there isn't any information about the patch, i.e. the values nearest, nearest_info, pinfo, dist and dist_limit are empty.

Then I try to rewrite the file using one more step in python:
mne.read_source_spaces(..., patch_stats=True, ...) followed by mne.write_source_spaces(...)
and in this case when I try to read the fif file in matlab an error was reported:

Error using fiff_read_tag (line 178)
Only two and three dimensional matrices are supported at this time

How can I solve the problem? Because I need the patch information for my work at this step in matlab.

@agramfort
Copy link
Member

agramfort commented Sep 26, 2017 via email

@sivyobe
Copy link
Author

sivyobe commented Sep 26, 2017

How can I check if there are the patch informations in python?
When I read with the command src=mne.read_source_spaces(..., patch_stats=True, ...), what kind of command can I use to check the information of src?

@agramfort
Copy link
Member

agramfort commented Sep 26, 2017 via email

@sivyobe
Copy link
Author

sivyobe commented Sep 28, 2017

In python:

import mne
path = mne.datasets.sample.data_path(download=True)
src = mne.setup_source_space(
    subject='sample', subjects_dir=path + '/subjects', add_dist=True, spacing='ico4')
mne.write_source_spaces('ico4-src.fif', src)
src_p = mne.read_source_spaces('ico4-src.fif', patch_stats=True)
mne.write_source_spaces('ico4-src_p.fif', src_p)

In matlab (working in the folder 'path'):
ico4=mne_read_source_spaces('ico4-src.fif');
This command give me the error:

Only two and three dimensional matrices are supported at this time

And also trying with ico4=mne_read_source_spaces('ico4-src_p.fif');

@agramfort
Copy link
Member

@sivyobe I edited your code snippet. I can confirm the error. I don't have much time now. It's a bug in the matlab IO.

maybe @SherazKhan knows what to do

@SherazKhan
Copy link
Member

SherazKhan commented Sep 28, 2017

@agramfort @sivyobe I can fix the bug in mne-matlab and send the PR
@sivyobe do you want to take first take on the PR ?

@sivyobe
Copy link
Author

sivyobe commented Sep 29, 2017

What do you mean @SherazKhan?

@solleo
Copy link

solleo commented Jul 26, 2019

@SherazKhan The bug seems to be unfixed in mne-matlab yet?

>> src = mne_read_source_spaces('S01-4098-src.fif', 1);
	Reading a source space...Error using fiff_read_tag (line 178)
Only two and three dimensional matrices are supported at this time
Error in mne_read_source_spaces/read_source_space/find_tag (line
288)

There in fiff_read_tag.m, ndim is read as "1" while only 2 and 3 are allowed for the matrix form.

  • Edit: I realized that this only happens with source space files created by mne.setup_source_space in MNE-Python. Ones created by mne_make_source_space in the original MNE package work just fine!

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

No branches or pull requests

4 participants