[vtkusers] placing two objects in the same scene

sebastien gillard sebastien_gd at yahoo.fr
Sun Jan 12 04:30:56 EST 2003


Hello
I want to place in a same renderWindow a slice and a
polyDataMapper.  These objects has been build from 2
files that contains data from the same brain
My code is like this:

vtkImageReader reader=vtkImageReader::New();
.....
reslice = vtkImageReslice::New ();
reslice->SetInput(reader->GetOutput());
reslice->SetResliceAxesDirectionCosines(v1x,v1y,v1z,v2x,v2y,v2z,v3x,v3y,v3z);
reslice->SetResliceAxesOrigin(ox,oy,oz);
reslice->InterpolateOn();
reslice->SetBackgroundLevel(0);
reslice->SetOutputDimensionality(2);
reslice->AutoCropOutputOn();
reslice->SetInterpolationModeToCubic();
vtkImageActor imageactor = vtkImageActor::New ();
imageactor->SetInput(reslice->GetOutput());
imageactor->InterpolateOn();

vtkPolyDataReader *polydatareader =
vtkPolyDataReader::New ();
latticeReader->SetFileName(filename);

vtkPolyDataMapper *mapper = vtkPolyDataMapper::New ()
;
mapper->SetInput(polydatareader->GetOutput());

vtkActor *actor = vtkActor::New ();
actor->SetMapper(mapper);

vtkRenderer ren= vtkRenderer::New ();
ren->SetBackground( 0.1, 0.2, 0.4 );
ren->AddActor(imageactor);
ren->AddActor(actor);
vtkRenderWindow renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
renWin->SetSize(600,600);
vtkRenderWindowInteractor iren =
vtkRenderWindowInteractor::New ();
iren->SetRenderWindow(renWin);
renWin->Render();
iren->Start();

My problem is that the relative position of the two
objects is not correct. Normally the slice must cross
the polydatamapper but it is not the case
Thank you far any help



___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com



More information about the vtkusers mailing list