Apply a nonlinear transform to model using Python code

Something like the following should work for applying a nonlinear transform to a model:

straightenTransformNode = getNode('Straighten Transform')
# Get the model node that you want to transform
modelName = 'MyModel' # change this to whatever the name of your model is
modelNode = getNode(modelName)
# To apply transform to model
modelNode.SetAndObserveTransformNodeID(straightenTransformNode.GetID())
# To unapply a transform
modelNode.SetAndObserveTransformNodeID(None)

Separately, to invert a transform node, call Inverse() on it

straightenTransformNode.Inverse()

You might also find the following discussion helpful: Invert transform (Elastix)