beginner, registration


(Faranak Sobhani) #1
def align_images(img_sta,img_move):
    elastixImageFilter = sitk.ElastixImageFilter()
    elastixImageFilter.SetFixedImage(sitk.GetImageFromArray(img_sta))
    elastixImageFilter.SetMovingImage(sitk.GetImageFromArray(img_move))
  
    parameterMapVector = sitk.VectorOfParameterMap()
    parameterMapVector.append(sitk.GetDefaultParameterMap("affine"))
    parameterMapVector.append(sitk.GetDefaultParameterMap("bspline"))
    elastixImageFilter.SetParameterMap(parameterMapVector)

    elastixImageFilter.Execute()
    result = sitk.GetArrayFromImage(elastixImageFilter.GetResultImage())
    return result,elastixImageFilter.GetTransformParameterMap()

def transfer_image(input_img,transformParameterMap,ref_img=None):
transformixImageFilter = sitk.TransformixImageFilter()
transformixImageFilter.SetTransformParameterMap(transformParameterMap)
transformixImageFilter.SetMovingImage(sitk.GetImageFromArray(resize((input_img),ref_img.shape[:2])))
transformixImageFilter.Execute()
transformed_image = sitk.GetArrayFromImage(transformixImageFilter.GetResultImage())
return transformed_image

I have defined the following two function, how can I read the TransformParameterMapand transformixImageFilter results? for example rotation results of moving image or generally all the results related to transformation or translation or angel?

I do have histopathology images which they cannot match well after using the non-rigid or rigid transformation. I just wanted to see the transformation matrix and play a little bit with them to see if I can somehow work further