Get picked vtk actor

my vtk setup looks like this: I have displayed 1 DICOM image as a vtk2DActor (rendered in one renderer) and on top of the vtk2DActor I have placed a bunch of other vtk2DActors based on a vtkImageCanvasSource. My code for displaying my actors looks like the following:

def display(actors_image_layer, actors_circle_layer, size):
image_renderer = vtk.vtkRenderer()
scene_renderer = vtk.vtkRenderer()
render_window = vtk.vtkRenderWindow()

image_renderer.SetLayer(0)
scene_renderer.SetLayer(1)

render_window.SetNumberOfLayers(2)
render_window.AddRenderer(image_renderer)
render_window.AddRenderer(scene_renderer)

render_window_interactor = vtk.vtkRenderWindowInteractor()
render_window_interactor.SetRenderWindow(render_window)
render_window_interactor.AddObserver('LeftButtonPressEvent',
                                     left_button_pressed)


for actor in actors_image_layer:
    image_renderer.AddActor(actor)

for actor in actors_circle_layer:
    scene_renderer.AddActor(actor)

render_window.SetSize(size[0], size[1])

render_window.Render()
render_window_interactor.Initialize()
render_window_interactor.Start()

As you can see, I added an observer for when the left button is pressed. When this observer is called I want to select the picked actor, the code looks like the following.

    def left_button_pressed(obj: vtk.vtkRenderWindowInteractor, ev):
click_pos = obj.GetEventPosition()

picker = vtk.vtkPropPicker()
picker.Pick(click_pos[0],
            click_pos[1],
            0,
            obj.FindPokedRenderer(click_pos[0], click_pos[1]))

poked_renderer = obj.FindPokedRenderer(click_pos[0], click_pos[1])
actor = picker.GetActor()

print("Poked renderer:", poked_renderer)
print("Number of visible actors in renderer:", poked_renderer.VisibleActorCount())
print("Picked actor:", actor)

My problem is, that picker.GetActor() returns None. Even though a renderer was found and this renderer has 43 visible actors.

I hope someone can point me in the right direction so I can pick the correct actor. Thanks for your help!

I would suggest to try different pickers. I had problems with vtkPropPicker while others worked well.

Hey Andras, I changed my actors to type vtk.vtkImageActor instead of vtk.vtkActor2D, now I can use the vtkAreaPicker. Thanks your input!