[Insight-users] Problem of ImageToVTKImageFilter,
when displaying 2 images
ask ITK
askitk at gmail.com
Mon Jan 30 15:41:20 EST 2006
Dear Markova Aneta,
Thanks a lot for the suggestion...
but I should use 2 resampler at the beginning...
my code is something like :
===========================================================
void ApplicationCore::callViewer(ImagePtr image, int choice)
{
m_ImageViewer[choice]->SetupInteractor( m_renderWindowInteractor[choice]);
m_itkvtkconnector[choice]->SetInput( image );
m_itkvtkconnector[choice]->Update();
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();
}
===========================================================
but the problem exist......why I feel it is related to the interator
is that because
when I just view the image at the "first instant", it is ok....
but when I click either of the image, the first image will become the
second image...
and same thing occur if I have 3 images, then when i clicked the first image,
it will change to the 3rd image.....
I try to find out the problem in the interactor...but right now still
not succeed.....
2006/1/26, Markova Aneta <amarkova at etro.vub.ac.be>:
> Hi,
>
> I am also using ImageToVTKImageFilter to visualize 2 images. As you did
> I have created 2 different viewers and 2 different interactors. But I
> faced the same problem. Loading the first image is fine, but after I
> load the second image, the first image also becomes the second image.
>
> So the problem to that is not in the visualization routine but it is due
> to the fact the input to the 2 viewers is the output of the same
> filter(for example: resampler->GetOutput()). So you have 2 solutions:
> 1. use 2 resampler filters
> 2. save the 2 images and then read the files and visualize it using 2
> viewers and interactors.
>
>
> Hope that help,
> Aneta
>
>
> -----Original Message-----
> From: insight-users-bounces+amarkova=etro.vub.ac.be at itk.org
> [mailto:insight-users-bounces+amarkova=etro.vub.ac.be at itk.org] On Behalf
> Of ask ITK
> Sent: Wednesday, January 25, 2006 7:58 PM
> To: Patrick Cheng
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Problem of ImageToVTKImageFilter,when
> displaying 2 images
>
> Sorry...it doesn't work...
> I am trying is that related to the interactor....
>
> 2006/1/26, Patrick Cheng <cheng at isis.georgetown.edu>:
> >
> >
> > ask ITK wrote:
> > > Thanks a lot for the suggestion...
> > > but the problem seems to exist...but in other form.....
> > > Now half of the first image is destroyed after loading the second
> image....
> > >
> > > Error message now becomes:
> > > ERROR: In D:\Research\VTK\src\Imaging\vtkImageImport.cxx, line 303
> > > vtkImageImport (020D50E0): Unknown exception.
> > >
> > > ERROR: In D:\Research\VTK\src\Imaging\vtkImageImport.cxx, line 324
> > > vtkImageImport (020D50E0): Unknown exception.
> > >
> > > I change my code like this....
> > > =================================================
> > > void ApplicationCore::callViewer(ImagePtr image, int choice)
> > > {
> > > m_ImageViewer[choice]->SetupInteractor(
> m_renderWindowInteractor[choice]);
> > >
> > > // new the connector every time
> > > itkvtkConnectorPtr itkvtkconnector =
> itkvtkConnectorType::New() ;
> > > itkvtkconnector->SetInput( image );
> > itkvtkconnector->Update() //try add this line, see if it
> helps.
> > > m_ImageViewer[choice]->SetInput( itkvtkconnector->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();
> > > }
> > >
> > > ==================================================
> > >
> > >
> > >
> > >
> > > 2006/1/26, Patrick Cheng <cheng at isis.georgetown.edu>:
> > >> Hi,
> > >>
> > >> This is a long existing problem. Trying to figure out why too.
> > >>
> > >> A quick and dirty fix is to instantiate a new
> itkImageToVTKImageFilter
> > >> every time you read a new image.
> > >>
> > >> Patrick
> > >>
> > >>
> > >>
> > >> ask ITK wrote:
> > >>> Problem occurs when I want to use itkImageToVTKImageFilter to
> display
> > >>> 2 different images.
> > >>>
> > >>> I want to display to different image with the VTK viewer..
> > >>> of coz I think it requires 2 different viewers and 2 different
> interactors.
> > >>> So I created 2 for both of them.
> > >>>
> > >>> Loading the first image is fine, but after I load teh second
> image,
> > >>> the first image also become the second image!
> > >>> I don't know how to solve this problem...so please help...
> > >>>
> > >>> following error is displayed:
> > >>>
> > >>> ERROR: In
> D:\Research\VTK\src\Filtering\vtkStreamingDemandDrivenPipeline.cxx,
> > >>> line 643
> > >>> vtkImageImportExecutive (020D8F78): The update extent specified in
> the
> > >>> information for output port 0 on algorithm
> vtkImageImport(020D8AD0) is
> > >>> 0 142 0 167 0 0, which is outside the whole extent 0 141 0 166 0
> 0.
> > >>>
> > >>> I attached my code below, very short, can I can run the program
> > >>> smoothly except the stated error. Please help, thanks!
> > >>> =======================================================
> > >>>
> > >>> void ApplicationCore::callViewer(ImagePtr image, int choice)
> > >>> {
> > >>> m_itkvtkconnector[choice]->SetInput( image );
> > >>>
> > >>> 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();
> > >>> }
> > >>> =======================================================
> > >>> _______________________________________________
> > >>> Insight-users mailing list
> > >>> Insight-users at itk.org
> > >>> http://www.itk.org/mailman/listinfo/insight-users
> > >>>
> > >>>
> > >
> > >
> >
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list