Python Library Documentation

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

I/O Functions

mesh_io.read_msh

Reads a gmsh '.msh' file

mesh_io.write_msh

Writes a gmsh 'msh' file

mesh_io.read_freesurfer_surface

Function to read FreeSurfer surface files

mesh_io.write_freesurfer_surface

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

mesh_io.read_gifti_surface

Reads a gifti surface

mesh_io.read_curv

Reads a freesurfer .curv file

mesh_io.write_curv

Writes a freesurfer .curv file

mesh_io.read_stl

Reads mesh surface in a .stl file

mesh_io.write_geo_spheres

Writes a .geo file with spheres in specified positions

mesh_io.write_geo_text

Writes a .geo file with text in specified positions

Mesh Classes

mesh_io.Msh

class to handle the meshes.

mesh_io.Nodes

class to handle the node information:

mesh_io.Elements

Mesh elements.

mesh_io.NodeData

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

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

file_finder.templates

Defines the Templates for file names used in SimNIBS

file_finder.get_atlas

Loads a brain atlas based of the FreeSurfer fsaverage template

file_finder.SubjectFiles

Class to find files for a given subject

Simulations

biot_savart.calc_B

Calculates the magnetic field caused by a current density distribution J

fem.calc_fields

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

fem.tdcs

Simulates a tDCS electric potential.

fem.tdcs_neumann

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

fem.tdcs_leadfield

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

fem.tms_dadt

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

fem.tms_coil

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

fem.tms_many_simulations

Function for running a large amount of TMS simulations.

fem.electric_dipole

Electric dipole simulations using the partial integration method