• Python

    from simnibs import optimization
    opt = optimization.TDCSoptimize()
    target = opt.add_target()


    opt = opt_struct('TDCSoptimize');


  • positions: Nx3 list/array of floats (Python/MATLAB)

    • Desctiption: Positions where the field is to be controlled. The positions are in world coordinates in subject space (see here or more information about coordinates in SimNIBS). SimNIBS finds the position in the mesh closest to the input position. These can be obtained by

      • Transforming positions from MNI space using the mni2subject_coords Python and MATLAB functions

      • Opening the m2m_subID/T1fs_conform.nii.gz file in a NIfTI reader and record the world coordinates.

      • Opening the tdcs_leadfield/subID_ROI.msh file in gmsh, click in Mesh -> Inspect and click in the model

  • directions: ‘normal’, None/’none’, or Nx3 list/array of floats (Python/MATLAB), optional

    • Description: Direction of the field to be controlled.

      • If set to 'normal' (default) and the leadfield was run with map_to_surf (default) or surface ROIs, will control the electric fields in the normal direction.

      • If set to None (Python) or 'none' (MATLAB), will control electric field strength (magnitude).

    • Defaut: 'normal'

  • indexes: Nx1 list/array of ints (Python/MATLAB), optional

    • Description: As an alternative to positions, you can select the node index or the element index, depending on the type of leadfield.

    • Default: Get the points closest to the positions.

  • intensity: float, optional

    • Description: Intensity of the field (E or J, see TDCSLEADFIELD) to be reached on average on the target and along the given direction. To optimize for intensity at the target rather than focality, you can set this value to a large number (eg: 100). With negative values, the direction will be inverted.

    • Defaut: 0.2

  • max_angle: float, optinal

    • Description: Maximum angle between field and target direction.

    • Default: No maximum


    This condition is only fulfilled in the mean across the target region, and not point-wise. Does not work in multi-target optimization.

  • radius: float, optional

  • Description: All points in the radius around the specified position/index to be added to the target area, in mm. Set to 0 if you want the target to be only the specified positions or indices.

  • Default: 2

  • tissues: list/array of ints (Python/MATLAB), optional

    • Descrption: List of tissue indices where the target is defined. Leave empty if all tissues in the leadfield. This allows you to prevent that nearby tissue regions are included in the target (e.g. white matter or CSF bordering a target in GM , assuming that all three tissues were included in the leadfield).

    • Default: All tissues


Saturnino, G. B., Siebner, H. R., Thielscher, A., & Madsen, K. H. (2019). Accessibility of cortical regions to focal TES: Dependence on spatial position, safety, and practical constraints. NeuroImage, 203, 116183.