Python Library Documentation

SimNIBS main programming language is Python. Here you can see documentation for the main modules used in SimNIBS.

I/O Functions

read_msh

Reads a gmsh '.msh' file

write_msh

Writes a gmsh 'msh' file

read_freesurfer_surface

Function to read FreeSurfer surface files

write_freesurfer_surface

Writes a FreeSurfer surface Only the surfaces (triangles) are writen to the FreeSurfer surface file

read_gifti_surface

Reads a gifti surface

read_curv

Reads a freesurfer .curv file

write_curv

Writes a freesurfer .curv file

read_stl

Reads mesh surface in a .stl file

write_geo_spheres

Writes a .geo file with spheres in specified positions

write_geo_text

Writes a .geo file with text in specified positions

Mesh Classes

Msh

class to handle the meshes.

Nodes

class to handle the node information:

Elements

Mesh elements.

NodeData

Data (scalar, vector or tensor) defined in mesh nodes.

ElementData

Data (scalar, vector or tensor) defined in mesh elements.

Transformations

subject2mni_coords

Warps a set of coordinates in subject space to MNI space

mni2subject_coords

Warps a set of coordinates in MNI space to subject space

subject_atlas

Loads a brain atlas based of the FreeSurfer fsaverage template

Utilities

templates

Defines the Templates for file names used in SimNIBS

get_atlas

Loads a brain atlas based of the FreeSurfer fsaverage template

SubjectFiles

Class to find files for a given subject

Simulations

simulation.calc_B

Calculates the magnetic field caused by a current density distribution J

simulation.calc_fields

Given a mesh and the electric potentials at the nodes, calculates the fields

simulation.tdcs

Simulates a tDCS electric potential.

simulation.tdcs_neumann

Simulates a tDCS electric potential using Neumann boundary conditions on the electrodes.

simulation.tdcs_leadfield

Simulates tDCS fields using Neumann boundary conditions and writes the output electric fields to an HDF5 file.

simulation.tms_dadt

Simulates a TMS electric potential from a dA/dt field.

simulation.tms_coil

Simulates TMS fields using a coil + matsimnibs + dIdt definition.

simulation.tms_many_simulations

Function for running a large amount of TMS simulations.

simulation.electric_dipole

Electric dipole simulations using the partial integration method