<html>
<body>
Yaqian,<br><br>
Please provide more information about what happens when you run this code
and what you expect to happen. Just saying "it doesn't work as
expected" is not enough of a description for someone to help with
your problem.<br><br>
- Amy<br><br>
At 09:46 AM 3/28/2005, Yaqian Fang wrote:<br>
<blockquote type=cite class=cite cite="">content-class:
urn:content-classes:message<br>
Content-Type: multipart/alternative;<br>
<x-tab> </x-tab>
boundary="----_=_NextPart_001_01C533A4.EA0F2A6A"<br><br>
<font face="Verdana" color="#000080">Hi,<br>
</font><br>
<font face="Verdana" color="#000080">My code for texture mapping MRI
heart model is as following. It cannot generate the textured heart
as I expected.</font> <font face="Verdana" color="#000080">Could
anyone please give me some idea on</font>
<font face="Verdana" color="#000080">how to fix it?<br>
</font><br>
<font face="Courier New, Courier">/* read a picture */<br>
</font><br>
<font face="Courier New, Courier">vtkPNMReader *pnmReader =
vtkPNMReader::New();<br>
</font><br>
<font face="Courier New, Courier">
pnmReader->SetFileName("C:/heart.ppm");<br>
</font><br>
<font face="Courier New, Courier">vtkTexture *aText =
vtkTexture::New();<br>
</font><br>
<font face="Courier New, Courier">pnmReader->Update();<br>
</font><br>
<font face="Courier New, Courier">
aText->SetInput(pnmReader->GetOutput());<br>
</font><br>
<font face="Courier New, Courier">aText->InterpolateOn();<br>
</font><br>
<font face="Courier New, Courier">/* mapping */<br>
</font><br>
<font face="Courier New, Courier">vtkDelaunay3D *del =
vtkDelaunay3D::New();<br>
</font><br>
<font face="Courier New, Courier">del->SetInput((vtkPointSet
*)reader->GetOutput());<br>
</font><br>
<font face="Courier New, Courier">del->SetTolerance(0.1);<br>
</font><br>
<font face="Courier New, Courier">vtkThresholdTextureCoords *tmapper =
vtkThresholdTextureCoords ::New();<br>
</font><br>
<font face="Courier New, Courier">
tmapper->SetInput(del->GetOutput());<br>
</font><br>
<font face="Courier New, Courier">vtkTransformTextureCoords *xform =
vtkTransformTextureCoords::New();<br>
</font><br>
<font face="Courier New, Courier">
xform->SetInput(tmapper->GetOutput());<br>
</font><br>
<font face="Courier New, Courier">vtkDataSetMapper *mapper =
vtkDataSetMapper::New();<br>
</font><br>
<font face="Courier New, Courier">mapper->SetInput((vtkImageData
*)xform->GetOutput());<br>
</font><br>
<font face="Courier New, Courier">vtkActor *triangulation =
vtkActor::New();<br>
</font><br>
<font face="Courier New, Courier">triangulation->SetMapper(mapper);<br>
</font><br>
<font face="Courier New, Courier">triangulation->SetTexture(aText);<br>
</font><br>
<font face="Courier New, Courier">/* rendering*/<br>
</font><br>
<font face="Courier New, Courier">ren1->AddActor(triangulation);<br>
</font><br>
<font face="Verdana" color="#000080">Thank you very much!!!<br>
</font><br>
<font face="Verdana" color="#000080">Regards,<br>
</font><br>
<font face="Verdana" color="#000080">Yaqian<br>
</font><br>
<font face="Verdana" color="#000080">
_______________________________________________<br>
</font><br>
<font face="Verdana" color="#000080">This is the private VTK discussion
list. <br>
</font><br>
<font face="Verdana" color="#000080">Please keep messages on-topic. Check
the FAQ at:
<a href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
</font><br>
<font face="Verdana" color="#000080">Follow this link to
subscribe/unsubscribe:<br>
</font><br>
<font face="Verdana" color="#000080">
<a href="http://www.vtk.org/mailman/listinfo/vtkusers">
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</font>_______________________________________________<br>
This is the private VTK discussion list. <br>
Please keep messages on-topic. Check the FAQ at:
<a href="http://www.vtk.org/Wiki/VTK_FAQ" eudora="autourl">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" eudora="autourl">
http://www.vtk.org/mailman/listinfo/vtkusers</a></blockquote></body>
</html>