SuperElastix / SimpleElastix

Multi-lingual medical image registration library
http://simpleelastix.github.io
Apache License 2.0
509 stars 149 forks source link

How to use AffineDTITransform in SimpleElastix #436

Closed davidweioct closed 3 years ago

davidweioct commented 3 years ago

Hello,

Does anyone know how to use AffineDTITransform in SimpleElastix? The purpose for me is to output the rotation angle and scales for other purposes.

I read the manual elastix-5.0.1-manual, which gives the following information:

We also have implemented another flavor of the affine transformation, with identical meaning, but using another parametrization. Instead of having µ formed by the matrix elements + translation, it is formed by d rotations, d shear factors, d scales, and d translations. The definition reads: Tµ(x) = RGS(x − c) + t + c, (2.15) with R, G and S the rotation, shear and scaling matrix, respectively. It can be selected using AffineDTITransform, as it was first made with DTI imaging in mind, although it can be used anywhere else as well. It has 7 parameters in 2D and 12 parameters in 3D.

Thank you very much in advance.

MMdeB commented 3 years ago

Not an expert, but I think you should just follow the example from Simple Elastix docs, but then add this for the code of the parameter map:

parameterMap = sitk.GetDefaultParameterMap('affine') parameterMap['Transform'] = ['AffineDTITransform'] elastixImageFilter.SetParameterMap(parameterMap)

davidweioct commented 3 years ago

Thank you, it works. I made a mistake before by setting parameterMap['Transform'] = 'AffineDTITransform'