-
Notifications
You must be signed in to change notification settings - Fork 5
Set transducer module color to matching transform type #375
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
Conversation
365453e to
c48d2cd
Compare
|
@arhowe00 pushed a couple more commits based on our discussion with Peter yesterday. But this is now ready for review |
arhowe00
left a comment
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.
Looks good! I have a few changes and questions. I walked through the various steps, and the transducer changes according to the PR description (e.g. moving the transducer transform after virtual fitting and transducer tracking resets its indicators).
| # transform matches the virtual fit result in terms of matrix values. | ||
| if int(vf_node.GetAttribute("VF:rank")) == 1 and newly_loaded_transducer.is_matching_transform(vf_node): | ||
| newly_loaded_transducer.set_matching_transform(vf_node) | ||
| newly_loaded_transducer.set_visibility(True) |
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.
Are you sure we only want to show the transducer if it corresponds to the best virtual fit result nodes? Is there a possible scenario in which there are virtual fit result nodes that were created for a given position, the transducer was repositioned, and newly created virtual fit result nodes are not ranked as high? If the nodes are erased on each iteration, then this should be fine.
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.
For now, yes. In another PR, I am going to make changes that allow the user to manually edit the virtual fit result (i.e. #357). So once I decide on that implementation, in that same PR I wil likely edit this as well to account for any user over-rides to the automated result.
| if transform_node.GetAttribute("isVirtualFitResult") == "1": | ||
| return True | ||
| else: | ||
| False |
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.
Correction below and minor suggestion for type hints since this function is very domain specific
-def is_virtual_fit_result_node(transform_node) -> bool:
+def is_virtual_fit_result_node(transform_node: vtkMRMLTransformNode) -> bool:
"""Returns True if the given node is a virtual fit result node"""
if transform_node.GetAttribute("isVirtualFitResult") == "1":
return True
else:
- False
+ return FalseThere 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.
thanks for catching this!
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.
I editing the initial commit to include this change.
c48d2cd to
8b0f21e
Compare
arhowe00
left a comment
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.
LGTM, great job with the edits.
Closes #361
Sets the transducer model (incl. body and surface) display color to indicate the matching transform. The default model color is yellow. The transducer model is blue (when matching VF result) and green (when matching TT result). When loading a session, the transducer is hidden if it does not match VF or TT. However, manually loaded transducers (i.e. using the 'Load Transducer') button are always shown.
For Review