[Insight-users] Possible bug: itkImageToVTKImageFilter not updating when expected

Luis Ibanez luis.ibanez@kitware.com
Fri, 21 Mar 2003 18:22:50 -0500


Hi Parag,

Does the callback for the slider also calls Render()
on the interactors render window ?

In addition to switching the input image, you may want
to call Render() again, since the pipeline is driven by
demand, changing inputs will not force the update of
filters downstream.


You have to pull data from the end of the pipeline.



Regards,


    Luis


------------------------------------

Parag Chandra wrote:
> I'm seeing a problem where my ITK->VTK pipeline isn't getting updated 
> correctly, but a seemingly unnecessary workaround fixes the problem, so 
> I thought this might be a bug.
>  
> In short, I have subclassed vtkFlRenderWindowInteractor to 
> create HeightFieldInteractor, which simply takes an input ITK 2D image 
> and displays it as a height field, using itkImageToVTKImageFilter. I've 
> then created an application that embeds this HeightFieldInteractor 
> widget into its main window. The application just lets you load an ITK 
> image from disk and then displays it as a height field. So the pipeline 
> is something like:
>  
> itkImageFileReader -> itkImageToVTKImageFilter -> 
> vtkImageDataGeometryFilter -> vtkWarpScalarFilter -> vtkPolyDataMapper 
> -> vtkActor
>  
> This application works perfectly: as soon as I load a new image from 
> disk, I call Render() on the interactor's RenderWindow, and the window 
> is updated to reflect the contents of the new image.
>  
> A second application embeds both the same HeightFieldInteractor and an 
> additional instance of vtkFlRenderWindowInteractor into its main window. 
> This application loads a series of a dozen or so 2-D ITK images at 
> startup and keeps them around in a std::vector. I then use a slider to 
> select between these images, and the callback for the slider simply sets 
> the input of itkImageToVTKImageFilter to the appropriate image stored in 
> the vector. So the pipeline is something like this:
>  
> vectorOfImages[sliderValue] -> itkImageToVTKImageFilter -> etc.
>  
> In this instance, the render window never gets updated no matter how 
> many times the slider is moved around; it always shows the first image 
> that was set. I even tried manually calling Modified() and Update() on 
> the itkImageToVTKImageFilter, as well as manually Update()'ing other 
> filters farther up/down the pipeline, but to no avail. However, if I 
> insert a simple CopyFilter that I created into the pipeline above:
>  
> vectorOfImages[sliderValue] -> myCopyImageFilter -> 
> itkImageToVTKImageFilter -> etc.
>  
> then the updates happen correctly. This CopyImageFilter simply copies 
> the input image over to the output unchanged.
>  
> Does someone with a better knowledge of the internal workings of ITK and 
> VTK have an idea what might be going on here? I should again note that 
> I'm still using ITK 1.0 and VTK 4.0 on Windows, so sorry if this has 
> already been fixed. I'm just holding off on upgrading to the latest 
> versions until I reach certain milestones in my project. Thanks.
>  
> Best regards,
> -Parag Chandra