# Love totalSegmentator!-anyway to batch output multiple studies?

**URL:** <https://discourse.slicer.org/t/love-totalsegmentator-anyway-to-batch-output-multiple-studies/27828>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [February 15, 2023, 4:13pm UTC](https://discourse.slicer.org/t/love-totalsegmentator-anyway-to-batch-output-multiple-studies/27828 "2023-02-15T16:13:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![artycho](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@artycho](https://discourse.slicer.org/u/artycho)\
**Post date:** [February 15, 2023, 4:13pm UTC](https://discourse.slicer.org/t/love-totalsegmentator-anyway-to-batch-output-multiple-studies/27828/1 "2023-02-15T16:13:35Z")

</div>

Operating system: windows 10  
Slicer version: 5.2.1  
Expected behavior:  
Actual behavior:

Hello, Great work on the TotalSegmentator!  
Cannot believe that TotalSegmentator can precisely identify so many organs at one time!

I have two questions on total segmentator:

1. I would like to use T.S. for multiple studies, is there a command line that I can use to batch open a patient in the slicer database, have T.S. segment the organs, then save the ROIs as nifti file, or better yet, have the CT housenfield values saved?  
I am very eager to use T.S. on a very large database of patients. I have the patients all imported in 3d slicer database.

2. There are a few organs that are not yet identified on T.S, such as thyroid, various muscles, etc. Is there a way to “train” the T.S. to identify these organs if I submit ROIs?

Thank you, and keep up the great work!

---

<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:** [February 15, 2023, 4:50pm UTC](https://discourse.slicer.org/t/love-totalsegmentator-anyway-to-batch-output-multiple-studies/27828/2 "2023-02-15T16:50:56Z")

</div>

Hi,

> [@artycho](#):
>
> I would like to use T.S. for multiple studies, is there a command line

there is no official script yet but it should be easy to write in Python, because all necessary functions are disclosed in the [TotalSegmentator extension logic](https://github.com/lassoan/SlicerTotalSegmentator/blob/d9b4f6e7a2eae05d099836aa8d314a59df066262/TotalSegmentator/TotalSegmentator.py#L283).

> [@artycho](#):
>
> There are a few organs that are not yet identified on T.S, such as thyroid, various muscles, etc. Is there a way to “train” the T.S. to identify these organs if I submit ROIs?

TotalSegmentator is undergoing active development and you could post a request under “issues” in [TotalSegmentator Github](https://github.com/wasserth/TotalSegmentator), where the original code is hosted. Our extension just wraps this code for ease of use in 3D Slicer.

You could even [train the engine](https://github.com/wasserth/TotalSegmentator#retrain-model-on-your-own) yourself according to its developer, but there is another option as @pieper pointed out: Train back MONAILabel with Totalsegmentator results and add missing structures there.

---

<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:** [February 16, 2023, 9:37am UTC](https://discourse.slicer.org/t/love-totalsegmentator-anyway-to-batch-output-multiple-studies/27828/3 "2023-02-16T09:37:42Z")

</div>

Maybe [this python script](https://github.com/rbumm/SlicerLungCTAnalyzer/blob/master/PythonScripts/processAllCTInDir.py) (not a beauty, but working) can give you an idea how to involve an extension logic, scan directories for input files, and process them.
