# How to input tACS forward solution (FEM) into model

80 views

### Silvana Huertas

Aug 11, 2022, 8:32:24 AM8/11/22
to TVB Users
Hi,

I'm trying to simulate tACS in resting state using a Jansen-Rit model. Based on the paper by Kunze et al. (2016) I know I need to add the FEM (in my case I did this in SimNIBS) to the brain network model.  I'm writing the code in Python to simulate the 74 cortical areas with Jansen-Rit model but I can't understand how to input my FEM output from SimNIBS into the model. Do you know how to do this?

I'm new with TVB and I'm still a little bit lost.
Thank you in advance for the help.  :)

### WOODMAN Michael

Sep 5, 2022, 6:13:01 AM9/5/22
to TVB Users
hi,

It looks like SimNibs output is at the level of detail of the FEM model itself.  You'd need to average the SimNibs output per region first and then provide it as a stimulus to TVB, in the form of a class that returns a value per region at each time point; you can see an example of how to build a stimulus here

If you still need help let us know.

cheers,

--
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.

### Silvana Huertas

Sep 6, 2022, 8:13:37 AM9/6/22
to TVB Users

If I understand correctly, I will need to average the SimNIBS output per region, having a total number of regions equal to the ones I'm using for the model, right? (For example 74 if I use the predefine connectome of TVB).

I checked the code you sent me, but it is not that clear to me how to input the SimNIBS output at each time point since the output from SimNIBS is static in time.
Additionally, those this means that I need to input the SimNIBS averaged output and the sinusoidal stimulus (tACS)?

Thank you,
Silvana

### WOODMAN Michael

Sep 6, 2022, 8:27:03 AM9/6/22
to TVB Users
hi

On 6 Sep 2022, at 14:13, Silvana Huertas <s.huert...@gmail.com> wrote:

If I understand correctly, I will need to average the SimNIBS output per region, having a total number of regions equal to the ones I'm using for the model, right? (For example 74 if I use the predefine connectome of TVB).

Yes this implies also that you have used the mesh TVB provides or you derive a mapping from your mesh to TVB's, or something similar, otherwise averaging will not be possible.

I checked the code you sent me, but it is not that clear to me how to input the SimNIBS output at each time point since the output from SimNIBS is static in time.
Additionally, those this means that I need to input the SimNIBS averaged output and the sinusoidal stimulus (tACS)?

If SimNIBS' output is a static spatial pattern, then you would be able to use the following example,

filling in the spatial weighting with your static pattern, and then ascribe a temporal pattern you wish.

cheers,

### Silvana Huertas

Sep 26, 2022, 6:48:51 AM9/26/22
to TVB Users

I'm having some trouble finding the  mesh TVB provides, do you know where I can find it?

Kind regards,
Silvana

### WOODMAN Michael

Sep 26, 2022, 7:32:46 AM9/26/22
to TVB Users

hi

you can find the TVB demo datasets here

under the folder surfaceData you have a few relevant zip files, which will have face & vertex information in them.

You can also generate such files if you've processed a T1 with a tool like FreeSurfer.

cheers,

Sent: Monday, September 26, 2022 12:48:51 PM
To: TVB Users
Subject: [RESEAUX SOCIAUX] Re: [TVB] How to input tACS forward solution (FEM) into model

--
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.
Message has been deleted

### WOODMAN Michael

Oct 4, 2022, 3:59:47 AM10/4/22
to TVB Users

hi,

FreeSurfer is used to generate the meshes, yes.  There's an optional step of resampling to lower resolution.  The meshes are then converted to the simpler txt format by a Python script

cheers,

Sent: Tuesday, October 4, 2022 9:46:27 AM
To: TVB Users
Subject: [RESEAUX SOCIAUX] Re: [RESEAUX SOCIAUX] Re: [TVB] How to input tACS forward solution (FEM) into model

Hi,

I'm trying to use the .zip files that you mentioned into SimNIBS. I see that these files are .txt and contain the vertex and triangles of the surface.

If I input my T1 into TVB, when this calculates the mesh, the results of the mesh are in these .txt? If yes, which program is used by TVB to generate the mesh?
I though it was FreeSurfer but reading about this program I see that the outputs of this are not in .txt but in 'curv' and 'W' (https://surfer.nmr.mgh.harvard.edu/fswiki/FileFormats#:~:text=FreeSurfer%20File%20Formats,%2C%20xfm%2C%20m3d%20and%20lta)

Thank you,
Silvana

### Silvana Huertas

Oct 4, 2022, 6:41:36 AM10/4/22
to TVB Users
Hi,

I found a gifti file (sample.cortex.gii) in the folder https://zenodo.org/record/3497545#.YzGNkOxBw_Y. Those this file has the same data as the surfaceData but in another format?

Kind regards,
Silvana