Hi to everyone
Today I want to extract RAS coordinates to 3d markups/curves to click.
My goal is interact with 3d view (if is not possible, interact with 2d views would great too). Processing the click I would like to know the ID of the selected point and RAS coordinates.
Is there a way to do it by python code ā Run some lines which allows the user to select one point and then he can retrieve the coordinates?
Iām interested in obtain info from centerlines created by extractCenterlines module
bserrano
(Belen)
February 5, 2024, 3:46pm
2
Also interested in having a callback function when clicking on a markups. Any solution for this?
Thanks
1 Like
cpinter
(Csaba Pinter)
February 7, 2024, 11:53am
3
This worked for me for adding new points:
@vtk.calldata_type(vtk.VTK_INT)
def onPointDefined(caller, eventid, callData):
fiducialNode = caller
fiducialIndex = callData
print(f'Defined: {fiducialNode.GetName()}, Fiducial index: {fiducialIndex}')
fiducialsNode.AddObserver(slicer.vtkMRMLMarkupsNode.PointPositionDefinedEvent, onPointDefined)
For clicking this could be the solution:
@vtk.calldata_type(vtk.VTK_OBJECT)
def onPointClicked(caller, eventid):
fiducialNode = caller
fiducialIndex = int(fiducialNode.GetAttribute('Markups.MovingMarkupIndex'))
print(f'Moved: {fiducialNode.GetName()}, Fiducial index: {fiducialIndex}')
fiducialsNode.AddObserver(slicer.vtkMRMLMarkupsNode.PointStartInteractionEvent, onPointClicked)
1 Like