itkwidgets icon indicating copy to clipboard operation
itkwidgets copied to clipboard

Add `clicked_point_set` trait

Open thewtex opened this issue 5 years ago • 0 comments

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.

thewtex avatar Oct 14 '20 17:10 thewtex