How to extract the centerline from a segmentation


Since 4.0.0, the feature to compute the centerline from a spinal cord segmentation is not available in sct_process_segmentation. I cannot find where it has been moved.

Could you help me?

Many thanks,


Hi Benjamin,

I think we removed that feature from the CLI because we did not see any reason for people to work with a centerline. What would be your use case? Note that it is still accessible via the API:


I was working in the context of MT images, with a MTon, MToff and a T1w. Segmenting the spinal cord on MTon and MToff was difficult so I though of using the centerline coming from the T1w segmentation as an initialization. Without the tool to get the centerline from a segmentation, this is difficult.

Meanwhile, I found another solution to my problem so I overcome this issue.

Hi Benjamin,

I’m not sure what segmentation tool you are using, but regardless, both sct_propseg (option -init-centerline) and sct_deepseg_sc (option -centerline file -file_centerline FILENAME) take the center-of-mass of the input “centerline”. So in your case, inputting the T1w segmentation would automatically compute the centerline of the input T1w segmentation, and use it as initialization for segmenting your Mton or MToff image.