Convert simulated EEG from h5 dataset to other format

64 views
Skip to first unread message

Zoe

unread,
Jun 9, 2020, 6:27:51 PM6/9/20
to TVB Users
Hello,

I am attempting to use the results of the tutorial on modeling epilepsy to study source localization of the simulated data. Can anyone assist me in converting the simulated EEG data into a usable format?

Here is what I have so far: any data exported from TVB is in the .h5 file format. I can read this into Python and determined that the simulated EEG data I exported contains two datasets. The first is labeled data and has shape (6000, 2, 63, 1), while the other is labeled time and has shape (6000,). Both have data type '<f8' and are listed as hdf5 datasets. These work like arrays and I can slice them. What I am unsure about is how to get them into a format typically seen of EEG data such as .ds, .meg4, .res4, .fif, .mat, .raw, .kdf, .sqd, .con, .ave, .mrk, .bst, .msr, .eeg, .csv.

The above are some of the file formats that the other program I am working in will accept with only .eeg and .csv being formats I have worked with before. It is incredible that TVB can simulate data, but I am unsure how to work with what it outputs.

Additionally, if anyone has a tip on how to make use of the head model data available in this tutorial I would be ecstatic. The other software can intake an mri or a FreeSurfer anatomy folder. I know FreeSurfer can also be used to prepare data for import to TVB so I am unsure if I can get this data back out but it would be very helpful.

Thank you for any help you can offer. Stay safe.

Marmaduke Woodman

unread,
Jun 10, 2020, 4:46:44 AM6/10/20
to tvb-...@googlegroups.com
hi

I don’t have a working anymore, but using MNE-Python, you can create their Raw data objects from TVB numpy arrays as follows, 


frmo there, you can save to fif or maybe other formats.  

To do source localization you’ll need to get a handle on geometry of sensors and all the surfaces involved, and then import them into the analysis framework you’re using such as MNE-Python.

cheers,
Marmaduke

--
You received this message because you are subscribed to the Google Groups "TVB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/9b0721a5-8751-41e6-9278-79da56d1dab1o%40googlegroups.com.

Zoe

unread,
Jun 10, 2020, 2:05:18 PM6/10/20
to TVB Users
Hello Marmaduke,

Thank you for the resource. I will study this to see if I can use it to convert to another file format. Do you know if the original T1 MRI data used to generate the epilepsy tutorial is openly available? The software I am using to analyze for the source localization requires an MRI, otherwise I will need to use the default anatomy. I have searched but I do not see it in the paper and am unsure if it is openly available anywhere.

Thank you,
Zoe
Marmaduke

To unsubscribe from this group and stop receiving emails from it, send an email to tvb-...@googlegroups.com.

Marmaduke Woodman

unread,
Jun 10, 2020, 4:22:36 PM6/10/20
to tvb-...@googlegroups.com
hi

for the original TVB dataset, there is no original MRI.  You would need to have it for your subject, or use a publicly available dataset.  For example, you could grab a subject from the Human Connectome Project, simulate a seizure and then put it all into your toolbox.  Unfortunately, we don’t have  a tutorial for it.

cheers,
Marmaduke

To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/14fa06dc-8547-4843-9096-094194e4b687o%40googlegroups.com.

Zoe

unread,
Jun 11, 2020, 11:09:10 AM6/11/20
to TVB Users
Hello Marmaduke,

I am looking to use the tutorial data from now. Can you tell me more about the head model used in its generation? Is this a standard head model such as ICBM152? Is the head model based in the MNI coordinate system? I have also looked at the .h5 file containing the sensor information, which contains both the sensor labels and their locations in the form of 3D coordinates. Are these coordinates in the MNI space or a coordinate system unique to the head model?

Thank you for your assistance.

Best,
Zoe
Marmaduke

WOODMAN Michael

unread,
Jun 11, 2020, 11:16:55 AM6/11/20
to tvb-...@googlegroups.com

hi


These data originate from many years ago, details of which are not known to me.  This is why, for this purpose, I would suggest starting with a nice new dataset such as those in the Human Connectome Project.  Apologies for the inconvenience.


cheers,


