# Model Maker does not generate surfaces for all labels - some skipped

**URL:** <https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278>\
**Category:** Support\
**Tags:** segmentation, 3d-model\
**Created:** [October 21, 2021, 4:00am UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278 "2021-10-21T04:00:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asims](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@asims](https://discourse.slicer.org/u/asims)\
**Post date:** [October 21, 2021, 4:00am UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/1 "2021-10-21T04:00:24Z")

</div>

Hi

I have a segmented CT volume that I am happy with. The segmentation contains 12 labels. I converted the segmentation to a label map - with 12 labels.

Then in model maker attempted to generate surface models for each of my regions. It seemed to process but only returned 1 out of the 12 models.

The stdout reported that labels 1-11 were skipped. The skip unnamed labels check box was cleared - so I expected it to make a model for each label.

**Made models from labels: 12**  
**Skipped making models from labels: 1 2 3 4 5 6 7 8 9 10 11**

The behaviour was the same with generate all model or starting and end numbers (1, 12).

I am using Slicer 4.11.202110226  
Running on RH7.9  
The standard output follows.

Thank you for any comment.  
Andrew

Model Maker standard output:  
The input volume is: /tmp/Slicer-andrews/DAIJF\_vtkMRMLLabelMapVolumeNodeB.nrrd  
The labels are:  
The starting label is: 1  
The ending label is: 12  
The model name is: Model  
Do joint smoothing flag is: 0  
Generate all flag is: 1  
Number of smoothing iterations: 10  
Number of decimate iterations: 0.25  
Split normals? 1  
Calculate point normals? 1  
Pad? 1  
Filter type: Sinc  
Input color hierarchy scene file: None  
Output model scene file: /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml#vtkMRMLModelHierarchyNode1  
Color table file : /tmp/Slicer-andrews/DAIJF\_vtkMRMLColorTableNodeB.ctbl  
Save intermediate models: 1  
Debug: 1  
Starting…  
Models file: /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml  
Model Hierarchy ID: vtkMRMLModelHierarchyNode1  
Imported model scene file /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml  
Got model hierarchy node vtkMRMLModelHierarchyNode1  
GenerateAll! set make mult to true  
useStartEnd = 0, numModelsToGenerate = 1, numFilterSteps 16  
Adding 1 pixel padding around the image, shifting origin.  
Colour table file name = /tmp/Slicer-andrews/DAIJF\_vtkMRMLColorTableNodeB.ctbl  
Setting the colour node’s storage node id to vtkMRMLColorTableStorageNode1, it’s file name = /tmp/Slicer-andrews/DAIJF\_vtkMRMLColorTableNodeB.ctbl  
Read colour file /tmp/Slicer-andrews/DAIJF\_vtkMRMLColorTableNodeB.ctbl  
Using color node to get max label  
Setting histogram extentMax = 12  
Skipping 0  
Hist: Min = 1 and max = 12 (image scalar type = 4, max = 32767)  
GenerateAll flag is true, resetting the start and end labels from: 1 and 12 to 1 and 12  
GenerateAll: there are 1 models to be generated.  
Reset numFilterSteps to 16  
Marching cubes: Using end label = 12, start label = 1  
Image data extents: 0 511 0 511 0 1567  
Label 12 has 9.16065e+07 voxels.  
Got color name, set label name = Model\_12\_Skin (color name w/o spaces = Skin)  
Number of polygons = 4981096  
Writing intermediate file /tmp/Slicer-andrews/Model\_12\_Skin-MarchingCubes.vtk  
After decimation, number of polygons = 3735822  
Writing intermediate file /tmp/Slicer-andrews/Model\_12\_Skin-Decimated.vtk  
Writing intermediate file /tmp/Slicer-andrews/Model\_12\_Skin-Smoothed.vtk  
Writing model Model\_12\_Skin to file /tmp/Slicer-andrews/Model\_12\_Skin.vtk  
Adding model Model\_12\_Skin to the output scene, with filename /tmp/Slicer-andrews/Model\_12\_Skin.vtk  
Got colour: 0.678431 0.654902 0.623529 1  
Added display node: id = vtkMRMLModelDisplayNode2  
Setting model’s storage node: id = vtkMRMLModelStorageNode1  
…done adding model to output scene  
End of looping over labels  
**Made models from labels: 12**  
**Skipped making models from labels: 1 2 3 4 5 6 7 8 9 10 11**  
Writing to model scene output file: /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml, to url: /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml  
Models saved to scene file /tmp/Slicer-andrews/DAIJF\_AxHfcGGEAIFDIA.mrml  
Cleaning up  
Deleting cubes  
Deleting hist  
Deleting smootherSinc  
Deleting decimator  
Deleting mcubes  
Deleting image threshold  
… done deleting image threshold  
Deleting image to structured points  
Deleting transform ijk to lps  
Deleting transformer  
Deleting normals  
Deleting stripper  
Deleting ici, no set input null  
Deleting reader  
Deleting model scene

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 21, 2021, 4:05am UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/2 "2021-10-21T04:05:41Z")

</div>

Is there a reason why you are using the model maker as oppose to directly exporting them as model from the Segmentations module?

---

<div class="post-metadata">

**Author:** ![asims](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@asims](https://discourse.slicer.org/u/asims)\
**Post date:** [October 21, 2021, 4:07am UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/3 "2021-10-21T04:07:42Z")

</div>

No - rusty and perhaps lack of awareness of the different methods. Will try.

Thanks

---

<div class="post-metadata">

**Author:** ![asims](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@asims](https://discourse.slicer.org/u/asims)\
**Post date:** [October 21, 2021, 10:23pm UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/4 "2021-10-21T22:23:54Z")

</div>

Was able to generate models and output STL surfaces from the Segmentations module, however this resulted in a voxel based surface mesh with steps rather than a smoothed and decimated surface.

What is the preferred module for smoothing, and decimating surfaces prior to export?

I will look further into the documentation.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 21, 2021, 11:51pm UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/5 "2021-10-21T23:51:01Z")

</div>

You can export an unsmoothened surface from the segmentaiton (there is no option for decimation that I know of at that step).  
For further decimation and smoothing of export models, you can use the SUrface Toolbox module.

---

<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:** [October 22, 2021, 6:51pm UTC](https://discourse.slicer.org/t/model-maker-does-not-generate-surfaces-for-all-labels-some-skipped/20278/6 "2021-10-22T18:51:18Z")

</div>

> [@asims](#):
>
> Was able to generate models and output STL surfaces from the Segmentations module, however this resulted in a voxel based surface mesh with steps rather than a smoothed and decimated surface.

The surface generated from labelmaps is smoothed by default. You can enable decimation by [adjusting conversion parameters](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html#panels-and-their-use), but since it require a little extra computation time it is usually not desired during interactive segmentation, and if you do it only once then Surface toolbox module offers more decimation options.
