Hi Clint,<br><br>You are right. There is something wrong with the pipeline, but it&#39;s something that is ok for vtkImageViewer.<br><br>I have this code at the constructor of a class:<br><br>&nbsp;&nbsp; image_view = vtkImageViewer2::New();<br>
<br>&nbsp;&nbsp; /*** image_view-&gt;SetInput(reader-&gt;GetOutput()); */<br><br>&nbsp;&nbsp; vtkWidget-&gt;SetRenderWindow(image_view-&gt;GetRenderWindow());<br>&nbsp;&nbsp; image_view-&gt;SetupInteractor(vtkWidget-&gt;GetRenderWindow()-&gt;GetInteractor());<br>
&nbsp;&nbsp; image_view-&gt;SetColorLevel(138.5);<br>&nbsp;&nbsp; image_view-&gt;SetColorWindow(233);<br>&nbsp;&nbsp; vtkWidget-&gt;show();<br><br>It is basically the same code of the VTK/Examples/GUI/Qt/ImageViewer example, except that I&#39;m not calling the SetInput method at this time.<br>
<br>The reason I do this is because the SetInput is called by one method in order to update the image to be displayed in the widget. The method is just this:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image_view-&gt;SetInput(NEW_IMAGE);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image_view-&gt;Render();<br>
<br>This method is called when a slider moves and it works fine with the vtkImageViewer, but it is not working the same way with the vtkImageViewer2.<br><br>How can I do this using vtkImageViewer2? I tried to load a dummy picture in the constructor, but when the slider moves, it doesn&#39;t update the widget with new images.<br>
<br>Thank&#39;s<br>Luis<br><br><div class="gmail_quote">On Tue, Nov 11, 2008 at 11:37 PM, Clinton Stimpson <span dir="ltr">&lt;<a href="mailto:clinton@elemtech.com">clinton@elemtech.com</a>&gt;</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;">
<br>
If I replace vtkImageViewer with vtkImageViewer2 in the VTK/Examples/GUI/Qt/ImageViewer example, it works fine.<br>
Your errors indicate something wrong with how you&#39;ve set up the image pipeline, not with how you&#39;ve set up the window.<br>
<br>
Clint<div class="Ih2E3d"><br>
<br>
Luis Roberto P. Paula wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Is there anyone in this group that have used vtkImageViewer2 with QVTKWidget successfully?<br>
<br>
Am I wrong to think that QVTKWidget works only with vtkImageViewer?<br>
<br>
Thanks,<br>
Luis<br>
<br></div><div><div></div><div class="Wj3C7c">
On Mon, Nov 10, 2008 at 7:47 PM, Luis Roberto P. Paula &lt;<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a> &lt;mailto:<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;Hi All,<br>
<br>
 &nbsp; &nbsp;I&#39;m trying to use the vtkImageViewer2 to display a 2D image in a<br>
 &nbsp; &nbsp;QVTKWidget, but I&#39;m getting some errors.<br>
<br>
 &nbsp; &nbsp;Here is a piece of code:<br>
<br>
 &nbsp; &nbsp; &nbsp; image_viewer = vtkImageViewer2::New();<br>
 &nbsp; &nbsp; &nbsp; qvtkWidget-&gt;SetRenderWindow(image_viewer-&gt;GetRenderWindow());<br>
 &nbsp; &nbsp; &nbsp; image_viewer-&gt;SetInput(get2DImage());<br>
 &nbsp; &nbsp; &nbsp; image_viewer-&gt;Render();<br>
<br>
 &nbsp; &nbsp;Error messages:<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,<br>
 &nbsp; &nbsp;line 267<br>
 &nbsp; &nbsp;vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned<br>
 &nbsp; &nbsp;char scalars as input<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,<br>
 &nbsp; &nbsp;line 267<br>
 &nbsp; &nbsp;vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned<br>
 &nbsp; &nbsp;char scalars as input<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In<br>
 &nbsp; &nbsp;/home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,<br>
 &nbsp; &nbsp;line 725<br>
 &nbsp; &nbsp;vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of<br>
 &nbsp; &nbsp;algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0<br>
 &nbsp; &nbsp;connections but is not optional.<br>
<br>
 &nbsp; &nbsp;ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,<br>
 &nbsp; &nbsp;line 267<br>
 &nbsp; &nbsp;vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned<br>
 &nbsp; &nbsp;char scalars as input<br>
<br>
 &nbsp; &nbsp;-------------------------------------------------------------------------------------------<br>
<br>
 &nbsp; &nbsp;Does anybody knows how to fix this? It works with the<br>
 &nbsp; &nbsp;vtkImageViewer class, but I think the vtkImageViewer2 is a better<br>
 &nbsp; &nbsp;option to display a 2D image in a widget.<br>
<br>
 &nbsp; &nbsp;Thank&#39;s<br>
 &nbsp; &nbsp;Luis<br>
<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<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>
 &nbsp;<br>
</blockquote>
<br>
<br>
</blockquote></div><br>