Automatic centerline

Hi Andras, do you have any ideas for how to solve this current issue? I am hoping that what I want to do is quite simple but I’m struggling with the programmatic implementation.
As before my end goal is to feed in an already level set thresholded .vtp model and use the auto detect endpoints function to find the endpoints then compute the centreline.
I am able to feed in the .vtp model but I’m struggling with programming of the auto detect endpoints function.
Any assistance you’re able to provide would be very much appreciated.