[vtkusers] need help in vtkMarchingCubes Python!!

dalhotha dhothali at hotmail.com
Fri Jun 14 04:30:54 EDT 2013


hello,

i'm a novice in vtk.

I'm trying to do volume rendering.
i segmented an  object using Itk-snap. I saved it as vtk data file. i found
that all what i have in the file  is POINTS 26829 float , there is no cells.
ive used vtkMarchingCubes as follow to get the surface but nothing appear.
any help please..



import vtk

input='test.vtk'
 
## read the file
reader = vtk.vtkPolyDataReader()
reader.SetFileName(input)
reader.Update()



## surface generation
contour = vtk.vtkMarchingCubes() 
contour.SetInput(reader.GetOutput())

## mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(contour.GetOutput())

## the actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)

## renderer and render window 
ren = vtk.vtkRenderer()
ren.SetBackground(1, 0, 1)
## add the actors to the renderer
ren.AddActor(actor)

renWin = vtk.vtkRenderWindow()
renWin.SetSize(512, 512)
renWin.AddRenderer(ren)

## render window interactor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)


## initialize and start the interactor
iren.Initialize()

## render
renWin.Render()
iren.Start()




--
View this message in context: http://vtk.1045678.n5.nabble.com/need-help-in-vtkMarchingCubes-Python-tp5721398.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list