[vtkusers] running parts of a pipeline in parallel
Schaap, J.A. (LKEB)
J.A.Schaap at lumc.nl
Mon Sep 2 05:19:49 EDT 2002
I'm looking into parallelizing my vtk based programs.
Below you can find a very simple example of one source that is used by two parallel pieces of pipeline, that generate two actors, which are displayed in one renderer. Very simple isn't it?
What I would like to do is to execute the pieces denoted as pipe1 and pipe2 in two seperate threads.
I have looked at the documentation of vtkMultiProcessController, vtkInputPort, vtkOutputPort and at the examples, but I still can't figure out how to do this.
Could anybody modify my example below so that the two pipe's run in two seperate threads?
//Begin of example code
//setup renderer, renderwindow and renderwindowinteractor
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderer *ren = vtkRenderer::New();
//end of setup
vtkImageEllipsoidSource *ies = vtkImageEllipsoidSource::New();
ies->SetWholeExtent(0, 63, 0, 63, 0, 63);
ies->SetRadius(32, 32, 32);
ies->SetCenter(0, 32, 32);
//begin of pipe 1
vtkImageGaussianSmooth *igs = vtkImageGaussianSmooth::New();
vtkContourFilter *cf1 = vtkContourFilter::New();
vtkPolyDataMapper *pdMapper1 = vtkPolyDataMapper::New();
vtkActor *actor1 = vtkActor::New();
actor1->GetProperty()->SetColor(1, 0, 0);
//end of pipe 1
//begin of pipe 2
vtkImageGradientMagnitude *igm = vtkImageGradientMagnitude::New();
vtkImageGaussianSmooth *igs2 = vtkImageGaussianSmooth::New();
vtkContourFilter *cf2 = vtkContourFilter::New();
vtkPolyDataMapper *pdMapper2 = vtkPolyDataMapper::New();
vtkActor *actor2 = vtkActor::New();
actor2->GetProperty()->SetColor(0, 1, 0);
//end of pipe 2
//cleanup after interaction has ended
More information about the vtkusers