Automatic Endpoint Detection and Centerline Extraction for Bronchoscopy

Hi,
I have a c++ application developed for centerline extraction for segmented airway in c++ using vtk8.1 and vmtk. For centerline extraction before we used to select one seedpoint as input and multiple seedpoint as output. We are passing STL files as input.
I need help in detection of all the endpoints for the segmented airway and to extract centerline for the same in c++.
I am trying to develop this in c++ and in a single application.