[vtkusers] Problem with vtkImageViewer2 and QVTKWidget

Luis Roberto P. Paula luisrpp at gmail.com
Tue Nov 11 21:38:30 EST 2008


Hi Clint,

You are right. There is something wrong with the pipeline, but it's
something that is ok for vtkImageViewer.

I have this code at the constructor of a class:

   image_view = vtkImageViewer2::New();

   /*** image_view->SetInput(reader->GetOutput()); */

   vtkWidget->SetRenderWindow(image_view->GetRenderWindow());

image_view->SetupInteractor(vtkWidget->GetRenderWindow()->GetInteractor());
   image_view->SetColorLevel(138.5);
   image_view->SetColorWindow(233);
   vtkWidget->show();

It is basically the same code of the VTK/Examples/GUI/Qt/ImageViewer
example, except that I'm not calling the SetInput method at this time.

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:

      image_view->SetInput(NEW_IMAGE);
      image_view->Render();

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.

How can I do this using vtkImageViewer2? I tried to load a dummy picture in
the constructor, but when the slider moves, it doesn't update the widget
with new images.

Thank's
Luis

On Tue, Nov 11, 2008 at 11:37 PM, Clinton Stimpson <clinton at elemtech.com>wrote:

>
> If I replace vtkImageViewer with vtkImageViewer2 in the
> VTK/Examples/GUI/Qt/ImageViewer example, it works fine.
> Your errors indicate something wrong with how you've set up the image
> pipeline, not with how you've set up the window.
>
> Clint
>
> Luis Roberto P. Paula wrote:
>
>> Is there anyone in this group that have used vtkImageViewer2 with
>> QVTKWidget successfully?
>>
>> Am I wrong to think that QVTKWidget works only with vtkImageViewer?
>>
>> Thanks,
>> Luis
>>
>> On Mon, Nov 10, 2008 at 7:47 PM, Luis Roberto P. Paula <luisrpp at gmail.com<mailto:
>> luisrpp at gmail.com>> wrote:
>>
>>    Hi All,
>>
>>    I'm trying to use the vtkImageViewer2 to display a 2D image in a
>>    QVTKWidget, but I'm getting some errors.
>>
>>    Here is a piece of code:
>>
>>       image_viewer = vtkImageViewer2::New();
>>       qvtkWidget->SetRenderWindow(image_viewer->GetRenderWindow());
>>       image_viewer->SetInput(get2DImage());
>>       image_viewer->Render();
>>
>>    Error messages:
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,
>>    line 267
>>    vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned
>>    char scalars as input
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,
>>    line 267
>>    vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned
>>    char scalars as input
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In
>>    /home/luis/dev-tools/VTK/Filtering/vtkDemandDrivenPipeline.cxx,
>>    line 725
>>    vtkStreamingDemandDrivenPipeline (0x8ba9890): Input port 0 of
>>    algorithm vtkImageMapToWindowLevelColors(0x8b62358) has 0
>>    connections but is not optional.
>>
>>    ERROR: In /home/luis/dev-tools/VTK/Rendering/vtkImageActor.cxx,
>>    line 267
>>    vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned
>>    char scalars as input
>>
>>
>>  -------------------------------------------------------------------------------------------
>>
>>    Does anybody knows how to fix this? It works with the
>>    vtkImageViewer class, but I think the vtkImageViewer2 is a better
>>    option to display a 2D image in a widget.
>>
>>    Thank's
>>    Luis
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081112/fc15fd73/attachment.htm>


More information about the vtkusers mailing list