# merge-surfaces¶

## Synopsis¶

merge-surfaces [options]
merge-surfaces [<input>...] <output> [options]


## Description¶

Merge surface meshes at segmentation label boundaries. The input surfaces must follow closely the boundary of a segment in the given image segmentation. Two surfaces are then merged at the longest common intersection boundary. When the two surfaces share no such segmentation boundary, the surfaces are not connected.

## Arguments¶

input

File name of input surface mesh.

output

File name of output surface mesh.

## Command options¶

-i, -input <file>...

Input surfaces. These are added to the list of input surfaces to be merged after the <input> arguments.

-o, -output <file>

Output surface file. When this option is given, the <output> argument is appended to the <input> surfaces before any surface specified using -i. Either this option or an <output> argument is required.

-labels <file>

Segmentation labels image. Currently required.

-labels-percentage <value>

Percentage of voxels within an input surface that must have the same label to be considered for determining boundaries between segments.

-source-array <name>

Add point/cell data array with the specified name with one-based labels corresponding to the input point set from which an output point/cell originates from. When the first input point set has a scalar array with the specified name, the labels of this first surface are preserved, while successive labels are offset by the maximum integer value of the input data array. This is useful when successively merging surface meshes instead of with a single execution of this command. (default: none)

-point-source-array <name>

Name of output point data -source-array.

-cell-source-array <name>

Name of output cell data -source-array.

-join [on|off], -nojoin

Whether to join surfaces at intersection boundaries. When off, the output data set has unconnected components. (default: on)

-largest [on|off]

Retain only largest surface component after -join of boundaries. (default: off)

-tolerance, -tol <float>

Maximum distance of an input cell from the segmentation boundary to be removed. The resulting intersection boundary edges are joined again after the removal of these cells. (default: max voxel size)

-smooth-boundaries, -boundary-smoothing [<n>]

Number of intersection boundary edge smoothing iterations. (default: 3)

-nosmooth-boundaries, -noboundary-smoothing

Disable smoothing of boundaries, same as -smooth-boundaries 0.

-remeshing, -remesh [<n>]

Enable remeshing of newly inserted triangles at intersection boundaries. The default number of remeshing iterations <n> is 3. A different value can be specified using this option or -remeshing-iterations. (default: 3)

-remeshing-iterations, -remesh-iterations

Number of intersection triangle remeshing iterations. (default: 3)

-noremeshing, -noremesh

Disable remeshing of newly inserted intersection triangles, same as -remeshing or -remeshing-iterations 0.

-edge-length <min> [<max>]

Edge length range for remeshing newly inserted triangles at intersection boundaries. When min and/or max edge length not specified, the range is chosen based on the mean local edge length of the input meshes at the intersection boundaries minus/plus -edge-length-sigma times the local standard deviation of input mesh edge lengths.

-min-edge-length <min>

Minimum edge length for remeshing of newly inserted triangles.

-max-edge-length <min>

Maximum edge length for remeshing of newly inserted triangles.

-edge-length-sigma <scale>

Standard deviation scaling factor of local edge length standard deviation used to set min/max edge length range for local remeshing of newly inserted triangles at intersection boundaries. (default: 2)

-smoothing, -smooth [<n>]

Enable smoothing of merged surface points nearby intersection boundaries. When -smoothing-mu is zero or NaN, Gaussian weighting function is used for the mesh smoothing. Otherwise, a uniform weighting is used. (default: 0)

-smoothing-iterations, -smooth-iterations

Number of intersection points smoothing iterations. (default: 0)

-nosmoothing, -nosmooth

Disable smoothing of nearby intersection points, same as -smoothing or -smoothing-iterations 0.

-smoothing-lambda, -smooth-lambda <float>

Lambda parameter used for odd iterations of Laplacian point -smoothing. The default value is set based on the -smooth-mu parameter. (default: abs(mu) - .01) When only -smoothing-lambda is given, -smoothing-mu is set to to the same value and a Gaussian weighting function is used.

-smoothing-mu, -smooth-mu <float>

Lambda parameter used for even iterations of Laplacian point -smoothing. The default smoothing parameters avoid shrinking of the surface mesh and serve mainly to relax any small self-intersections that may have been introduced while joining the split input surfaces. (default: -.75)

-neighborhood, -neighbourhood, -radius <int>

Edge connectivity radius around intersection border cells/points used to define the local neighborhood for which to apply the remeshing and smoothing operations. See also -remeshing-neighborhood.

-remeshing-neighborhood, -remeshing-radius <int>

Edge connectivity radius around intersection border cells/points used to define neighborhood for which to apply the -remeshing. (default: 3)

-smoothing-neighborhood, -smoothing-radius <int>

Edge connectivity radius around intersection border cells/points used to define neighborhood for which to apply the -smoothing. (default: 2)

-smooth-source, source-smoothing [<n>]

Number of iterations for which to smooth the -source-array labels to form smoother boundaries between intersection borders.

-dividers [on|off], -nodividers

Enable/disable insertion of segmentation cutting planes at mesh intersections. The -source-array has unique negative labels for each such inserted divider surface patch which enable the extraction or removal of these dividers again when a genus-0 surface is required again. (default: off)

-normals [on|off], -nonormals

Enable/disable output of surface point and cell normals. (default: on)

-point-normals [on|off], -nopoint-normals

Enable/disable output of surface point normals. (default: on)

-cell-normals [on|off], -nocell-normals

Enable/disable output of surface cell normals. (default: on)

## Standard options¶

-v, -verbose [n]

Increase/Set verbosity of output messages. (default: 0)

-debug [level]

Increase/Set debug level for output of intermediate results. (default: 0)

-version [major.minor]

Print version and exit or set version to emulate.

-revision

Print revision (or version) number only and exit.

-h, -help

Print help and exit.