Is order of transforms in a composite transform reversed relative to transform order during registration?


I have a question regarding the sample code for composite registration found in the simple itk website (The Python code version):

In that example the following steps took place in the following order:

  1. Affine transform is calculated and is called outTx
  2. A displacement field transform (displacementTx) is calculated, such that the above affine transform (outTx) initializes its moving transform.
  3. A composite transform is generated by using: outTx.AddTransform(R.Execute(fixed,moving)) which is equivalent to calling outTx.AddTransform(displacementTx) .

According to the documentation of composite transform, the resulting composite transform which transform a fixed point coordinates X_fixed to a moving point coordinates X_mov is applied such that the latest added transform is applied first: X_mov = outTx * displacementTx * X_fix (the displacement transform is applied first, and then the affine transform outTx is applied).

However, according to the registration documentation (found in formula above β€œin [7]” ), when the displacementTx was calculated while outTx was set as the initial moving transform, then the moving transform (outTx) was applied first, and then the optimized transform (displacementTx), so during registration the transform used during metric minimization was: X_mov=displacementTx * outTx * X_fix

Any explanation for seemingly reversed order in which displacementTx and affine transform outTx are applied? Is there a contradiction between the order used during registration optimization and the order used by the final composite transform?