I am able to somewhat get what I need. I need to first create the plane using vtkPlaneSource and then apply the vtkTextureMapToPlane. However, this will only show up as a blank plane in the 3D view. I can manually apply the image, but I would prefer to have it load automatically. Is there something that I am missing?<br>
<br>Here is what I have: <br><br>[code]<br>
vtkSmartPointer<vtkImageReader2Factory> imageFactory =<br> vtkSmartPointer<vtkImageReader2Factory>::New();<br> vtkSmartPointer<vtkImageReader2> reader =<br> imageFactory->CreateImageReader2(filename);<br>
reader->SetFileName(filename);<br> reader->Update();<br><br>vtkSmartPointer<vtkPlaneSource> plane =<br> vtkSmartPointer<vtkPlaneSource>::New();<br>plane->SetCenter( e, s, 0.0);<br>plane->SetNormal(0.0, 0.0, 1.0);<br>
plane->SetOrigin( e, s, 0);<br>plane->SetPoint1( e, n, 0);<br>plane->SetPoint2( w, s, 0);<br>plane->SetXResolution(1);<br>plane->SetYResolution(1);<br>plane->Update();<br><br>vtkSmartPointer<vtkTextureMapToPlane> texturePlane =<br>
vtkSmartPointer<vtkTextureMapToPlane>::New();<br>texturePlane->SetAutomaticPlaneGeneration(false);<br>texturePlane->SetOrigin(w, s, 0);<br>texturePlane->SetPoint1(e, s, 0);<br>texturePlane->SetPoint2(w, n, 0);<br>
texturePlane->SetInput(plane->GetOutput());<br>texturePlane->Update();<br><br>mbds->SetBlock(1, texturePlane->GetOutput());<br>[/code]<br><br><br><div class="gmail_quote">On Wed, Apr 6, 2011 at 11:39 AM, Brian Panneton <span dir="ltr"><<a href="mailto:brian.panneton@gmail.com">brian.panneton@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I have a reader which outputs a Multi-block Dataset containing a polygonal mesh of vertices in one block. I am trying to add another block to contain a 2D image on a plane. I am reading in the image as such:<br>
<br>[code]<br>
vtkSmartPointer<vtkImageReader2Factory> imageFactory =<br> vtkSmartPointer<vtkImageReader2Factory>::New();<br> vtkSmartPointer<vtkImageReader2> reader =<br> imageFactory->CreateImageReader2(filename);<br>
reader->SetFileName(filename);<br> reader->Update();<br><br> vtkSmartPointer<vtkTextureMapToPlane> texturePlane =<br> vtkSmartPointer<vtkTextureMapToPlane>::New();<br> texturePlane->SetInput(reader->GetOutput());<br>
texturePlane->SetOrigin(0,0,0);<br> texturePlane->SetPoint1(1, 0, 0);<br> texturePlane->SetPoint2(0, 1, 0);<br><br> mb->SetBlock(1, texturePlane->GetOutput());<br>[\code]<br><br>Under the Information Tab in the Object Inspector, I see the Image (Uniform Rectilinear Grid) under the Multi-block DataSet. It has no cells or points. The image does not show up in the 3d view either.<br>
<br>How can I get the image to show up?<br><br>Thanks,<br><font color="#888888">Brian Panneton<br>
</font></blockquote></div><br>