openlifu.seg.skinseg.create_closed_surface_from_labelmap¶
- openlifu.seg.skinseg.create_closed_surface_from_labelmap(binary_labelmap: vtkImageData, decimation_factor: float = 0.0, smoothing_factor: float = 0.5) vtkPolyData[source]¶
Create a surface mesh vtkPolyData from a binary labelmap vtkImageData.
- Parameters:
binary_labelmap – input vtkImageData binary labelmap
decimation_factor – 0.0 for no decimation, 1.0 for maximum reduction.
smoothing_factor – 0.0 for no smoothing, 1.0 for maximum smoothing.
- Returns:
the resulting surface mesh
- Return type:
vtkPolyData
The algorithm here is based on the labelmap-to-closed-surface algorithm in 3D Slicer: https://github.com/Slicer/Slicer/blob/677932127c73a6c78654d4afd9458a655a4eef63/Libs/vtkSegmentationCore/vtkBinaryLabelmapToClosedSurfaceConversionRule.cxx#L246-L476