# Adding many models to hierarchy

**URL:** <https://discourse.slicer.org/t/adding-many-models-to-hierarchy/13513>\
**Category:** Support\
**Created:** [September 16, 2020, 11:08pm UTC](https://discourse.slicer.org/t/adding-many-models-to-hierarchy/13513 "2020-09-16T23:08:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfolson](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mfolson](https://discourse.slicer.org/u/mfolson)\
**Post date:** [September 16, 2020, 11:08pm UTC](https://discourse.slicer.org/t/adding-many-models-to-hierarchy/13513/1 "2020-09-16T23:08:31Z")

</div>

I am trying to create a label map for 100+ STLs. I was able to do this by importing all STLs as models, grouping them under a model hierarchy, importing the model hierarchy as a segmentation, and then exporting that segmentation as a Labelmap. Seems like it worked pretty well, but was tedious. My questions are:

1. Is there a better method to go from multiple STL files to a Labelmap? I want each STL to have a separate value.
2. Is there a trick to grouping models under a model hierarchy? Doing this in the models module often is finicky and leads to crashes. I tried doing this in the subject hierarchy as well, but after placing them into the folder, they do not show up this way in the models module.

Many thanks,  
Matt

---

<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:** [September 17, 2020, 12:59am UTC](https://discourse.slicer.org/t/adding-many-models-to-hierarchy/13513/2 "2020-09-17T00:59:26Z")

</div>

This should work robustly and much faster in recent Slicer-4.11 releases compared to Slicer-4.10 (using Subject hierarchy): you can put all your models into a folder and right-click and choose “Convert models to segmentation node”.

If you want to make this even more automated then you write a short python script for this (probably not more than 10-20 lines of code).

---

<div class="post-metadata">

**Author:** ![mfolson](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mfolson](https://discourse.slicer.org/u/mfolson)\
**Post date:** [September 17, 2020, 4:09pm UTC](https://discourse.slicer.org/t/adding-many-models-to-hierarchy/13513/3 "2020-09-17T16:09:57Z")

</div>

Perfect, yes, I was using 4.10.2. I’ll try it out in the latest releases and then work on the python code. Good idea. Thank you!
