I tried to do image registration which worked well before but after a while, I will get this error with the same code that worked before. Please anyone know what is the problem and how to fix it?
Example of code:
def registration(fixed_image, moving_image, parameter_map):
FixedImage = sitk.GetImageFromArray(fixed_image)
MovingImage = sitk.GetImageFromArray(moving_image)
ParameterMap = sitk.GetDefaultParameterMap(parameter_map)
elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetFixedImage(FixedImage)
elastixImageFilter.SetMovingImage(MovingImage)
elastixImageFilter.SetParameterMap(ParameterMap)
elastixImageFilter.Execute()
ResultImage = elastixImageFilter.GetResultImage()
TransParameterMap =elastixImageFilter.GetTransformParameterMap()
ResultArray = sitk.GetArrayFromImage(ResultImage)
FixedArray = sitk.GetArrayFromImage(FixedImage)
MovingArray = sitk.GetArrayFromImage(MovingImage)
return ResultArray, FixedArray, MovingArray, TransParameterMap
fixed_image = A_image
moving_image = B_image
parameter_map = 'affine'
ResultArray, FixedArray, MovingArray, TransParameterMap = registration(fixed_image, moving_image, parameter_map)
# Generate registration images
registration_plot(ResultArray, FixedArray, MovingArray)