<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you very much for reaching out!<br class=""><br class="">I got actually one step further and could implement and understand the EventTimer as in the Python animation example. However, instead of updating the position or any other property of an actor I would like to update the texture of a plane to play a video on this plane. To do this I would need to pass more than just the actor (as in the <a href="https://www.vtk.org/Wiki/VTK/Examples/Python/Animation" class="">https://www.vtk.org/Wiki/VTK/Examples/Python/Animation</a>) to the vtkTimerCallback() and update it by the timercount. I think I need to pass the VideoCapture (cap) object, and execute everything after „while cap.isOpened():“ I am new to object oriented programming and I don’t see how to pass more than the actor object to the vtkTimerCallback() class. Below is a code snippet to show how I map the texture on the plane repeatedly to play a video, but without being able to interact with the 3D scene. <div class=""><br class=""></div><div class="">Best and thanks for any help!</div><div class="">Andreas<br class=""><div class=""><br class=""></div><div class=""><div class=""><div class=""><div class="">import vtk</div><div class="">import cv2<br class="">from vtk.util import numpy_support<br class=""><br class="">VIDEOPATH= "/Users/apedroni/AnacondaProjects/objecttracking/ressources/MRI-Video/Videos/20180816-133303.mp4"<br class=""><br class=""><br class="">def setup3dScene(frame):<br class=""><br class=""> frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)<br class=""> vtkArray = numpy_support.numpy_to_vtk(frame.reshape((-1, 3), order='F'), deep=False)<br class=""><br class=""> # Create a vtkImage Object. This is filled with the vtkArray data later<br class=""> vtkImage = vtk.vtkImageData()<br class=""> vtkImage.SetDimensions(720, 1280, 1)<br class=""> vtkImage.SetSpacing(720, 1280, 1)<br class=""> vtkImage.SetOrigin(720, 1280, 0)<br class=""> vtkImage.GetPointData().SetScalars(vtkArray)<br class=""> # create the Texture for a plane<br class=""> atext = vtk.vtkTexture()<br class=""> atext.SetInputData(vtkImage)<br class=""> atext.InterpolateOn()<br class=""><br class=""> # The Screen where the movie is mapped onto<br class=""> plane = vtk.vtkPlaneSource()<br class=""> planeMapper = vtk.vtkPolyDataMapper()<br class=""> planeMapper.SetInputConnection(plane.GetOutputPort())<br class=""> planeActor = vtk.vtkActor()<br class=""> planeActor.SetMapper(planeMapper)<br class=""> planeActor.SetTexture(atext)<br class=""> planeActor.SetScale(0.5625, 1, 1)<br class=""> planeActor.SetOrientation(180, 180, 90)<br class=""><br class=""> # set up the renderer and the window<br class=""> ren = vtk.vtkRenderer()<br class=""> renWin = vtk.vtkRenderWindow()<br class=""><br class=""> ren.AddActor(planeActor)<br class=""> renWin.AddRenderer(ren)<br class=""><br class=""> iren = vtk.vtkRenderWindowInteractor()<br class=""> iren.SetRenderWindow(renWin)<br class=""> ren.SetBackground(0.1, 1, 0.4)<br class=""> renWin.SetSize(1500, 1500)<br class=""> iren.Initialize()<br class=""> iren.Enable()<br class=""><br class=""> ren.ResetCamera()<br class=""> renWin.Render()<br class=""><br class=""> return vtkImage, renWin, iren<br class=""><br class=""><br class="">#1 set up the 3D scene<br class="">#2 Open CV2 Video Capture and update the actors in the 3D scene<br class=""><br class=""># Create a video capture object to read videos<br class="">cap = cv2.VideoCapture(VIDEOPATH)<br class="">success, frame = cap.read()<br class=""><br class=""><br class="">vtkImage, renWin, iren = setup3dScene(frame)<br class=""><br class=""><br class="">while cap.isOpened():<br class=""> # read video<br class=""> videoOk, frame = cap.read()<br class=""> if not videoOk:<br class=""> break<br class=""><br class=""> frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)<br class=""> vtkArray = numpy_support.numpy_to_vtk(frame.reshape((-1, 3), order='F'), deep=False)<br class=""><br class=""> vtkImage.GetPointData().SetScalars(vtkArray)<br class=""> renWin.Render()<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">Am 12.11.2018 um 09:52 schrieb Andaharoo <<a href="mailto:Andx_roo@live.com" class="">Andx_roo@live.com</a>>:<br class=""><br class="">How are you updating your data? There is a timer you can add to the<br class="">interactors that you can use for updating things whilst keeping the<br class="">interactors working. <a href="https://www.vtk.org/Wiki/VTK/Examples/Python/Animation" class="">https://www.vtk.org/Wiki/VTK/Examples/Python/Animation</a><br class=""><<a href="https://www.vtk.org/Wiki/VTK/Examples/Python/Animation" class="">https://www.vtk.org/Wiki/VTK/Examples/Python/Animation</a>> <br class=""><br class=""><br class=""><br class="">--<br class="">Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" class="">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br class="">_______________________________________________<br class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class=""><br class="">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" class="">http://www.vtk.org/Wiki/VTK_FAQ</a><br class=""><br class="">Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" class="">http://markmail.org/search/?q=vtkusers</a><br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class=""><a href="https://public.kitware.com/mailman/listinfo/vtkusers" class="">https://public.kitware.com/mailman/listinfo/vtkusers</a><br class=""></blockquote><br class=""></div></div></div></div></div></body></html>