# Why vtkImageTracerWidget doesn't work

**URL:** https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137
**Category:** Support
**Tags:** python
**Created:** [August 11, 2023, 2:22pm UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137 "2023-08-11T14:22:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [August 11, 2023, 2:22pm UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/1 "2023-08-11T14:22:43Z")

</div>

Why vtkImageTracerWidget doesn’t work？

```auto
import vtk
reader=vtk.vtkDICOMImageReader()
reader.SetDirectoryName("DicomData/16")
reader.Update()

view=vtk.vtkImageViewer2()
view.SetInputConnection(reader.GetOutputPort())

interactor = vtk.vtkInteractorStyleImage()
iren=vtk.vtkRenderWindowInteractor()
iren.SetInteractorStyle(interactor)

imageActor = vtk.vtkImageActor()
imageActor.GetMapper().SetInputData(view.GetInput())

view.SetupInteractor(iren)
itw = vtk.vtkImageTracerWidget()
itw.SetCaptureRadius(100)
itw.GetGlyphSource().SetColor(1, 0, 0)
itw.GetGlyphSource().SetScale(3.0)
itw.GetGlyphSource().SetRotationAngle(45.0)
itw.GetGlyphSource().Modified()
itw.ProjectToPlaneOn()
itw.SetViewProp(imageActor)
itw.SetInputData(view.GetInput())
itw.SetInteractor(iren)
itw.PlaceWidget()

itw.SnapToImageOff()
itw.AutoCloseOn()

itw.On()
iren.Start()

```

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [August 12, 2023, 10:11pm UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/2 "2023-08-12T22:11:18Z")

</div>

Hi,

Try calling `InteractionOn()` and `SetEnabled(1)` on `itw`.

regards,

PC

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [August 13, 2023, 2:11am UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/3 "2023-08-13T02:11:09Z")

</div>

I’m sorry, but unfortunately it doesn’t work

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [August 14, 2023, 11:08am UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/4 "2023-08-14T11:08:30Z")

</div>

Hello,

Well, saying “it doesn’t work” is like saying “everywhere” when the doctor asks where the pain is… So, what do you mean by “it doesn’t work”? Can you describe the issue in more detail and/or post an image?

regards,

PC

---

<div class="post-metadata">

### Author: ![yangyang117](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/y/da6949/32.png) [@yangyang117](https://discourse.vtk.org/u/yangyang117)
#### Post date: [December 10, 2023, 3:42am UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/5 "2023-12-10T03:42:15Z")

</div>

Hello, I am using QVTKRenderWindow Interface and placing vtkImageViewer2 on QtWidgets In QFrame(), then use vtkImageTracerWidget() for trajectory tracking. The result is that holding down the left mouse button and dragging will call for window width and level adjustment of vtkImageViewer2, rather than displaying the trajectory. May I ask how to solve it?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [March 15, 2025, 9:47pm UTC](https://discourse.vtk.org/t/why-vtkimagetracerwidget-doesnt-work/12137/6 "2025-03-15T21:47:33Z")

</div>

Hi,

What are you trying to accomplish? I mean, what do you mean by “trajectory tracking”? Please, describe or illustrate in more detail so we can get a precise idea of what you need.

best,

PC
