[vtkusers] poly data -> image data

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Mar 31 13:56:12 EST 2003


I am writing some code to interactively identify things in 3D image
data, and am using the plane widgets to interact with the data.  I
have some observer windows that show the respective planes through the
data.  When I click on a point in the observer window, I add a poly
data object to the scene to mark the location visually.  I can easily
update the space that has the plane widgets by adding the appropriate
actor the renderer.  But I would also like the marker to show up in
the observer window.  My first approach is to create image data from
the poly data markers, and then perhaps combine that data with the 3D
image data (using vtkImageStencilData?) and go from there.

I am still stuck trying to create the image data from the scene.  As a
test case, I am just trying to create image data from a cylinder.  My
approach is

    cylinder = vtk.vtkCylinderSource()
    cylinder.SetRadius(5.0)
    cylinder.SetHeight(10.0)
    cylinder.SetResolution(80)
    cylinder.SetCenter(0,0,0)

    mapperCyl = vtk.vtkPolyDataMapper()
    mapperCyl.SetInput(cylinder.GetOutput())
    #mapperCyl.SetLookupTable(??)

    imageData = vtk.vtkImageData()
    imageData.ShallowCopy(mapperCyl.GetInputAsDataSet())

How should I set the lookup table?  Is ShallowCopy the right method
here to create the image data?  Is there a better way to use plane
widgets with a combination of 3D image data and poly data?

Thanks for any suggestions,
John Hunter



More information about the vtkusers mailing list