elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Add SetFixedPoints and SetMovingPoints to ElastixRegistrationMethod, for point-to-point EuclideanDistanceMetric

Open N-Dekker opened this issue 1 year ago • 1 comments
trafficstars

Currently trying it out in Python:

Dimension = 2
ImageType = itk.Image[itk.UC, Dimension]
PointType = itk.Point[itk.D, Dimension]
PointContainerType = itk.VectorContainer[itk.ULL, PointType]

fixed_image = ImageType.New()
fixed_image.SetRegions(itk.Size[Dimension].Filled(8))
fixed_image.AllocateInitialized()

moving_image = ImageType.New()
moving_image.SetRegions(itk.Size[Dimension].Filled(8))
moving_image.AllocateInitialized()

fixed_point = PointType([0.0, 0.0])
fixed_points = PointContainerType.New()
fixed_points.InsertElement(0, fixed_point)

moving_point = PointType([1.0, -2.0])
moving_points = PointContainerType.New()
moving_points.InsertElement(0, moving_point)

parameter_object = itk.ParameterObject.New()
parameter_object.AddParameterMap(
    {"ImageSampler": ("Full",),
    "MaximumNumberOfIterations": ("2",),
    "Metric": ("AdvancedNormalizedCorrelation", "CorrespondingPointsEuclideanDistanceMetric"),
    "Optimizer": ("AdaptiveStochasticGradientDescent",),
    "Registration": ( "MultiMetricMultiResolutionRegistration",),
    "Transform": ("TranslationTransform",)})

result_image, result_transform_parameters = itk.elastix_registration_method(
    fixed_image, moving_image, fixed_points=fixed_points, moving_points=moving_points,
    parameter_object=parameter_object)

print(result_transform_parameters)

Output:


ParameterObject (000001D212B702D0)
  RTTI typeinfo:   class elastix::ParameterObject
  Reference Count: 1
  Modified Time: 10574
  Debug: Off
  Object Name: 
  Observers: 
    none
ParameterMap 0: 
  (CompressResultImage "false")
  (DefaultPixelValue)
  (Direction 1 0 0 1)
  (FinalBSplineInterpolationOrder 3)
  (FixedImageDimension 2)
  (FixedInternalImagePixelType "float")
  (HowToCombineTransforms "Compose")
  (Index 0 0)
  (InitialTransformParameterFileName "NoInitialTransform")
  (MovingImageDimension 2)
  (MovingInternalImagePixelType "float")
  (NumberOfParameters 2)
  (Origin 0 0)
  (ResampleInterpolator "FinalBSplineInterpolator")
  (Resampler "DefaultResampler")
  (ResultImageFormat "mhd")
  (ResultImagePixelType "unsigned char")
  (Size 8 8)
  (Spacing 1 1)
  (Transform "TranslationTransform")
  (TransformParameters 0.983615 -1.96723)
  (UseDirectionCosines "true")

N-Dekker avatar Sep 13 '24 15:09 N-Dekker