[vtkusers] marching cubes

Erik Vidholm erik at cb.uu.se
Sat Sep 11 06:12:49 EDT 2004


Hi!

I have a 3D structured points data set (unsigned_char) which is a volume
image consisting of six
segmented objects labeled from 1 to 6. The background is 0. I want to use
vtkImageMarchingCubes to view these regions, so I do like this:

(python)
ren = vtk.vtkRenderer()

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)

reader = vtk.vtkStructuredPointsReader()
reader.SetFileName("regions.vtk")

iso = vtk.vtkImageMarchingCubes()
iso.SetInput( reader.GetOutput() )
iso.SetValue(0,X) # X = 1..6

mapper = vtk.vtkPolyDataMapper()
mapper.SetInput( iso.GetOutput() )
mapper.SetColorModeToMapScalars()
mapper.SetScalarRange(1,6)
actor = vtk.vtkActor()
actor.SetMapper( mapper )

ren.AddActor( actor )

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow( renWin )

renWin.Render()
iren.Initialize()
iren.Start()

The problem is that the isosurfaces that are extracted doesn't match with
the SetValue calls.
If I want to view region nr 3 I call SetValue(0,3), but then regions labeled
3, 4, and 5 are shown! What's wrong?
I am sure that the data file is correct.

/ Erik




More information about the vtkusers mailing list