-
Notifications
You must be signed in to change notification settings - Fork 515
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
Simplify Endoscopy API relelated to quaternion #7431
Conversation
To clarify, are you saying that we should store quaternions rather than orientations with our self.inputCurve.SetAttribute(
EndoscopyLogic.NODE_PATH_CAMERA_ORIENTATIONS_ATTRIBUTE_NAME, cameraOrientationsString,
) command? Backing up a few steps, to make sure that we are on the same page ... quaternions and orientations are the same Python type
The |
f83abd9
to
5833867
Compare
Supporting an API allowing to get output using both "return by value" and "pass mutable object as argument" is error-prone. Considering the returned value is only few bytes (e.g 32 bytes for wxyz orientation and 128 bytes for a 4x4 matrix), the added complexity it not worth it. To adhere to the principle of least surprise and make the code more readable, this commit simplifies the API and updates the code accordingly.
The introduction of this code through 717fd6f (ENH: Add support for managing orientation keyframe in Endoscopy ) was likely on oversight as the functions matrix3x3ToQuaternion and quaternionToMatrix3x3 are not available in vtk.vtkMath
… functions This is intended to facilitate the reading and understanding of the code by directly using the vtkMRMLMarkupsNode::SetNthControlPointOrientation API. It also removes the unused function getRelativeOrientation()
5833867
to
4eddf42
Compare
Thanks for the review and clarification For the current integration, I've removed that specific portion. AnalysisThe 4-value "representation" array was treated as a "wxyz quaternion" instead of an "axis-angle" representation. While this approach somewhat maintained the overall logic, including keyframe saving and deletion, it led to a couple of issues:
Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any time a 4-value array is in angle-axis format, the corresponding variable is named with "orientation", and whenever a 4-value array is in quaternion format, the corresponding variable is named with "quaternion". I recommend that we keep this convention.
I see that this pull request
- Changes the math helper functions API by supporting only return by value.
- Replaces some functions by inline implementations of them where they were previously invoked.
If the code is also intended to change the computation of the inverse of an orientation, I don't see where that is accomplished.
The comments and analysis were specific to the now removed attempt at treating the 4-value "representation" array as a "wxyz quaternion" instead of an "axis-angle" representation. This is why this topic doesn't implement any changes related to the inverse of the "orientation" |
A few changes happened between my pushed branches and the final merge. In case this proves useful for the next steps, I offer these clarifications.
This and similar functions were provided to hide the interface to where the orientations were stored and whether the actual storage was as worldOrientations or relativeOrientations. We may wish to restore these functions in the future, especially if we change either of these decisions, because it localizes these decisions to a small number of locations rather than spreading them to everywhere where these deleted functions were invoked.
The case change |
To help address this, could you reference the commit in main introducing the regression? |
Commit 0a5af4e on my branch |
Indeed, in the context of the integration, for sake of consistency, the capitalization of all the functions added to While working on this, in commit 717fd6f, the capitalization of the functions calls associated with
Since the two functions Then, the two unused functions were removed in efcc1a5. |
Since the changes introduced in this pull request have not been changed since the approval. I will assume, you are referring to the changes introduced in #7165 |
I had been using a starting uppercase letter for methods that were |
If we revisit how the relative "positioning" is done, this will likely be done by changing how the transformation is computed and this will likely be done in the functions |
This is a follow-up of commit 717fd6f (ENH: Add support for managing orientation keyframe in Endoscopy) introduced through #7165
The set of commits aims to simplify the Endoscopy API (removing
~60~30 lines):vtkMRMLMarkupsNode::SetNthControlPointOrientation
.Directly employs VTK's math functions for converting between matrices and quaternions.Streamlines interpolation by eliminating unnecessary functions:orientationToQuaternion
andquaternionToOrientation
are converting to/from the same object.getRelativeOrientation
matrix3x3ToQuaternion
andquaternionToMatrix3x3
(these were also not working)