The purpose of this page is just to serve as todo or scratch pad for the development project and to list and share some ideas.

After making changes to the code and/or documentation, this page should remain on the wiki as a reminder of what was done and how it was done. However, there is no guarantee that this page is updated in the end to reflect the final state of the project

So chances are that this page is considerably outdated and irrelevant. The notes here might not reflect the current state of the code, and you should not use this as serious documentation.

Upon reviewing this page on the wiki, it seems to me that this project is not going to happen. Although the FieldTrip code base might be used (in combination with other code), the release code will not be extended to specifically facilitate this.

How to create a volumetric current density


What is the tutorial about This is relevant for TMS tDCS ….


What is TMS/tDCS Why we need current densities Overview about the methods which are used


A set of logical steps describing the pipeline, in Matlab, FieldTrip code or also from somewhere else (e.g. FreeSurfer) Examples with code/command lines instructions


  • segment inner skull from CT
  • segment the outer brain from the MRI
  • project the electrodes from CT onto inner skull (CT space)
  • superimpose two surfaces (electrodes are expressed in brain coordinates afterwards) This is done in SPM by coregistering CT to MRI images. This automatically gives the transfer matrix from CT to MRI coordinates (and hence you also have the electrodes expressed in MRI coordinates)

  • check the surface does not contain self intersections
  • mesh the brain triangulation with Tetgen
  • assign conductivity to nodes -> elements


  • convert mesh pnt and tri into a structure readable by Tetgen (.poly and .nodes)
  • run Tetgen
  • collect result (.node, .ele, (maybe .faces))


  • write wfmesh/elec/parameters/cond on disk
  • run SimBio solver

Alternatively (interactive)

  • write .mat files : elec/wfmesh/cond
  • write a SciRun schematic
  • run SciRun
  • collect solution and save it in a .mat file


  • discuss next steps


Is the output of SimBio/SciRun the stiffness matrix (profiles of current in the head)? (input: current, output: spatial current density)


General conclusions

Suggested readings

Other FT documentation pages