Open sivyobe opened 7 years ago
it seems to be read:
https://github.com/mne-tools/mne-matlab/blob/master/matlab/mne_read_source_spaces.m#L251
if you read it back from Python you recover the info?
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?
please provide a full code snippet using sample data so we can debug faster.
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');
@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
@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 ?
What do you mean @SherazKhan?
@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.
mne.setup_source_space
in MNE-Python. Ones created by mne_make_source_space
in the original MNE package work just fine!Hi,@solleo, I met the same problem. Could you tell me how to use mne_make_source_space? I did not find this function in MNE. Thank you very much for your kind help~
@finch-f you can check out the MNE-C documentation, not the MNE-python.
Edit: but i don't know if this matlab bug has not been fixed after 7 years? Since @schoffelen pointed out that you got a different error message.
Hi,@solleo, I met the same problem. Could you tell me how to use mne_make_source_space? I did not find this function in MNE. Thank you very much for your kind help~
@finch-f I think that you can be a bit more accurate. As per the issue you reported here: https://github.com/fieldtrip/fieldtrip/issues/2456 you have a different error than the one reported in this current issue. Please try and keep the noise and wild goose chases to a minimum.
The issue is a mismatch between user expectations and the type of source model.
@finch-f has created a volumetric sourcemodel (i.e. with vertices defined on a 3D grid) This causes mne_read_source_spaces(fname,1) to error out (because the second '1' asks the function to read the geometry information (i.e. the triangles). The file does not have triangles, so this causes an error.
mne_read_source_spaces(fname,0) works. So the problem experienced by @finch-f is not related to this issue
@finch-f you can check out the MNE-C documentation, not the MNE-python.
Edit: but i don't know if this matlab bug has not been fixed after 7 years? Since @schoffelen pointed out that you got a different error message.
Thank you very much for your reply. I will try MNE-C.
@schoffelen Thank you very much for your kind response and reminder. Please forgive any mistakes I made in reporting these issues; I’ll be more mindful of them afterwards.
The issue of using FieldTrip to read MNE source spaces has puzzled me for quite some time. Following your reply, I tried the suggested approach, and indeed, mne_read_source_spaces(fname, 0) successfully read my volume-based source space. This is an exciting progress for me. I’ll look into adjusting ft_read_headshape() and hope it can run smoothly as well.
In fact, I initially created a surface-based source space (Please see the attached fif file) but encountered the same issue reported in this thread. So, I tried using a volume-based source space instead, which led to the error I reported in FieldTrip. S01_source.zip
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=, 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:
How can I solve the problem? Because I need the patch information for my work at this step in matlab.