<div dir="ltr"><div>There is a newer class called vtkTexturedActor2D. To use this class you would take the output from your reader and place it in a vtkTexture. Then you would set the texture on vtkTexturedActor2D.</div>
<div> </div>
<div><a href="http://www.vtk.org/doc/nightly/html/classvtkTexturedActor2D.html">http://www.vtk.org/doc/nightly/html/classvtkTexturedActor2D.html</a></div>
<div><br><br> </div>
<div class="gmail_quote">On Fri, Oct 3, 2008 at 6:15 AM, Miguel Angel Rodriguez Florido <span dir="ltr"><<a href="mailto:marf@itccanarias.org">marf@itccanarias.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"> Please, look at:<br><br><a href="http://www.vtk.org/doc/nightly/html/classvtkActor2D.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkActor2D.html</a>
<div>
<div></div>
<div class="Wj3C7c"><br><br>Elvis Dowson wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Sorry,<br> I made it work using vtkImageActor but it doesn't work with vtkActor2D.<br><br>Here is the code that works using vtkImageActor (This displays the image in 3D, but I want to use vtkActor2D but that doesnt seem to work)<br>
<br>*Working code*<br><br>// Declare object instance variables<br>vtkJPEGReader* imageReader;<br>vtkImageMapper* imageMapper;<br>vtkImageActor* mapActor;<br><br><br>// Initialize objects<br>imageReader = NULL;<br>imageMapper = NULL;<br>
mapActor = NULL;<br><br><br>// Read 2D image file<br>imageReader = vtkJPEGReader::New();<br>imageReader->SetFileName("/Users/elvis/Image/sample.jpg");<br>imageReader->Update();<br><br><br>// Map 2D image file<br>
imageMapper = vtkImageMapper::New();<br>imageMapper->SetInput(imageReader->GetOutput());<br><br><br>// Actor in scene<br>mapActor = vtkImageActor::New();<br>mapActor->SetInput(imageMapper->GetInput());<br><br>
<br>// Add Actor to renderer<br>ren->AddActor(mapActor);<br><br>*Code that doesn't display the image*<br><br>Here is the attempt at using vtkActor2D but it doesnt work. Could some one please tell me how I can get this to work?<br>
<br><br>// Declare object instance variables<br>vtkJPEGReader* imageReader;<br>vtkImageMapper* imageMapper;<br>vtkActor2D* mapActor;<br><br><br>// Initialize objects<br>imageReader = NULL;<br>imageMapper = NULL;<br>mapActor = NULL;<br>
<br>// Read 2D image file<br>imageReader = vtkJPEGReader::New();<br>imageReader->SetFileName("/Users/elvis/Image/sample.jpg");<br>imageReader->Update();<br><br>// Map 2D image file<br>imageMapper = vtkImageMapper::New();<br>
imageMapper->SetInput(imageReader->GetOutput());<br><br>// Actor in scene<br>mapActor = vtkActor2D::New();<br>mapActor->SetMapper(imageMapper);<br><br>// Add Actor to renderer<br>ren->AddActor(mapActor);<br><br>
<br>Best regards,<br><br>Elvis Dowson<br><br>On Oct 3, 2008, at 1:43 PM, Elvis Dowson wrote:<br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br> I found out the reason why, I had to explicitly specify the full path to the image file name and it worked.<br>
<br>imageReader->SetFileName("/Users/elvis/Image/sample.jpg");<br>imageReader->Update();<br><br>Best regards,<br><br>Elvis Dowson<br><br><br></blockquote><br></blockquote><br><br><br></div></div>
<div>
<div></div>
<div class="Wj3C7c">-- <br>Miguel Angel Rodríguez Florido<br>Departamento de Ingeniería del Software<br>División de Investigación y Desarrollo Tecnológico<br>INSTITUTO TECNOLOGICO DE CANARIAS, S.A. - GOBIERNO DE CANARIAS<br>
URL: <a href="http://www.itccanarias.org/" target="_blank">www.itccanarias.org</a> Tlfno: +34 928 727548, Fax: +34 928 727517<br><br>--------------------------------------------------------------------------<br>AVISO LEGAL:<br>
Este mensaje y los ficheros adjuntos si los hubiere, se dirigen exclusivamente a su destinatario y puede contener información privilegiada o confidencial. La transmisión errónea del presente mensaje en ningún momento supone renuncia a su confidencialidad. Si no es vd. el destinatario indicado, queda notificado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.<br>
<br>LEGAL WARNING:<br>This message and the files attached if there were any, are intended exclusively for its addressee and may contain information that is CONFIDENTIAL and protected by professional privilege. A wrong transmission to this message don't suppose we relinquished to It's confidential. If you are not the intended recipient you are hereby notified that any dissemination, copy or disclosure of this communication is strictly prohibited by law. If this message has been received in error, please immediately notify us via e-mail and delete it.<br>
<br><br><br><br></div></div><br>_______________________________________________<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" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br></blockquote></div><br></div>