[Insight-users] Possible bug: itkImageToVTKImageFilter not updating
when expected
Luis Ibanez
luis.ibanez@kitware.com
Fri, 21 Mar 2003 22:25:52 -0500
Hi Parag,
Here are several factors that can help
1) The ImageToVTKImageFilter is not properly
a filter. It is just a class grouping a
itkImageExporter with a vtkImageImporter.
So, when you call "Update" it is not
doing anything.
That being said, the fact that its output
is the output of the vktImporter, make that
it should behave normally in a pipeline.
2) Something seems to be non standard in the
way the image are in the std::vector<>.
What method did you finally used to put
these images in the std::vector<> after
reading them from files ?
3) Could you try calling ->Modified() in
the image as soon as it is connected
to the ITK to VTK filter, in the slider
callback ?
It could be that the filter doesn't
realize that it is now receiving new
data and henceforth it is time to update.
Luis
-----------------------
Parag Chandra wrote:
> Hey Luis,
>
> Yes, the slider also manually calls Render(). Really the only difference I
> can think of between the two applications is the manner in which the image
> is provided as input.
>
> Best regards,
> -Parag
>
> ----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez@kitware.com>
> To: "Parag Chandra" <pchandra@radonc.unc.edu>
> Cc: "ITK Mailing List" <insight-users@public.kitware.com>
> Sent: Friday, March 21, 2003 6:22 PM
> Subject: Re: [Insight-users] Possible bug: itkImageToVTKImageFilter not
> updating when expected
>
>
>
>>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
>>
>>
>>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>