initial_transform = sitk.CenteredTransformInitializer(sitk.Cast(fixed_image,moving_image.GetPixelID()), moving_image, sitk.Euler3DTransform(), sitk.CenteredTransformInitializerFilter.MOMENTS)
resample = sitk.ResampleImageFilter() resample.SetReferenceImage(fixed_image) resample.SetInterpolator(sitk.sitkLinear) resample.SetTransform(transform) resample.Execute(moving_image)