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 = slicer.app.layoutManager().threeDWidget(0)
managers = vtk.vtkCollection()
threeDViewWidget.getDisplayableManagers(managers)
for i in range(managers.GetNumberOfItems()):
obj = managers.GetItemAsObject(i)
if obj.IsA('vtkMRMLModelDisplayableManager'):
modelDisplayableManager = obj
break
# Use model displayable manager's point picker
pickedPosition = []
if modelDisplayableManager.Pick(displayPosition[0], displayPosition[1]):
rasPositionArray = vtk.vtkDoubleArray()
rasPositionArray.SetVoidArray(modelDisplayableManager.GetPickedRAS(),3,1)
rasPosition = [rasPositionArray.GetValue(i) for i in range(3)]
print(rasPosition)