mymesh.image.SurfaceNodeOptimization#
- mymesh.image.SurfaceNodeOptimization(M, img, h, iterate=1, threshold=0, FixedNodes={}, FixEdges=False, gaussian_sigma=1, smooth=True, copy=True, interpolation='linear', springs=True)[source]#
Optimize the placement of surface node to lie on the “true” surface. This This simultaneously moves nodes towards the isosurface and redistributes nodes more evenly, thus smoothing the mesh without shrinkage or destruction of features. This method is consistes of using the Z-flow (and R-flow if smooth=True) from [OB01].
- Parameters:
M (mymesh.mesh) – Mesh object
img (str or np.ndarray) – Image array or file path to an image
voxelsize (float) – Voxel size of the image
iterate (int, optional) – Number of iterations to perform, by default 1
FixedNodes (set, optional) – Nodes to hold in place during repositioning, by default set()
FixEdges (bool, optional) – Option to detect and hold in place exposed surface edges, by default False
gaussian_sigma (float, optional) – Standard deviation used for getting the gradient via convolution with a Gaussian kernel in units of voxels (see scipy.ndimage.gaussian_filter), by default 1 voxel.
smooth (str, optional) – Option to perform smoothing. This can be either ‘local’ for local Laplacian smoothing or ‘tangential’ for tangential Laplacian smoothing, by default ‘tangential’. For any other option, smoothing will not be performed. Tangential smoothing differs from local in that nodes are only repositioned in the tangent plane (based on the normal vector obtain from the gradient).
InPlace (bool, optional) – If False, will create a copy of the mesh, rather than altering node positions of the original mesh object “in-place”, by default False
interpolation (str, optional) – Interpolation method used for evaluating surface points inside the image using scipy.interpolate.RegularGridInterpolator (input must be one of the allowable “method” inputs), by default ‘linear’.
springs (bool, optional) – If True and the mesh is a volume mesh, internal nodes will be treated as if they are connected by springs (see
NodeSpringSmoothing()
) to reduce risk of element distortion or inversion, by default True.
- Returns:
M – Mesh with repositioned surface vertices
- Return type: