Change setting to "harden regularization transform"

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 !

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

@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 ?

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.

1 Like

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

1 Like