How to create a fiducial though the pixel not the mouse event

I went creat fiducial in the 3d view just give the x,y coordinate, and I found some information maybe help for me. But I don’t know how to use it.

virtual int vtkSlicerMarkupsWidget::AddNodeOnWidget ( const int *displayPos* [2] ) virtual

Given a specific X, Y pixel location, add a new node on the widget at this location.

This operation is called point picking. Model displayable manager has a point picker that you can use:

displayPosition = [100,120]

# Get model displayable manager
modelDisplayableManager = None
threeDViewWidget =
managers = vtk.vtkCollection()
for i in range(managers.GetNumberOfItems()):
  obj = managers.GetItemAsObject(i)
  if obj.IsA('vtkMRMLModelDisplayableManager'):
    modelDisplayableManager = obj

# Use model displayable manager's point picker
pickedPosition = []
if modelDisplayableManager.Pick(displayPosition[0], displayPosition[1]):
    rasPositionArray = vtk.vtkDoubleArray()
    rasPosition = [rasPositionArray.GetValue(i) for i in range(3)]

1 Like