[vtkusers] need help in vtkMarchingCubes Python!!

Shawn Waldon swaldon at cs.unc.edu
Fri Jun 14 17:43:05 EDT 2013


Have you tried calling Update() on the contour and the mapper after setting
their input?

Hope this helps,

Shawn


On Fri, Jun 14, 2013 at 4:30 AM, dalhotha <dhothali at hotmail.com> wrote:

> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130614/b1456e94/attachment.htm>


More information about the vtkusers mailing list