meegpype.interfaces.custom.fit_surface moduleπŸ”—

class meegpype.interfaces.custom.fit_surface.FitSurfaceToMask(from_file=None, resource_monitor=None, ignore_exception=False, **inputs)πŸ”—

Bases: BaseInterface

Fit a deformable spherical template to the boundary of a mask.

An icosahedron enclosing the mask is shrunk until it reaches the iso-surface of the signed distance to the mask at offset mm, while a smoothing term keeps the mesh regular. The surface keeps the topology of MNE’s icosahedron, so it can be used directly with mne.make_bem_model(ico=...).

Mandatory Inputs:
  • in_mask (a string or os.PathLike object referring to an existing file) – The path to a binary mask volume (any non-zero voxel is in the mask).

  • in_reference (a string or os.PathLike object referring to an existing file) – The path to a FreeSurfer volume of the subject (e.g. T1.mgz), used to express the surface in FreeSurfer surface RAS coordinates.

  • output_surface (a string or os.PathLike object) – The path to the output surface mesh.

Optional Inputs:
  • ico (an integer) – Subdivision of the icosahedron used as template (4 = 5120 triangles). (Nipype default value: 4)

  • n_iterations (an integer) – Maximum number of deformation iterations. (Nipype default value: 1000)

  • offset (a float) – Distance (mm) between the mask boundary and the fitted surface. Positive values place the surface outside the mask. (Nipype default value: 0.0)

Outputs:

output_surface (a string or os.PathLike object referring to an existing file) – The path to the output surface mesh.

meegpype.interfaces.custom.fit_surface.fit_surface_to_mask(in_mask, in_reference, offset=0.0, ico=4, n_iterations=1000)πŸ”—

Fit an icosahedral surface to the iso-surface at offset mm of a mask.

Returns the vertices (FreeSurfer surface RAS, mm), the triangles and the volume info of the reference volume.