4

The Execute method of registration in SimpleElastix returns the registered (transformed) version moving image, but doesn't allow one to transform another image similarly. I have two CT-images and want to register based on the bones, therefore I soft-thresholded the input images using a logistic sigmoid between approximately 600 and 1500 Hounsfield units, such that the contrast is focused on the bones. For simplicity you can assume the threshold puts everything below 600 to 0, scales everything linearly from 0 to 1 in-between and puts everything above 1500 to 1.

The registration, using SimpleElastix:

fixed = sitk.GetImageFromArray(threshold(...))
moving = sitk.GetImageFromArray(threshold(...))

elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetFixedImage(fixed)
elastixImageFilter.SetMovingImage(moving)

parameterMapVector = sitk.VectorOfParameterMap()
# ...
elastixImageFilter.SetParameterMap(parameterMapVector)

registered = elastixImageFilter.Execute()

However, I want to operate on the original images, without the soft-threshold, afterwards.

Is there a way to apply the transformation the registration found on the original image as well? Either by getting the Transformation or by providing the not-thresholded moving image 'passenger side', such that it's transformed similarly but not used in the optimization cost function.

Herbert
  • 5,279
  • 5
  • 44
  • 69

1 Answers1

2

I think you can do it using a transformixImageFilter after the elastixImageFilter like this:

elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetFixedImage(fixed)
elastixImageFilter.SetMovingImage(moving)

parameterMapVector = sitk.VectorOfParameterMap()
# ...
elastixImageFilter.SetParameterMap(parameterMapVector)
elastixImageFilter.Execute()

transformParameterMap = elastixImageFilter.GetTransformParameterMap()

transformix = sitk.TransformixImageFilter()
transformix.SetTransformParameterMap(transformParameterMap)
transformix.SetMovingImage(sitk.GetImageFromArray(thirdImage))

transformix.Execute()

transformedThirdImg = 
sitk.GetArrayFromImage(transformix.GetResultImage())
Damien
  • 21
  • 2