[vtkusers] How to smooth a vtk faceted volume with no normals ?

Marie Bonhoure mariebonhoure at hotmail.com
Thu Mar 2 12:14:28 EST 2006


Hi,

I've got a polydata volume which appearently doesn't include any normals. 
Therefore, it is rendered faceted in my view.

I 've tried the following code to render it in a more "beautiful" way:

import vtk

// I get a vtkPolyData from a pipeline
plexus = 
MySoft.GetMyPipeLine().GetMyDataSetList().getElementAt(0).getVtkObject()

// Try to compute normals
normals = vtk.vtkPolyDataNormals()
normals.SetInput(plexus)
normals.SetFeatureAngle(60.0)
normals.ComputePointNormalsOn()
normals.FlipNormalsOff()
normals.Update()

// Try to smooth my volume
smoother = vtk.vtkPolyDataSmoother()
smoother.SetInput(normals.GetOutput())
smoother.SetNumberOfIterations(50)

plexus_map = vtk.vtkPolyDataMapper()
plexus_map.SetInput(smoother.GetOutput())

plexus_act = vtk.vtkActor()
plexus_act.SetMapper(plexus_map)
plexus_act.GetProperty().SetColor(0.2, 0.1, 0.5)

// To display my data
MySoft.GetMyPipeline().addActor(plexus_act, "plexus_act")

"plexus_act" is rendered exactly the same way as "plexus". What is going 
wrong with my code ?

Thanks in advance :-)


Marie Bonhoure
Ingénieur biomédical
Service de Neurochirurgie
HIA du Val de Grace
Tél bureau: 00 33 (0)1 40 51 4355
Tél secrétariat: 00 33 (0)1 40 51 4306
Fax: 00 33 (0)1 40 51 4332





More information about the vtkusers mailing list