Function: smoothContours()
smoothContours(
segmentationId,segmentIndex,options):void
Smooths contour polylines for a given segmentation and segment using B-spline interpolation. This function applies smoothing to reduce jagged edges and create more natural-looking contours while preserving the overall shape and important features.
Parameters
• segmentationId: string
The unique identifier of the segmentation
• segmentIndex: number
The index of the segment within the segmentation
• options = ...
Configuration options for smoothing
• options.knotsRatioPercentage: number
The percentage of points to use as knots for interpolation (default: 30) This parameter controls the balance between smoothing quality and shape preservation:
- Higher values (50-70%): Use more original points as control knots, which tends to degrade the smoothing effect as the spline follows the original contour more closely. Results in less smooth curves but better preservation of original shape details.
- Lower values (10-20%): Use fewer original points as control knots, creating smoother curves but may cause contour deformation, especially when the original contour has few points. With insufficient control points, the spline may not accurately represent the intended shape.
- Optimal range (20-40%): Generally provides good balance between smoothing and shape fidelity.
Returns
void
Defined in
tools/src/stateManagement/segmentation/utilities/smoothContours.ts:33