[vtkusers] (no subject)

debbie larson debbielarson_9 at hotmail.com
Tue Jun 27 00:59:24 EDT 2006


Hi,

I am new to vtk. I am trying to read a volume, produce a marching cubes on 
it and then visualize the result. I tried the following code but it does not 
show the volume, just a slice. What is wrong?
Thanks

deb
-----------------------------------------------------------------------------------------------
  vtkImageMarchingCubes *imageMarchingCubes = vtkImageMarchingCubes::New();
  imageMarchingCubes->SetInput( inputReader2->GetOutput() );
  imageMarchingCubes->SetValue( 0, isovalue );
  imageMarchingCubes->ComputeScalarsOff();
  imageMarchingCubes->ComputeNormalsOff();
  imageMarchingCubes->ComputeGradientsOff();
  imageMarchingCubes->Update();
  vtkPolyDataWriter *polyDataWriter = vtkPolyDataWriter::New();
  polyDataWriter->SetInput( imageMarchingCubes->GetOutput() );
  polyDataWriter->SetFileName( vtkoutputFileName );
  polyDataWriter->SetFileTypeToBinary();
  polyDataWriter->Write();
vtkPolyDataReader *inputReader3 = vtkPolyDataReader::New();
  inputReader3->SetFileName( vtkoutputFileName );
  inputReader3->Update();

vtkPolyDataMapper * marchMapper=vtkPolyDataMapper::New();
  marchMapper->SetInput(inputReader3->GetOutput());

  vtkActor *marchActor=vtkActor::New();
  marchActor->SetMapper(marchMapper);

  vtkRenderer * ren1=vtkRenderer::New();
  vtkRenderWindow * renWin=vtkRenderWindow::New();
  renWin->AddRenderer(ren1);
  vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);

  ren1->AddActor(marchActor);
  renWin->SetSize(200, 200);

  renWin->Render();
  iren->Start();

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/




More information about the vtkusers mailing list