scilpy.surfaces package

scilpy.surfaces.surface_operations module

scilpy.surfaces.surface_operations.apply_transform(mesh, linear_transfo, deformation_img=None, inverse=False)[source]
Apply transformation to a surface
  • Apply linear transformation with affine

  • Apply non linear transformation with ants_warp

Parameters:
  • mesh (trimeshpy - Triangle Mesh VTK class) – Moving surface

  • linear_transfo (numpy.ndarray) – Transformation matrix to be applied

  • deformation_img (nib.Nifti1Image) – Warp image from ANTs

  • inverse (boolean) – Apply the inverse linear transformation.

Returns:

mesh – Surface moved

Return type:

trimeshpy - Triangle Mesh VTK class

scilpy.surfaces.surface_operations.flip(mesh, axes)[source]

Apply flip to a surface

Parameters:
  • mesh (trimeshpy - Triangle Mesh VTK class) – Moving surface

  • axes (list) – Axes (or normal orientation) you want to flip

Returns:

mesh – Surface flipped

Return type:

trimeshpy - Triangle Mesh VTK class

scilpy.surfaces.utils module

scilpy.surfaces.utils.convert_freesurfer_into_polydata(surface_to_polydata, reference)[source]

Convert a freesurfer surface into a polydata surface with vtk.

Parameters:
  • surface_to_vtk (Input a surface from freesurfer.) – The header must not contain any of these suffixes: ‘.vtk’, ‘.vtp’, ‘.fib’, ‘.ply’, ‘.stl’, ‘.xml’, ‘.obj’.

  • reference (Reference image to extract the transformation matrix.) – The reference image is used to extract the transformation matrix

Returns:

polydata – A polydata is a mesh structure that can hold data arrays in points, cells, or in the dataset itself.

Return type:

A polydata surface.

scilpy.surfaces.utils.flip_surfaces_axes(polydata, axes=[-1, -1, 1])[source]

Apply a flip to the freesurfer surface of the anteroposterior axis.

Parameters:

polydata (polydata surface.) – A surface mesh structure after a transformation in polydata surface with vtk.

Returns:

polydata – return the polydata turned over.

Return type:

polydata surface.