python code for DiffeomorphicDemonsRegistration in SimpleITK

I used a few methods for registration. Simple ITK in python looks very easy than using c++ for me.
Is there any python code available for DiffeomorphicDemonsRegistration?

Hello @EE18D504_SINDHURA_C,

Yes,the class for that is DiffeomorphicDemonsRegistrationFilter. This Jupyter notebook illustrates various classes from the Demons registration family and their usage in a multi-resolution framework.

3 Likes

Hi @zivy,
I have gone throgh the code given here
I wonder how to use it with my 3D CT brain images?
I have only two CT images . I dont have any points data.
how to proceed with only with my two images?

Hello @EE18D504_SINDHURA_C,

You do not need point data, that is only used for evaluation purposes.

Please take a look at the “Register and transfer the segmentation.” section of the notebook which registers 2D MRI images. You can readily modify this code for your task. You will need to modify Euler2DTransform() to Euler3DTransform() in the initializer and possibly tweak the parameters (Demons algorithm and pyramid) to work for your application.

If you are struggling with the code, you might consider using 3D Slicer which has a GUI based registration module.

1 Like

It says my images do not occupy same physical space? Should I resample my image? Is there any other way? Doen’t it effect my registration process if i resample it?

did you found a way to use the demons registration without resampling the images ?

The implementation of the demons methods assumes that the images occupy the same physical space, so if they don’t you have to resample.

Usually this is in a multi step registration where you have a global (rigid/affine) transformation followed by a demons based registration. The image is resampled using the global transformation and that is used as input for the demons registration. If you use BSpline registration you won’t have to resample.

1 Like