itkwidgets
itkwidgets copied to clipboard
Add `clicked_point_set` trait
This trait will be triggered when a point set is clicked, and it will provide information about the point set that clicked, the index of the point in the point set, and the position of the point in space.
For example:
# Your callback function
def my_point_clicked_callback(point):
print(point.index) # The point index
print(point.position) # The point [x,y,z] position
viewer.observe(my_point_clicked_callback, ['clicked_point_set'])
This trait and its data will be similar to the ImagePoint and ImagePointTrait:
https://github.com/InsightSoftwareConsortium/itkwidgets/blob/d90037eb6d6e1a367cbb54cfffc9df3cc7d75ba2/itkwidgets/trait_types.py#L277-L298
adding a new clicked_point_set trait to the Viewer widget. It depends https://github.com/Kitware/itk-vtk-viewer/issues/342 for the JavaScript side.