-
-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Similarity3DTransform API #4149
Comments
Thank you for contributing an issue! 🙏 Welcome to the ITK community! 🤗👋☀️ We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜 This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it. |
Please provide a minimal reproduction example. |
While we are seeking permission to use customer data to provide a reproduction procedure, can you confirm whether or not this API is intended to return a similarity transformation with no reflection? |
There is only a single scaling factor, but I am not sure whether there is any effort to constrain it to positive values, by e.g. registration optimizers. Of course, this factor was definitely imagined to be positive. |
To clarify, this is what the transformation says it has:
|
Thanks @gdevenyi and @dzenanz . I agree with that the optimizer in registration seems to be allowed to explore negative portions of parameter space for scale, which is not what we want to allow or would have expected when using the Similarity3DTransform. I am not able to share the data we have in which the registration returns a Similarity3DTransform that includes reflection. I note that in SimpleITK, the following construction with a negative scale factor succeeds and returns an output from GetMatrix that is not a rotation matrix (negative determinant), and reports an output from GetScale which is negative: import SimpleITK as sitk
rotation_center = (0, 0, 0)
axis = (0,0,1)
angle = 0.0
translation = (0.0,0.0,0.0)
scale_factor = -1.0
similarity = sitk.Similarity3DTransform(scale_factor, axis, angle, translation, rotation_center)
print("Scale: "+str(similarity.GetScale()))
print("Matrix: "+str(similarity.GetMatrix())) The output of this is: Scale: -1.0 My questions are:
|
If you think the situation could be improved, we are always open to accepting contributions (preferably in the form of PRs). |
One other thing to ensure optimization meets expectations is to ensure initialization is done properly, and that the similarity metric is properly conditioned to push the optimization in the "correct" direction. The optimizer tries to improve the metric and if that happens to include pushing scaling to the negative direction then it will happen (subject to optimizers with boundaries) |
Thank you for the suggestions that you have made:
We might be able to provide 1 as an option to our users in a future product release, and we might be able to suggest 2 to users when a negative scale factor is encountered. We can also explore 3. We don’t have the resources at the moment to investigate 4. I would like to suggest, for your future consideration, that a parameterization of scale + rotation + translation is not ideal for similarity transformations if the scale is allowed to be negative. In 3-D, a negative scale factor results in an opposite similarity, one that reverses object orientations. We have customers for whom such a transformation is not physically realizable in the systems they are modeling. On the other hand, if one does wish to allow opposite similarities, the parameterization is still not ideal because it can’t represent an opposite similarity at all in 2-D, and it can’t represent all types of opposite similarities in 3-D. For the case where one doesn’t want an opposite similarity, I’m not aware of an unbounded parameterization that would be suitable, but perhaps one does exist. For the case where one wants to allow opposite similarities, an unbounded parameterization that covers all the reflection cases in both 2-D and 3-D would be a scale factor (positive or negative), an orthogonal matrix (not restricted to rotations), and a translation. Thanks again for your suggestions. |
We have noticed that the similarity3DTransform API returns a reflection along with the scale factor (negative scale factor). Both GetMatrix() as well as the GetFixedParameters() API return the reflection. We are just using the standard ITK code
The reflection is unexpected since the doc seems to indicate that the transformation model has translation, rotation and scaling but no reflection. Can you tell us if this is a bug?
https://itk.org/Doxygen/html/classitk_1_1Similarity3DTransform.html
The text was updated successfully, but these errors were encountered: