[Insight-users] itkImageToVTKImageFilter Pipeline Reuse Crash

goodsit2 goodsije at live.com
Sat Nov 10 13:20:18 EST 2012


I've searched through previous messages on both the itk and vtk mailing list,
but found only one post on this topic with no response. Hopefully this time
someone will have a solution! 

Concisely, my pipeline is as follows: itk::ImageSeriesReader ->
itkImageToVTKImageFilter -> vtkImageViewer2 -> QVTKWidget.  A little more
elaborately, the code goes like this: 

Initially when entering the GUI, the pipeline is established like so: 

        //reader is an itkImageSeriesReader with specified InputImageType. 
        //currImage is an itkImage which has the specified InputImageType. 
        // iToVconnector is the itkImageToVTKImageFilter pointer. 
        // imageViewer is the vtkImageViewer2 pointer. 
        // myWindow is the QVTKWidget pointer. 
        reader->SetFileName("Black Screen.dcm"); 
        reader->Update(); 
        currImage = reader->GetOutput(); 
        currImage->DisconnectPipeline(); 

        // Connect reader and filter. 
        iToVconnector->SetInput(currImage); 

        // Create and connect imageViewer to filter. 
        imageViewer = vtkImageViewer2::New(); 
        imageViewer->SetInput(iToVconnector->GetOutput()); 

        // Connect the widget to the imageViewer. 
        myWindow->SetRenderWindow(imageViewer->GetRenderWindow()); 

As you can see, I do disconnect the reader pipeline, but currImage does not
go out of scope since it is a member variable. Later, I try to introduce a
new input into the iToVconnector and that is where it crashes. Here is that
code: 

    // newCurrImage is an itkImage which has been disconnected from its
pipeline. 
    iToVconnector->SetInput(newCurrImage);   //CRASHES
HERE!!!!!!!!!!!!!!!!!!!!!!!! 
    iToVconnector->Update(); 
    imageViewer->UpdateDisplayExtent(); 
    imageViewer->Render(); 
    imageViewer->GetRenderer()->ResetCamera(); 
    myWindow->update(); 
    currImage = newCurrImage; 


I'm thinking that it crashes because iToVconnector is not a disconnected
pipeline, how can I disconnect it and be able to introduce new items to the
my pre-existing pipeline? 

Here is the similar post from a long while back:
http://vtk.1045678.n5.nabble.com/Crash-in-vtkImageViewer2-when-Input-is-changed-tt1250027.html

Thanks for your time. 

Bests, 

Jeremy



--
View this message in context: http://itk-users.7.n7.nabble.com/itkImageToVTKImageFilter-Pipeline-Reuse-Crash-tp30008.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list