How can I get the deformation field and transformed image using ANTS?

registration = ants.registration(fixed=mni_image, moving=subject_image, type_of_transform='SyN')

I am a bit confused. After the above, where is the deformation field and where is the transformed images?
Are these correct?

    deformation_field = registration['fwdtransforms'][0]
    transform_params= registration['fwdtransforms']

    # Apply the transformation to the moving image
    transformed_image = ants.apply_transforms(fixed=mni_image, moving=subject_image, transformlist=transform_params)

Hi @Yasmine,

From the documentation: Registration — ANTsPy master documentation


warpedmovout: Moving image warped to space of fixed image.
warpedfixout: Fixed image warped to space of moving image.
fwdtransforms: Transforms to move from moving to fixed image.
invtransforms: Transforms to move from fixed to moving image.

Your code looks correct, but also note that you don’t need to run apply_transforms if you are working with the same images used in the registration step, since the warped images are included in the registration output.