[Insight-users] Please help with the ITK and VTK pipeline problem

ask ITK askitk at gmail.com
Thu Feb 2 13:38:53 EST 2006


Dear,

       I have a problem related to display the ITK data again, I
cannot solve it with many trials, please help.

I make a function called callViewer, by inputing different ITK images
data, I attempt to display different images. And the callViewer is a
member function with
the itkvtk connector and vtkimageviewer and interactor as member
variable of the
class ApplicationCore.

=======================================================
void ApplicationCore::callViewer(ImagePtr image, int choice)
{
m_itkvtkconnector[choice]->SetInput( image );
m_itkvtkconnector[choice]->Update();
	
m_ImageViewer[choice]->SetupInteractor( m_renderWindowInteractor[choice]);
m_ImageViewer[choice]->SetInput( m_itkvtkconnector[choice]->GetOutput() );

m_ImageViewer[choice]->SetSize(image->GetLargestPossibleRegion().GetSize()[0],image->GetLargestPossibleRegion().GetSize()[1]);
	
m_ImageViewer[choice]->Render();
m_ImageViewer[choice]->SetColorWindow( 255);
m_ImageViewer[choice]->SetColorLevel( 128);

//	m_renderWindowInteractor[choice]->Start();
}
========================================================

Then I create an image and display it with callViewer, everything fine, i.e.
callViewer(m_Image,0);
A viewer pops up and display the image.

Then I use the ITK gaussian filter to create another image
m_gaussianimage from m_image. and call
callViewer(m_gaussianimage,0);
everything fine, the viewer display the filtered image.

BUT PROBLEM arises here,
when I call
callViewer(m_Image,0);
again.
The viewer STILL displays the filtered image, I have no way to
display the original image. I have tried to resetpipeline after the
gaussianfilter
output is obtained, but the problem still existed (I don't know the
correct way to solve, just try different approaches).

Actually if i further created a m_gradientimage from the
m_gaussianimage (or even
the m_Image), then the viewer will sticked with the m_gradientimage
and cannot display the m_Image or m_gaussianimage, even the input to
the
callViewer
are m_Image or m_gaussianimage .

I really cannot find out the reason of the problem, is that due to the
ITKfilter pipeline?
Or is that due to the itkvtk filter?????
Or the only solution is everytime I change the input image I have to
create a new vtkviewer instead of using the same vtkviewer?

Please kindly help me about this problem!!!!
Thanks a lot!!!!!!!!!


More information about the Insight-users mailing list