# algorithms.mesh¶

## ComputeMeshWarp¶

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()
```

Inputs:

```[Mandatory]
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]
metric: ('euclidean' or 'sqeuclidean', nipype default value:
euclidean)
norm used to report distance
weighting: ('none' or 'area', nipype default value: none)
"none": no weighting is performed, surface": edge distance is
weighted by the corresponding surface area
out_warp: (a pathlike object or string representing a file, nipype
default value: surfwarp.vtk)
vtk file based on surface1 and warpings mapping it to surface2
out_file: (a pathlike object or string representing a file, nipype
default value: distance.npy)
numpy file keeping computed distances and weights
```

Outputs:

```distance: (a float)
computed distance
out_warp: (a pathlike object or string representing an existing file)
vtk file with the vertex-wise mapping of surface1 to surface2
out_file: (a pathlike object or string representing an existing file)
numpy file keeping computed distances and weights
```

## MeshWarpMaths¶

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()
```

Inputs:

```[Mandatory]
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, nipype default value: 1.0)
image, float or tuple of floats to act as operator

[Optional]
float_trait: (a float or a tuple of the form: (a float, a float, a
float))
operation: ('sum' or 'sub' or 'mul' or 'div', nipype default value:
sum)
operation to be performed
out_warp: (a pathlike object or string representing a file, nipype
default value: warp_maths.vtk)
vtk file based on in_surf and warpings mapping it to out_file
out_file: (a pathlike object or string representing a file, nipype
default value: warped_surf.vtk)
vtk with surface warped
```

Outputs:

```out_warp: (a pathlike object or string representing an existing file)
vtk file with the vertex-wise mapping of surface1 to surface2
out_file: (a pathlike object or string representing an existing file)
vtk with surface warped
```

## P2PDistance¶

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.

Inputs:

```[Mandatory]
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]
metric: ('euclidean' or 'sqeuclidean', nipype default value:
euclidean)
norm used to report distance
weighting: ('none' or 'area', nipype default value: none)
"none": no weighting is performed, surface": edge distance is
weighted by the corresponding surface area
out_warp: (a pathlike object or string representing a file, nipype
default value: surfwarp.vtk)
vtk file based on surface1 and warpings mapping it to surface2
out_file: (a pathlike object or string representing a file, nipype
default value: distance.npy)
numpy file keeping computed distances and weights
```

Outputs:

```distance: (a float)
computed distance
out_warp: (a pathlike object or string representing an existing file)
vtk file with the vertex-wise mapping of surface1 to surface2
out_file: (a pathlike object or string representing an existing file)
numpy file keeping computed distances and weights
```

## TVTKBaseInterface¶

A base class for interfaces using VTK

Inputs:

```None
```

Outputs:

```None
```

## WarpPoints¶

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 with `nipype.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()
```

Inputs:

```[Mandatory]
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
interp: ('cubic' or 'nearest' or 'linear', nipype default value:
cubic)
interpolation

[Optional]
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
```