# Can I prevent ModelMaker from changing what appears in the Slice views?

**URL:** <https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546>\
**Category:** Development\
**Created:** [January 16, 2021, 12:56am UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546 "2021-01-16T00:56:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfrisken](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sfrisken](https://discourse.slicer.org/u/sfrisken)\
**Post date:** [January 16, 2021, 12:56am UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/1 "2021-01-16T00:56:56Z")

</div>

I am using ModelMaker in a custom Python module to generate models from a labelmap. I’ve used the code in EditorLib/MakeModelEffect.py as a template.

When the model is generated, the state of the views (i.e., the background image and labelmap) is changed so that only the generated model is visible. Can anyone tell me if this is an intended side effect? Is there a good way to retain the state of the views when the new model is added to the scene?

Note that this behavior occurs when I call ModelMaker from my module (the use case I am interested in), but it also occurs when I use ModelMaker from the Slicer module menu.

Thanks for your help!

---

<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 16, 2021, 5:27am UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/2 "2021-01-16T05:27:56Z")

</div>

When a CLI module returns a mini-scene (as far as I know Model Maker is the only module that does this) then all MRML node selectors are reset. See details in this issue:

> <https://github.com/Slicer/Slicer/issues/4570>
>
> This issue was created automatically from an original Mantis Issue. Further discussion may take place here.

The issue is still open, because it only impacts Model Maker, which is now not needed (model\<-\>segmentation\<-\>labelmap conversions can be done using segmentations) and the problem is really hard to solve.

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [May 21, 2021, 9:36am UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/3 "2021-05-21T09:36:25Z")

</div>

I have the same issue with this model Maker module.  
I tried the “labelmap conversions” as you said, but with this tool I can’t set the “smooth” or decimate" parameter. Is there a way to set thoose parameters with the labelmap conversions tool from "segment Editor " ?

---

<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:** [May 21, 2021, 12:59pm UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/4 "2021-05-21T12:59:38Z")

</div>

You can change decimation and smoothing parameters in Segmentations module as described [here](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html#create-new-representation-in-segmentation-conversion).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/0/d066dcc42ad32375dafc36d2fd6943139ccf5dda.png)

---

<div class="post-metadata">

**Author:** ![ond12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ond12/32/8706_2.png) [@ond12](https://discourse.slicer.org/u/ond12)\
**Post date:** [May 21, 2021, 1:14pm UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/5 "2021-05-21T13:14:16Z")

</div>

Thank a lot very usefull, do you have a python code example that change decimation and smoothing ?

---

<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:** [May 21, 2021, 4:58pm UTC](https://discourse.slicer.org/t/can-i-prevent-modelmaker-from-changing-what-appears-in-the-slice-views/15546/6 "2021-05-21T16:58:59Z")

</div>

See [this example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#re-convert-using-a-modified-conversion-parameter) in the script repository.
