simnibs.utils.transformations.mni2subject_coilpos

simnibs.utils.transformations.mni2subject_coilpos(coilpos, m2m_dir, coil_skin_distance=0.0, transformation_type='nonl')

Converts one or more coil positions to subject space.

NOTE: Coil centers are projected on the head surface as standard. Set

coil_skin_dist to ensure a specific distance of the coil center to the head surface.

Coil centers away from the head are best defined by providing the closest positon on the surface of the MNI head and the desired coil-skin-distance.

Non-linear transformations (used as default) are accurate for positions in the head and on its surface, but not outside the head. Thus, coil centers are automatically projected on the head surface during transformation.

Parameters:
  • coilpos (One or more coil positions, provided as:) –

    • matsimnibs (4x4 numpy array or list of lists)

    • list of several matsimnibs

    • tuple (center, ydir, zdir)
      center, ydir and zdir:

      vectors (length 3) in case of a single postion, or arrays (N,3) for N positions

  • m2m_dir (str) – Path to the m2m_{subject_id} folder, generated during the segmentation

  • coil_skin_distance (float or list, optional) – skin-coil distance in [mm]. In case of several coil positions, either a single value can be supplied that is used for all positions, or a list with one value per position can be supplied. The default is 0..

  • transformation_type ({'nonl', '6dof', '12dof'}, optional) – Type of tranformation: non-linear, 6 or 12 degrees of freedom. The default is ‘nonl’.

Returns:

matsimnibs – TMS coil matrix (or list of matrices) in subject space.

Return type:

numpy array (4x4) or list of numpy arrays