I am trying to register two CT head images from the same subjects. There exists significant rotations and one image is significantly cropped than the other.
I used the General Registration (BRAINS) rigid registration with MSE metric and default parameters and it worked out pretty well. Now I’m trying to duplicate the result using SimpleITK in python, but it fails to produce the same result as Slicer. Can anyone point out where my SimpleITK implementation is not right?
My code is below:
initial_transform = sitk.CenteredTransformInitializer(fixed_image, moving_image,
sitk.Euler3DTransform(), sitk.CenteredTransformInitializerFilter.GEOMETRY)
registration_method = sitk.ImageRegistrationMethod()
# Similarity metric settings.
registration_method.SetMetricAsMeanSquares()
registration_method.SetMetricSamplingStrategy(registration_method.RANDOM)
registration_method.SetMetricSamplingPercentage(0.002)
registration_method.SetInterpolator(sitk.sitkLinear)
# Optimizer settings.
registration_method.SetOptimizerAsRegularStepGradientDescent(learningRate=0.05,
minStep=0.001, numberOfIterations=1500)
registration_method.SetOptimizerScalesFromPhysicalShift()
registration_method.SetOptimizerWeights([1,1,1,1000,1000,1000])
registration_method.SetInitialTransform(initial_transform, inPlace=False)
egistration_method.Execute(fixed_image, moving_image)