How to obtain the complete center lines using VMTK?

Summary: I’ve tested your data set and everything worked well if I made branches a bit thicker. VMTK’s centerline extraction cannot seem to be able to track down endpoints though narrow, pointy tips.

Details:

I’ve imported the mask into a segmentation node Slicer and ran it through VMTK extension’s Extract centerline module:

# Load mask into labelmap volume
import numpy as np
d = np.load(r'c:\Users\andra\OneDrive\Projects\SlicerTesting5\20201019-AirwayNetworkAnalysis\PA000019.npz', allow_pickle=True)
volumeNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLLabelMapVolumeNode")
slicer.util.updateVolumeFromArray(volumeNode, d['isoMask'])

# Convert labelmap volume to segmentation node
segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
slicer.vtkSlicerSegmentationsModuleLogic.ImportLabelmapToSegmentationNode(volumeNode, segmentationNode)
segmentationNode.CreateClosedSurfaceRepresentation()

Automatic endpoint detection worked well:

Centerline detection did not succeed - path was not found to endpoints that were connected to the bronchial tree with a narrow branch/sharp tip:

I’ve fixed the narrow branches by oversampling the image by a factor of 2x (subdivide every voxel by 2x2x2) and applying Margin effect in Segment editor:

After this, centerline extraction worked flawlessly:

Original mask (in interactive web viewer):

Dilated mask (in interactive web viewer):

2 Likes