[vtkusers] need help in vtkMarchingCubes Python!!

Christopher Mullins christopher.mullins at kitware.com
Sat Jun 15 03:04:16 EDT 2013


Check out this example [1] in C++.  Or maybe [2] or [3] from the Python
examples.

[1]
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Medical/GenerateModelsFromLabels
[2] http://www.vtk.org/Wiki/VTK/Examples/Python/MeshLabelImage
[3] http://www.vtk.org/Wiki/VTK/Examples/Python/MeshLabelImageColor


On Sat, Jun 15, 2013 at 3:46 AM, dalhotha <dhothali at hotmail.com> wrote:

> yah I did as follow , its not working either :( , an empty render window.
> any
> help plzz
>
> import vtk
>
> input='test.vtk'
>
> ## read the file
> reader = vtk.vtkPolyDataReader()
> reader.SetFileName(input)
> reader.Update()
>
>
>
> ## surface generation
> contour = vtk.vtkMarchingCubes() #for label images
> contour.SetInput(reader.GetOutput())
> contour.Update()
>
> ## mapper
> mapper = vtk.vtkPolyDataMapper()
> mapper.SetInput(contour.GetOutput())
> mapper.Update()
>
>
> ## 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-tp5721398p5721420.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
>



-- 
Christopher Mullins
R&D Engineer
Kitware Inc.,
919.869.8871
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130615/ce8a15b9/attachment.htm>


More information about the vtkusers mailing list