<div dir="ltr">To change the window name, you have to first call Render() and then set the window name.<br><br>It's the default behaviour of the vtkInteractorStyleImage to change window level/width on "mouse move" which is used by vtkImageViewer2. If you don't want this behavoiur, either subclass the interactor style or simplly don't set the interacator to just display the image.<br>
<br>Jothy<br>
<br><div class="gmail_quote">On Wed, Jul 14, 2010 at 12:23 AM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr"><br>Hello all,<br><br>Following is my code in which I am trying to read a JPEG image and display it:<br><br> vtkSmartPointer<vtkJPEGReader> jpeg_reader = vtkSmartPointer<vtkJPEGReader>::New();<br>
<br> if(jpeg_reader->CanReadFile(file_path.c_str()))<br> {<br> jpeg_reader->SetFileName(file_path.c_str());<br> jpeg_reader->Update(); <br><br> vtkSmartPointer<vtkRenderWindowInteractor> interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
<br> vtkSmartPointer<vtkImageViewer2> image_viewer = vtkSmartPointer<vtkImageViewer2>::New();<br> image_viewer->SetInput(jpeg_reader->GetOutput());<br> image_viewer->SetupInteractor(interactor);<br>
image_viewer->GetRenderer()->ResetCamera();<br> image_viewer->GetRenderer()->SetBackground(1.0, 1.0, 1.0);<br> image_viewer->GetRenderWindow()->SetWindowName("My Window");<br>
<br> interactor->Initialize();<br> interactor->Start();<br> }<br><br><br>The code displays the image but I am having the following issues:<br><br>1. I am not able to change the window name as attempted above. <br>
<br>2. When I hold the left mouse button and drag, I see the image color map changing. I could not understand how to turn this behavior off (if at all this it is not erroneous) by looking at the class references.<br><br>
<br>
Any help will be appreciated.<br><br>Thanks,<br>Prathamesh<br></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<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></div>