Input in the form of numpy arrays works with the procedural API but doesn’t work with the object-oriented API (I get “itk.ElastixRegistrationMethod is not wrapped for input type None
”).
Is that a known limitation or am I doing something wrong?
(I need to switch to the object-oriented API to do multi-image registration, which is only supported by the object-oriented API)
Code sample:
import imageio
import itk
import numpy as np
fixed = imageio.imread('CT_2D_head_fixed.mha')
fixed = np.asarray(fixed).astype(np.float32)
moving = imageio.imread('CT_2D_head_moving.mha')
moving = np.asarray(moving).astype(np.float32)
if False:
# procedural interface
registered, parameters = itk.elastix_registration_method(fixed, moving)
else:
parameter_object = itk.ParameterObject.New()
default_rigid_parameter_map = parameter_object.GetDefaultParameterMap('rigid')
parameter_object.AddParameterMap(default_rigid_parameter_map)
# Load Elastix Image Filter Object
elastix_object = itk.ElastixRegistrationMethod.New(fixed, moving)
# elastix_object.SetFixedImage(fixed_image)
# elastix_object.SetMovingImage(moving_image)
elastix_object.SetParameterObject(parameter_object)
# Set additional options
elastix_object.SetLogToConsole(False)
# Update filter object (required)
elastix_object.UpdateLargestPossibleRegion()
# Results of Registration
result_image = elastix_object.GetOutput()
result_transform_parameters = elastix_object.GetTransformParameterObject()