Invert transformation Python Command?


I have a loaded displacement field and a loaded volume that I want to transform by the inverse.
In Slicer GUI, when applying the transform, one can easily check the “Invert” box.
How do I specify that I want to do an invert transform in my Python script?

inputDisplacementfield = mainFolder+‘displacementfield.mhd’
inputTemplateVolume = mainFolder+‘volume.nrrd’
loadedDisplacementfield = slicer.util.loadTransform(inputDisplacementfield)
loadedTemplateVolume = slicer.util.loadVolume(inputTemplateVolume)

displacementfield_node = slicer.util.getNode(“displacementfield”)
/# Here I want to invert the transform
templateVolume_node = slicer.util.getNode(“volume”)

Any advice?

Thanks in advance.

If you don’t get a specific answer here, there are general instructions: