Skip to content

Conversation

@sadhana-r
Copy link
Contributor

@sadhana-r sadhana-r commented May 27, 2025

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

  • After running virtual fit, the transducer model should turn blue
  • After running transducer tracking, the transducer model should turn green
  • If you manually change the current transducer transform (i.e. by editing the transform in the transform module or using interaction handles), the transducer model should turn back to yellow. (And transducer tracking approval is revoked if applicable).
  • When you load a session, if the transducer transform matches either the virtual fit result or transducer tracking result, the model color should change to blue or green respectively and get displayed in the scene. Transducer visibility is turned off otherwise.

@sadhana-r sadhana-r marked this pull request as ready for review May 28, 2025 13:10
@sadhana-r sadhana-r requested a review from arhowe00 May 28, 2025 13:13
@sadhana-r sadhana-r force-pushed the 361_transducer_model_color branch 3 times, most recently from 365453e to c48d2cd Compare May 30, 2025 13:52
@sadhana-r
Copy link
Contributor Author

@arhowe00 pushed a couple more commits based on our discussion with Peter yesterday. But this is now ready for review

Copy link
Contributor

@arhowe00 arhowe00 left a 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)
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

@arhowe00 arhowe00 Jun 2, 2025

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 False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching this!

Copy link
Contributor Author

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.

@sadhana-r sadhana-r force-pushed the 361_transducer_model_color branch from c48d2cd to 8b0f21e Compare June 2, 2025 16:11
@sadhana-r sadhana-r requested a review from arhowe00 June 2, 2025 17:15
Copy link
Contributor

@arhowe00 arhowe00 left a 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.

@sadhana-r sadhana-r merged commit e42743b into main Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Establish a model "color language"

3 participants