# TotalSegmentator for only segmenting the spine

**URL:** <https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [December 14, 2022, 4:33pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734 "2022-12-14T16:33:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [December 14, 2022, 4:33pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/1 "2022-12-14T16:33:23Z")

</div>

hi,

can we use this just to segment spine in isolation?

Please advise

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 14, 2022, 4:47pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/2 "2022-12-14T16:47:39Z")

</div>

Yes, it already segments each vertebra separately. You can show on vertebra or all vertebra, and hide everything else.

---

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [December 14, 2022, 4:50pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/3 "2022-12-14T16:50:20Z")

</div>

Thanks for the prompt reply

What I meant was

So if we can adapt this to just segment spine then it will take less processing power and time rather than segment everything and hide rest

Is that possible?

Best Regards,  
Dr. Varun Agarwal

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 14, 2022, 5:00pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/4 "2022-12-14T17:00:23Z")

</div>

You cannot easily gain time by ignoring all the other structures, other than deleting segments before show 3D.

If you want to speed up the segmentation by segmenting less structures then you would need to modify the model. There are a few examples in TotalSegmentator for a two-stage approach: first perform a fast overall segmentation to get a region of interest and then run a refined model for that region. But the aim there is to improve the segmentation quality.

Is the few-minute computation time a problem or you have been just wondering if it could be easily reduced?

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [December 14, 2022, 7:41pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/5 "2022-12-14T19:41:01Z")

</div>

As Andras said, you would need to segment all structures, as the selective programs are only implemented for a few use cases.

But you could use the “Filter” function in “Segmentations” as [shown here](https://youtu.be/osvMB5SKcVQ?t=90) to just display the vertebrae.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 20, 2022, 5:05am UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/6 "2022-12-20T05:05:21Z")

</div>

I’ve realized that you can actually complete the full-resolution segmentation faster if you only need the spine, because the model is trained in 5 groups (organs, vertebrae, cardiac, muscles, ribs) and you could modify the implementation to only compute the vertebrae group.

---

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [January 25, 2023, 3:58pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/7 "2023-01-25T15:58:19Z")

</div>

how about marking ROI first manually  
cropping it out  
and then running total segmentator

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 25, 2023, 7:31pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/8 "2023-01-25T19:31:02Z")

</div>

No need to mark the ROI manually first, as the vertebrae are segmented using a single model. If you crop the image then processing might be a little bit faster because some preprocessing steps may take longer for a larger image. However, you can expect much bigger speed improvement (processing may be 5x faster) by l running only the task necessary for spine segmentation. You can experiment with simply changing a [single line in the TotalSegmentator executable script](https://github.com/wasserth/TotalSegmentator/blob/master/bin/TotalSegmentator#L113) in your Slicer installation (`...\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator`).

---

<div class="post-metadata">

**Author:** ![wesselk](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wesselk](https://discourse.slicer.org/u/wesselk)\
**Post date:** [November 6, 2023, 10:59pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/9 "2023-11-06T22:59:25Z")

</div>

This is now possible in Total Segmentator 2. From their [documentation](https://github.com/wasserth/TotalSegmentator#advanced-settings):

> `--roi_subset` : Takes a space-separated list of class names (e.g. `spleen colon brain` ) and only predicts those classes.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [November 7, 2023, 9:59am UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/10 "2023-11-07T09:59:22Z")

</div>

Yes, we will implement it in the next version of the extension which will be out when 3D Slicer 5.5.0 becomes stable version.

---

<div class="post-metadata">

**Author:** ![drvarunagarwal](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drvarunagarwal/32/8914_2.png) [@drvarunagarwal](https://discourse.slicer.org/u/drvarunagarwal)\
**Post date:** [December 17, 2023, 5:49pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/11 "2023-12-17T17:49:42Z")

</div>

hello all

I tried totalsegmentator  
Needless to say that it is a brilliant extension

I tried to segement partially  
When I select “vertebral body” as segmentation task only the body is segmented and not the pedicles or spinous processes

however when I select “total” as segmentation task then whole vertebrae are segmented - in addition to rest of the stuff

how to segement whole of vertebrae only without other things or only bones?

Please advise  
thanks

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 17, 2023, 8:34pm UTC](https://discourse.slicer.org/t/totalsegmentator-for-only-segmenting-the-spine/26734/12 "2023-12-17T20:34:38Z")

</div>

Vertebral body segmentation model only segments the vertebral body, not the processes.

In our projects we merge and remove the segments/details that we don’t need.

It could be possible to slightly reduce the execution time if you only run the bone segmentation subtask, but that would require some development in the extension and maybe slight changes in TotalSegmentator as well. We don’t plan to work on this right now, so you would need to find someone to work on it (but we can help with advice).
