Automate extract centerline with unconnected segment

Hi.

I wanna extract center line of a segmentation that is unconnected. I have a script that do it automatically but when get this segmentation just extract center line partly not all.

Screenshot from 2022-10-23 17-41-40

Do anybody have a solution for it?

thanks

For best results, it would be better to improve the segmentation so that there is no discontinuity in the vessel tree. If you find that too difficult to do it automatically then you can split the segments, detect centerline in each segment separately, and then create an automatic algorithm that merges centerlines.

thanks for response.

is there a method to get endpoints for hole sementation instead of partly like my example with unconnected segment?

thanks

It would be straightforward to implent such algorithm, for example by splitting the polydata so that you have one connected component in each resulting polydata and process each polydata one by one. However, does not seem to be commonly needed and it would make the current implementation more complex, so I don’t think anyone would start working on this right now (until many small projects or one funded projects need this).

Fortunately, the Extract Centerline module is just a Python scripted module, if you have a little experience in Python and interested in learning a bit about VTK and VMTK libraries then you can add this feature. We can help you if you get stuck at any point.

thank you Andras.

i will try it and if i have any problems let you know to help.