SuperElastix / SimpleElastix

Multi-lingual medical image registration library

Home Page:http://simpleelastix.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Perform Affine transformation without shear

siddpiku opened this issue · comments

Hello,

I would like to only allow rotation, translation, and scaling as transformations for image registration or the affine transformation without the shear option. Is there a way to set the parameterMap[ "Transform" ] to perform this?

You can use a SimilarityTransform. Link is how to use this.

Thanks a lot for the link. The Similarity Transform seems to only allow isotropic scaling. I am interested in allowing for different scaling along different axes. Is this allowed?

You can use the AffineDTITransform. It is a different parameterization of the affine transform with 3 rotations, 3 shear, 3 scaling and 3 translation parameters. You can set
AutimaticScalesEstimation "true"
to initialize scaling for each parameter. You can then change the scaling to basically prevent some parameters to change:
Settings scales to
(Scales -1 -1 -1 1e9 1e9 1e9 -1 -1 -1 -1 -1 -1)
will leave rotation, scaling and translation scales unaffected (-1), but scales the shear very high, effectively eliminating them from the registration.

Thank you for the explanation. I understand the method, but I am struggling to set the scales in python.
Following the examples in https://simpleelastix.readthedocs.io/ParameterMaps.html I have the following code -

import SimpleITK as sitk
parameterMap = sitk.GetDefaultParameterMap("rigid")
parameterMap["Transform"] = ["AffineDTITransform"]

I can see that the AffineDTITransform has a SetScale() method, but I am not sure how to access that in python.