Repository navigation
Description
Dear mne-python,
I am currently working at the Forschungszentrum Jülich on my master thesis. I perform an spatio-temporal clustering statistical test on volumetric source activities from an MFT calculation.
Therefore I created a volume source space for all the volume labels, which were identified by FreeSurfer. Since I set the volume source space up for all the volume labels in my subject, mne-python encountered a problem, while saving the resulting source-space.fif-file. The common way to create the volume label wise source spaces is to create an entire volume source space for each label and save the significant vertice indices for the label in src['vertno'], while the remaining volume source space is exactly the same for any label and also saved. Since this is done, in my case for ~46 labels, I end up with a large source space file, which is, in the end, not able to be saved by mne-python, as the fif-file is larger than 2GB.
Despite this saving problem, which can be avoided with a work around, I encountered a more sincere problem. Multiple vertices (~3000 out of 17000) are considered to be part of multiple labels, so a large number of vertices is to be considered a vertice in (e.g.) 'Right-Cerebral-White-Matter' as well as 'Right-Cerebral-Cortex'.
This will result in subsequent faults , hence I want to ask for help for a solution, which will create a more suitable volume source space to store as well as referencing each vertice to just one specific label.
Since I am very interested in the solution in detail, I am open for / willing to participate in any discussion.
Yours sincerely,
Daniel van de Velden
P.S.: My work around to get all the labels vertices is looping over all labels, create the whole volume source space, grabbing the src['vertno'] info from it and store it separately in a dictionary. Then I delete the source space and go for the next with the next volume label. After this is done for all labels, I create an entire volume source space without any labels restrictions.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
agramfort commentedon Dec 13, 2017
d-van-de-velden commentedon Dec 14, 2017
Of course I can. Sorry I thought I explained it detailed enough. My bad.
Here you go:
If you run this code snippet, it will create N numbers of volume source spaces. One for each label. Keeping the whole source space info in every source space, except the src['vertno'] array. This only contains the indices for the vertices, relevant to the chosen volume label. And will be too big to save. A work around is creating a volume source space without volume restrictions but keep the
volume_source_space_label_dictionaryto keep the information.You can also check the
volume_source_space_label_dictionary, that many vertices are tend to appear in multiple volume labels.agramfort commentedon Dec 16, 2017
your script (with tiny changes below) works fine for me:
d-van-de-velden commentedon Dec 18, 2017
Good morning Alexandre Gramfort,
at first I wish you a good start in this week. Respectively, to your tiny changes in this code example I agree with you, that it will run without any error. However this changes bypass the essential error I was talking about. Please try run following code snippet:
Since the vol_source_space will be too big, it will not be able to be saved, hence the limited fif-file size of 2GB. You will receive the following IOError Message:
Additionally I'd like to mention, that for the subject 'fsaverage' and 'sample' there are no vertice duplicates across the labels, but in every subject I created a volume source space for (+24 subjects).
I also checked the duplicates for their correctness, in case of their allocation to the labels they appear in. After correcting their allocation with the following code snippet I got rid of all duplicates, without losing any loss of a vertice from the entire volume source space.
Adding this to the actual
_make_volume_source_space(surf, pos, exclude, mindist, mri, volume_label)-function, after generously choosing vertices for the VOI, to check if the selected vertices are correct, would solve the duplicate problem.Of course, this is just a friendly reference. If my suggestion is rude, false or doesn't work with the functions actual purpose, please let me know. I am very interested in learning and discussion about this subject.
I also apologize for any trouble this 'issue thread' might cause.
Have a nice day,
Daniel
agramfort commentedon Dec 19, 2017
d-van-de-velden commentedon Dec 19, 2017
Thank you very much.
I will go with my work around, so the code with your tiny little changes. Thanks again and a support with hdf5 will be very useful for label-wise volume source space construction.
If you don't want discuss anything I will close this thread.
I wish you and your family and friends a merry Christmas,
Daniel van de Velden
agramfort commentedon Dec 19, 2017
pelednoam commentedon Sep 27, 2018
Hey, are there any updates on this issue? I'm trying to save ico5 BEM solution, and getting the same error (OSError: FIFF file exceeded 2GB limit, please split file or save to a different format)
Thanks!
larsoner commentedon Sep 27, 2018
Fortunately
ConductorModelsubclasses a standard class (dict) so for now you can probably hack it with:larsoner commentedon Sep 27, 2018
(incidentally
SourceSpacessubclasses the standard classlist, too, so the same workaround will probably work for this volume source space)[-]Multiple vertno indice duplicates in volume_label based Volume-Source-Space[/-][+]ENH: Write source spaces to HDF5[/+][-]ENH: Write source spaces to HDF5[/-][+]ENH: Write source spaces and BEMs to HDF5[/+]