nipype.algorithms.mesh module¶
Miscellaneous algorithms for 2D contours and 3D triangularized meshes handling
ComputeMeshWarp¶
Bases: TVTKBaseInterface
Calculates a the vertex-wise warping to get surface2 from surface1. It also reports the average distance of vertices, using the norm specified as input.
Example:
import nipype.algorithms.mesh as m dist = m.ComputeMeshWarp() dist.inputs.surface1 = 'surf1.vtk' dist.inputs.surface2 = 'surf2.vtk' res = dist.run()
- Mandatory Inputs:
surface1 (a pathlike object or string representing an existing file) – Reference surface (vtk format) to which compute distance.
surface2 (a pathlike object or string representing an existing file) – Test surface (vtk format) from which compute distance.
- Optional Inputs:
metric (‘euclidean’ or ‘sqeuclidean’) – Norm used to report distance. (Nipype default value:
euclidean
)out_file (a pathlike object or string representing a file) – Numpy file keeping computed distances and weights. (Nipype default value:
distance.npy
)out_warp (a pathlike object or string representing a file) – Vtk file based on surface1 and warpings mapping it to surface2. (Nipype default value:
surfwarp.vtk
)weighting (‘none’ or ‘area’) – “none”: no weighting is performed, surface”: edge distance is weighted by the corresponding surface area. (Nipype default value:
none
)- Outputs:
distance (a float) – Computed distance.
out_file (a pathlike object or string representing an existing file) – Numpy file keeping computed distances and weights.
out_warp (a pathlike object or string representing an existing file) – Vtk file with the vertex-wise mapping of surface1 to surface2.
MeshWarpMaths¶
Bases: TVTKBaseInterface
Performs the most basic mathematical operations on the warping field defined at each vertex of the input surface. A surface with scalar or vector data can be used as operator for non-uniform operations.
Example:
import nipype.algorithms.mesh as m mmath = m.MeshWarpMaths() mmath.inputs.in_surf = 'surf1.vtk' mmath.inputs.operator = 'surf2.vtk' mmath.inputs.operation = 'mul' res = mmath.run()
- Mandatory Inputs:
in_surf (a pathlike object or string representing an existing file) – Input surface in vtk format, with associated warp field as point data (ie. from ComputeMeshWarp.
operator (a float or a tuple of the form: (a float, a float, a float) or a pathlike object or string representing an existing file) – Image, float or tuple of floats to act as operator. (Nipype default value:
1.0
)- Optional Inputs:
float_trait (a float or a tuple of the form: (a float, a float, a float))
operation (‘sum’ or ‘sub’ or ‘mul’ or ‘div’) – Operation to be performed. (Nipype default value:
sum
)out_file (a pathlike object or string representing a file) – Vtk with surface warped. (Nipype default value:
warped_surf.vtk
)out_warp (a pathlike object or string representing a file) – Vtk file based on in_surf and warpings mapping it to out_file. (Nipype default value:
warp_maths.vtk
)- Outputs:
out_file (a pathlike object or string representing an existing file) – Vtk with surface warped.
out_warp (a pathlike object or string representing an existing file) – Vtk file with the vertex-wise mapping of surface1 to surface2.
P2PDistance¶
Bases: ComputeMeshWarp
Calculates a point-to-point (p2p) distance between two corresponding VTK-readable meshes or contours.
A point-to-point correspondence between nodes is required
Deprecated since version 1.0-dev: Use
ComputeMeshWarp
instead.
- Mandatory Inputs:
surface1 (a pathlike object or string representing an existing file) – Reference surface (vtk format) to which compute distance.
surface2 (a pathlike object or string representing an existing file) – Test surface (vtk format) from which compute distance.
- Optional Inputs:
metric (‘euclidean’ or ‘sqeuclidean’) – Norm used to report distance. (Nipype default value:
euclidean
)out_file (a pathlike object or string representing a file) – Numpy file keeping computed distances and weights. (Nipype default value:
distance.npy
)out_warp (a pathlike object or string representing a file) – Vtk file based on surface1 and warpings mapping it to surface2. (Nipype default value:
surfwarp.vtk
)weighting (‘none’ or ‘area’) – “none”: no weighting is performed, surface”: edge distance is weighted by the corresponding surface area. (Nipype default value:
none
)- Outputs:
distance (a float) – Computed distance.
out_file (a pathlike object or string representing an existing file) – Numpy file keeping computed distances and weights.
out_warp (a pathlike object or string representing an existing file) – Vtk file with the vertex-wise mapping of surface1 to surface2.
TVTKBaseInterface¶
Bases: BaseInterface
A base class for interfaces using VTK
WarpPoints¶
Bases: TVTKBaseInterface
Applies a displacement field to a point set given in vtk format. Any discrete deformation field, given in physical coordinates and which volume covers the extent of the vtk point set, is a valid
warp
file. FSL interfaces are compatible, for instance any field computed withnipype.interfaces.fsl.utils.ConvertWarp
.Example:
from nipype.algorithms.mesh import WarpPoints wp = WarpPoints() wp.inputs.points = 'surf1.vtk' wp.inputs.warp = 'warpfield.nii' res = wp.run()
- Mandatory Inputs:
interp (‘cubic’ or ‘nearest’ or ‘linear’) – Interpolation. (Nipype default value:
cubic
)points (a pathlike object or string representing an existing file) – File containing the point set.
warp (a pathlike object or string representing an existing file) – Dense deformation field to be applied.
- Optional Inputs:
out_points (a pathlike object or string representing a file) – The warped point set.
- Outputs:
out_points (a pathlike object or string representing a file) – The warped point set.