[vtkusers] Apply Texture in PolyData from CT
Paul Jhin
paul.jhin1 at gmail.com
Wed Dec 9 11:37:51 EST 2009
Hi,
I have an STL file of a face, generated by CT, I have a picture of the
patient, I would like to use this picture as a texture.
I have the code below but does not display anything. what is wrong can?
What can is wrong, how can I position the texture correctly in volume?
Sorry for English.
Regards,
Paul Jhin
Code:
import vtk
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
reader = vtk.vtkSTLReader()
reader.SetFileName("c:\\stl_patient.stl")
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(reader.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
img_file = "c:\\patient_photo.bmp"
img_r = vtk.vtkBMPReader()
img_r.SetFileName(img_file)
t = vtk.vtkTexture()
t.SetInputConnection(img_r.GetOutputPort())
t.InterpolateOn()
outlineActor.SetTexture(t)
ren1.AddActor(outlineActor)
ren1.SetBackground(1, 1, 1)
renWin.SetSize(400, 400)
renWin.Render()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091209/4c0028af/attachment.htm>
More information about the vtkusers
mailing list