What underlying concepts are being used going from segmentation to .STL

I’m currently developing a program which has some of the same features as Slicer. Eventually, I get a .STL file and extract the centerline from it. However, when I apply this to my own generated .STL files, it doesn’t work compared to the ones being made in Slicer. It made me think that the segmentations/models are actually volumetric meshes instead of surface meshes, but I’m not sure whether I’m correct. And how does Slicer generate these volumetric meshes (if they are) from segmentations?
Cheers.

please read this document for answers to your questions:
Image Segmentation — 3D Slicer documentation