Fit splines to center of irregular 3d tube

Dear everyone,

I have a dataset with multiple structures which are shaped like irregular 3d tubes, I was wondering if it is possible to fit a spline through the approximate center of such structures (I have both isosurfaces and volume data) … Here is an example:

Like transforming the isosurfaces to solids and then calculate the centerline based on an the middle point for each coordinate

Is there any way to do so or any example that can be reutilized?

Thanks in advance