[vtkusers] cleaning up a surface rendering

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Mar 25 11:05:02 EST 2004


I am using marching cubes to do some surface rendering of CT data.  I
would like to "clean up" the data by using a picker to remove some of
the iso surfaces from the results.  Basically, I have a number of
disjoint surfaces and I want to remove some of them.

My marching cube code is standard issue

    iso = vtk.vtkMarchingCubes()
    iso.SetInput(reader.GetOutput())
    iso.SetValue(0,1200)

    isoMapper = vtk.vtkPolyDataMapper()
    isoMapper.SetInput(iso.GetOutput())
    isoMapper.ScalarVisibilityOff()

    isoActor = vtk.vtkActor()
    isoActor.SetMapper(isoMapper)
    isoActor.GetProperty().SetColor(0.9804,0.9216,0.8431)

    ren.AddActor(isoActor)
    ren.SetBackground(0.2,0.3,0.4)

I have worked with a variety of vtk pickers before and have some
familiarity with them.  But I don't know how to take the polygon
output of the marching cube algorithm and segregate it into separate
contiguous chunks to feed to the picker, nor how to remove these
pieces once picked.

Should I work with the polyData and vtkCellPicker?  Something along
the lines of

    picker = vtk.vtkCellPicker()
    polyData = iso.GetOutput()
    # pick, get the cell id
    polyData.DeleteCell (cellId)

I'm not sure how the cell data is arranged in the polyData, and if
this approach would get an entire contiguous chunk or a single
face, or if it is at all viable.

Pointers to docs, relevant classes, examples, or otherwise
appreciated!

Thanks,
John Hunter




More information about the vtkusers mailing list