# Change setting to "harden regularization transform"

**URL:** <https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241>\
**Category:** Development\
**Tags:** dicom, python\
**Created:** [December 5, 2023, 9:13pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241 "2023-12-05T21:13:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaelle\_Leroux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gaelle_leroux/32/66230_2.png) [@Gaelle\_Leroux](https://discourse.slicer.org/u/Gaelle_Leroux)\
**Post date:** [December 5, 2023, 9:13pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241/1 "2023-12-05T21:13:14Z")

</div>

Hi @jcfr, @lassoan !

I’m developing a module to automatically apply the matrix to volume files. In the new version of Slicer we can change the “Acquisition geometry regularization” to “harden regularization transform”. Is there a way to change this parameter from my python code before saving my files with slicer.utils.saveNode ?

Thank you very much !

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 5, 2023, 9:34pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241/2 "2023-12-05T21:34:02Z")

</div>

To harden transforms while saving, simply consider calling ~~`slicer.util.saveNode`~~ `slicer.util.exportNode` passing `world=True`.

See [https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#save-volume-to-file](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#save-volume-to-file)

---

<div class="post-metadata">

**Author:** ![Gaelle\_Leroux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gaelle_leroux/32/66230_2.png) [@Gaelle\_Leroux](https://discourse.slicer.org/u/Gaelle_Leroux)\
**Post date:** [December 6, 2023, 3:24pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241/3 "2023-12-06T15:24:09Z")

</div>

@jcfr, I tried to use what you suggested but I ran into a problem.  
My line to save my file look like this : `slicer.util.saveNode(my_model,"output/path/to/my/file.nii.gz",world=True)`. When I’m trying to run it in slicer 5.6.0 I have this error :`saveNode() got an unexpected keyword argument 'world'`

Can you help me ?

---

<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 6, 2023, 6:07pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241/4 "2023-12-06T18:07:47Z")

</div>

`saveNode` function does not have a `world` argument. This function always saves the node as is, without hardening its parent transform on it.

You can use the `exportNode` function, which has an optional `world` argument - as shown in the example that @jcfr linked above.

---

<div class="post-metadata">

**Author:** ![Gaelle\_Leroux](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gaelle_leroux/32/66230_2.png) [@Gaelle\_Leroux](https://discourse.slicer.org/u/Gaelle_Leroux)\
**Post date:** [December 7, 2023, 2:17pm UTC](https://discourse.slicer.org/t/change-setting-to-harden-regularization-transform/33241/5 "2023-12-07T14:17:05Z")

</div>

I get it, it’s working. Thank you !
