[vtkusers] vtkDICOMImageReader -> vtkCutter -> vtkMarchingCubes

Jinyoung Hwang hwangjinyoung at gmail.com
Wed Dec 23 22:50:04 EST 2009


Hello,

I made an example you want, but it may not be.
 If not, repost again, then other will help you.

Jinyoung

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 // data load
 vtkSmartPointer<vtkStructuredPointsReader> reader =
vtkSmartPointer<vtkStructuredPointsReader>::New();
 reader->SetFileName("test.vtk");
 reader->Update();
 // MC is used to display in 3D
 vtkSmartPointer<vtkMarchingCubes> cubes =
vtkSmartPointer<vtkMarchingCubes>::New();
 cubes->SetInputConnection(reader->GetOutputPort());
 cubes->ComputeNormalsOn();
 cubes->ComputeGradientsOn();
 cubes->SetValue(0, 20);
 cubes->Update();
// create a plane, and specify it
 vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
 plane->SetOrigin(100,0,0);
 plane->SetNormal(1,0,0);
// create a cutter
 vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();
 cutter->SetInputConnection(cubes->GetOutputPort());
 cutter->SetCutFunction(plane);
 cutter->GenerateCutScalarsOn();
 cutter->SetValue(0, 0.5);
 // create a mapper
 vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
 mapper->SetInputConnection(cutter->GetOutputPort());
 mapper->ScalarVisibilityOn();
 mapper->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091224/e0252ccf/attachment.htm>


More information about the vtkusers mailing list