Marmaduke Woodman, TVB Engineer, INS AMU; +33 7 67 77 84 72


From: tvb-...@googlegroups.com <tvb-...@googlegroups.com> on behalf of Zoe <zher...@gmail.com>
Sent: Thursday, June 11, 2020 5:09:10 PM
To: TVB Users
Subject: Re: [TVB] Convert simulated EEG from h5 dataset to other format
 
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/e5a905c3-3231-498d-bee0-4eb09eea70e4o%40googlegroups.com.

Zoe

unread,
Jun 11, 2020, 11:26:42 AM6/11/20
to TVB Users
Hello,

I have looked into those datasets and a few others but, as I understand it, generating realistic simulated seizure data from these new head models would take considerable time because I would need to develop a pipeline for each of them and tweak them to achieve the results I need. Unfortunately I do not have that much time so I will use the tutorial and rely on a default head model in the MNI space for my modeling. I have one other question regarding TVB if you do not mind. I have exported the simulated EEG data and inspected it to find that the .h5 file contains 2 datasets: data and time. The data array has shape (6000, 2, 63, 1). For every time point there are 2 values for each sensor. Do you know what the 2 represents and what is means for there to be 2 values for each sensor at every time point?

Thank you,
Zoe

WOODMAN Michael

unread,
Jun 11, 2020, 11:57:59 AM6/11/20
to tvb-...@googlegroups.com

hi


I don't recall exactly, but I think the first variable is the one you want, since it corresponds to the effective source LFP.  The other is the metabolic variable.


you can verify this by computing spectra of both: the second should have power at frequencies less than 1Hz.


cheers,


Marmaduke Woodman, TVB Engineer, INS AMU; +33 7 67 77 84 72

Sent: Thursday, June 11, 2020 5:26:42 PM
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/eeccbde4-1df4-4c0b-8cff-9835c3a7b7aco%40googlegroups.com.

Zoe

unread,
Jun 11, 2020, 3:32:56 PM6/11/20
to TVB Users
Hello Marmaduke,

I inspected the data for the first electrode and what I found is consistent with what you stated above. Thank you very much for the assistance.

Do you have knowledge on the 63 sensor EEG montage that the data is projected to? I had initially assumed that the sensors would be consistent with the standard 10-20 system, however on further investigation I realized they are not. 58/63 sensors share names with the sensors in the standard 10-20 montage, but when I visualized the sensors in TVB using Project: Sensor Visualizer, the locations shown were not what I expected. On first glance there appear to be more than 5 that are inconsistent with the standard locations. In the .h5 file containing the sensor data, there is a list of labels and a list of locations which are coordinates in 3D space. I see now that the tutorial states this is done in the standard head model. I am trying to determine if this exists in the MNI space, thus making these coordinates something I can use to determine the sensor locations, or if the head model is in a unique space.

Thank you again for all of your help. I greatly appreciate it. 

Best,
Zoe

WOODMAN Michael

unread,
Jun 11, 2020, 3:45:21 PM6/11/20
to tvb-...@googlegroups.com

Hi


I can't really explain the montage since I wasn't involved in its creation almost 8 years ago.  In principle you could recreate the EEG monitor in TVB with standard 10/20 montage.  In fact, if you have a gain matrix / forward model from your analysis toolbox, you could rerun the simulation, keep raw neural time series, apply the gain, and then you wouldn't have to worry about discrepancies. 


cheers,


Marmaduke Woodman, TVB Engineer, INS AMU; +33 7 67 77 84 72

Sent: Thursday, June 11, 2020 9:32:55 PM
To unsubscribe from this group and stop receiving emails from it, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/84da989e-73dc-48b8-81c1-d49169d67205o%40googlegroups.com.

Zoe

unread,
Jun 12, 2020, 12:54:48 PM6/12/20
to TVB Users
Hi Marmaduke,

I would need to know the locations in MNI space of the nodes in TVB in order to create the gain matrix so I will stick with the existing montage for now and look into developing that for future analysis. Thank you very much for all of your help! I greatly appreciate it.

Best,
Zoe
Reply all
Reply to author
Forward
0 new messages