This is very close to what I did. But what if I wanna draw over the
image displayed in QVTKWidget using the left button of the mouse. If I
use the code you sent, I'll just control the window/level parameters.<br><br><div class="gmail_quote">On Wed, Jan 28, 2009 at 1:57 PM, Wagner Sales <span dir="ltr"><<a href="mailto:wsales@gmail.com">wsales@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Arnaud,<br><br>Yes, are possible to use how much QVTKWidgets you needs on a application. QVTKWidget will only provide one advantage: you can use VTK+Qt ( like ParaView ). This commented example may be helps you:<br>
<br>
// creates the QVTKWidget.<br>QVTKWidget widget;<br> widget.resize(256,256); // resize<br> <br> vtkPNGReader* reader = vtkPNGReader::New(); // a VTK reader like in and other example<br> char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/vtk.png"); // vtk stuff<br>
reader->SetFileName(fname); // vtk stuff<br> delete [] fname;<br><br> vtkImageViewer* image_view = vtkImageViewer::New(); // an image viewer -- vtk stuff<br> image_view->SetInputConnection(reader->GetOutputPort()); // vtk stuff<br>
<br> widget.SetRenderWindow(image_view->GetRenderWindow()); // Qt + vtk stuff ---> setting the Qt widget render window with the image_view render window<br> image_view->SetupInteractor(widget.GetRenderWindow()->GetInteractor()); // Qt + vtk stuff ---> setup the interactor in image view <br>
<br> image_view->SetColorLevel(138.5); // vtk stuff<br> image_view->SetColorWindow(233); // vtk stuff<br><br> widget.show(); // qt stuff<br><br>In this example, I think are clear that's the work thats are needed to put a image viewer in a Qt Widget are very simple. You can see that's are really very few lines to do this, without traps, and the other lines are the VTK stuff just like you have in any other VTK example. In fact, if you remove the Qt lines ad creates the Interactor, with a Interactor->Start() and a RenderWindow->Render() you have all the example without Qt ( pure VTK).<br>
<br>I hope this example are more clear and closely to a good answer. <br><div><div></div><div class="Wj3C7c"><br>Regards,<br><br>Wagner <br><br><br><div class="gmail_quote">2009/1/28 Luis Roberto P. Paula <span dir="ltr"><<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Arnaud and Wagner,<br><br>Thank's for the tips. Actually, I have already connected VTK and Qt. The problem is that I need to draw a free line over an image being displayed in the QVTKWidget, and by default, this widget controls the window/level parameters when the left button of the mouse is pressed.<br>
<br>Sorry for not being very clear, but my question is: How can I take the advantages of vtkImageTracerWidget and still display the image in a Qt window. Is it possible to use more than one widget at the same time?<br><br>
Thank's,<br><font color="#888888">Luis</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Jan 28, 2009 at 10:36 AM, Wagner Sales <span dir="ltr"><<a href="mailto:wsales@gmail.com" target="_blank">wsales@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Luis,<br><br>Basically, QVTKWidget provides you a vtkRenderWindow with an interactor ( the last can be changed after ). <br>The VTK/Qt events are managed by vtkEventQtSlotConnect. Of course, if you wants, you can use callbacks like in VTK. Then, if you are developing in C++, take a look at examples in VTK/Examples/GUI/Qt/VTK/Examples/GUI/Qt/. This examples will help you how to acces the vtkRenderWindow and how to connect VTK and Qt. <br>
Your task are easy to do, but I developed with Qt and VTK, and the best way to learn ( at least to me ) are by the examples.<br><br><br>Regards,<br><br>Wagner <br><br><div class="gmail_quote">2009/1/28 Luis Roberto P. Paula <span dir="ltr"><<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi All,<br><br>I need to implement an image tracer, just like the one provided in VTK/Examples/GUI/Python/ImageTracerWidget.py, but I need to do it using Qt (QVTKWidget).<br>
<br>Does anybody knows how can I do that?<br><br>
Thanks in advance,<br><font color="#888888">Luis<br>
</font><br></div></div>_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>