scilpy.surfaces package
scilpy.surfaces.surface_operations module
- scilpy.surfaces.surface_operations.apply_transform(mesh, ants_affine, ants_warp=None)[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
ants_affine (numpy.ndarray) – Transformation matrix to be applied
ants_warp (nib.Nifti1Image) – Warp image from ANTs
- Returns:
mesh – Surface moved
- Return type:
trimeshpy - Triangle Mesh VTK class
scilpy.surfaces.utils module
- scilpy.surfaces.utils.convert_freesurfer_into_polydata(surface_to_polydata, xform)[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’.
xform (array [float]) – Apply a transformation matrix to the surface to align freesurfer surface with T1.
- 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.extract_xform(xform)[source]
Use the log.txt file from mri_info to generate a transformation matrix to align the freesurfer surface with the T1.
- Parameters:
filename (list) – The copy-paste output from mri_info of the surface using: mri_info $surface >> log.txt
- Returns:
Matrix – a transformation matrix to align the surface with the T1.
- Return type:
np.array
- scilpy.surfaces.utils.flip_LPS(polydata)[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.