[Insight-users] Problem using ImageToVTKImageFilter and QVTKWidget

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 12 13:24:04 EDT 2009


Hi Françoise

Thanks for letting us know that the vtkKWImage classes
solved the problem.

and,

Thanks for reporting the bug in MANTIS.


     Luis


------------------------------------------------------------------------
2009/10/12 Françoise Lefebvre <lefebvre at imnc.in2p3.fr>:
>
> Hi Luis,
>
> Thanks a lot, it works fine with those classes.
>
> I only duplicated and modified a few fonctions in vtkKWImage.cxx because it
> is written for 3D data and I am currently working with 2D images.
>
> Following your suggestion, I reported the bug in MANTIS.
>
> Best regards,
>
> Françoise
>
>
>
> Luis Ibanez a écrit :
>>
>> Hi Francois,
>>
>> This looks like a bug in the itkImageToVTKImageFilter,
>> probably associated with the pipeline negotiation for
>> the requested image region.
>>
>> Could you please do the following:
>>
>> a) Log a bug report in MANTIS:
>>    http://public.kitware.com/Bug/my_view_page.php
>>
>>
>> b) try using the convenience classes:
>>
>> InsightApplications/Auxiliary/vtk/
>>
>> vtkKWImage.cxx
>> vtkKWImage.h
>> vtkKWImageIO.cxx
>> vtkKWImageIO.h
>>
>> You will find them explained in the Insight Journal paper:
>>
>> http://www.insight-journal.org/browse/publication/146
>>
>>
>> It will be interesting to see if the same problem happens
>> with these classes or not.
>>
>> You may also find convenient the way in which these
>> classes deal with image reading.
>>
>>
>>     Regards,
>>
>>
>>           Luis
>>
>>
>>
>> ---------------------------------------------------------------------------
>> 2009/10/5 Françoise Lefebvre <lefebvre at imnc.in2p3.fr>:
>>>
>>> Hello,
>>>
>>> I got a problem using ImageToVTKImageFilter together with QVTKWidget in
>>> QT.
>>>
>>> I am using Qt4.4.3, vtk5.4, itk3.14, msvc2008.
>>>
>>>
>>> Here's part ok my code:
>>>
>>> typedef itk::Image<unsigned short,2>            ImageType;
>>> typedef itk::ImageFileReader<ImageType>         ReaderType;
>>> typedef itk::ImageToVTKImageFilter<ImageType>   ConnectorType;
>>>
>>> vtkPNGReader* readerVTK = vtkPNGReader::New();
>>> readerVTK->SetFileName("file.png");
>>>
>>> ReaderType::Pointer readerITK = ReaderType::New();
>>> readerITK->SetFileName("file.png");
>>> ConnectorType::Pointer connector = ConnectorType::New();
>>> connector->SetInput( readerITK->GetOutput() );
>>>
>>> vtkImageData* vtkimage = vtkImageData::New();
>>> // Uses VTK Classes to read -> OK
>>> vtkimage = readerVTK->GetOutput();
>>> // Uses ITK_VTK Connector -> segmentation fault
>>> vtkimage = connector->GetOutput();
>>>
>>> vtkImageViewer* viewer = vtkImageViewer::New();
>>> viewer->SetInput(vtkimage );
>>> qvtkWidget->SetRenderWindow(viewer->GetRenderWindow());
>>>
>>> viewer->SetupInteractor(qvtkWidget->GetRenderWindow()->GetInteractor());
>>> viewer->Render();
>>> viewer->SetColorWindow( 254 );
>>> viewer->SetColorLevel( 128 );
>>>
>>>
>>>
>>> Using QVTKWidget and a vtkReader (vtkPNGReader in my case) works fine but
>>> using QVTKWidget  and an ImageToVTKImageFilter connector makes the
>>> program
>>> crash in the paintEvent.
>>>
>>> When turning on the setAutomaticImageCacheEnabled to true, the program
>>> crashes in the paintEvent when the window is resized (size increased).
>>>
>>> Thanks for your help
>>>
>>>
>>> Françoise LEFEBVRE
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>
> --
> Françoise LEFEBVRE
> IMNC-Imagerie et Modélisation en Neurobiologie et Cancérologie
> Campus d'Orsay - Bât 440
> 91406 ORSAY Cedex
> Tel : 01 69 15 51 87
>
>


More information about the Insight-users mailing list