[vtkusers] Pipeline Issue with itkImageToVTKImageFilter

goodsit2 goodsije at live.com
Wed Nov 7 16:20:22 EST 2012


I've searched through previous messages, 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.  In a little more
elaborate pseudo code it 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?

Thanks for your time.

Bests,

Jeremy




--
View this message in context: http://vtk.1045678.n5.nabble.com/Pipeline-Issue-with-itkImageToVTKImageFilter-tp5717025.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list