[Insight-users] Problem of ImageToVTKImageFilter, when displaying 2 images

Patrick Cheng cheng at isis.georgetown.edu
Wed Jan 25 13:23:20 EST 2006



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
>>>
>>>
> 
> 


More information about the Insight-users mailing list