[Insight-users] Possible bug: itkImageToVTKImageFilter not updating when expected
Parag Chandra
pchandra@radonc.unc.edu
Fri, 21 Mar 2003 18:05:55 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_012F_01C2EFD4.84660960
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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.=20
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
------=_NextPart_000_012F_01C2EFD4.84660960
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm seeing a problem where my =
ITK->VTK pipeline=20
isn't getting updated correctly, but a seemingly unnecessary workaround =
fixes=20
the problem, so I thought this might be a bug.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>In short, I have subclassed=20
vtkFlRenderWindowInteractor to create HeightFieldInteractor, =
which=20
simply takes an input ITK 2D image and displays it as a height field, =
using=20
itkImageToVTKImageFilter. I've then created an application that embeds =
this=20
HeightFieldInteractor widget into its main window. The application just =
lets you=20
load an ITK image from disk and then displays it as a height field. So =
the=20
pipeline is something like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>itkImageFileReader -> =
itkImageToVTKImageFilter=20
-> vtkImageDataGeometryFilter -> vtkWarpScalarFilter ->=20
vtkPolyDataMapper -> vtkActor</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This application works =
perfectly: as soon=20
as I load a new image from disk, I call Render() on the =
interactor's=20
RenderWindow, and the window is updated to reflect the contents of =
the new=20
image.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>A second application embeds both the =
same=20
HeightFieldInteractor and an additional instance of =
vtkFlRenderWindowInteractor=20
into its main window. This application loads a series of a dozen or so =
2-D ITK=20
images at startup and keeps them around in a std::vector. I then use a =
slider to=20
select between these images, and the callback for the slider simply sets =
the=20
input of itkImageToVTKImageFilter to the appropriate image stored =
in the=20
vector. So the pipeline is something like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>vectorOfImages[sliderValue] ->=20
itkImageToVTKImageFilter -> etc.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>In this instance, the render window =
never gets=20
updated no matter how many times the slider is moved around; it always =
shows the=20
first image that was set. I even tried manually calling Modified() and =
Update()=20
on the itkImageToVTKImageFilter, as well as manually Update()'ing other =
filters=20
farther up/down the pipeline, but to no avail. However, if I insert a =
simple=20
CopyFilter that I created into the pipeline above:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>vectorOfImages[sliderValue] -> =
myCopyImageFilter=20
-> itkImageToVTKImageFilter -> etc.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>then the updates happen correctly. This =
CopyImageFilter simply copies the input image over to the output =
unchanged.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Does someone with a better knowledge of =
the=20
internal workings of ITK and VTK have an idea what might be going on =
here? I=20
should again note that I'm still using ITK 1.0 and VTK 4.0 on Windows,=20
so sorry if this has already been fixed. I'm just holding off =
on=20
upgrading to the latest versions until I reach certain milestones in my =
project.=20
Thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Best regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Parag =
Chandra</FONT></DIV></BODY></HTML>
------=_NextPart_000_012F_01C2EFD4.84660960--