[Paraview] [paraview] Texture Map To Plane
Brian Panneton
brian.panneton at gmail.com
Thu Apr 7 10:05:50 EDT 2011
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?
Here is what I have:
[code]
vtkSmartPointer<vtkImageReader2Factory> imageFactory =
vtkSmartPointer<vtkImageReader2Factory>::New();
vtkSmartPointer<vtkImageReader2> reader =
imageFactory->CreateImageReader2(filename);
reader->SetFileName(filename);
reader->Update();
vtkSmartPointer<vtkPlaneSource> plane =
vtkSmartPointer<vtkPlaneSource>::New();
plane->SetCenter( e, s, 0.0);
plane->SetNormal(0.0, 0.0, 1.0);
plane->SetOrigin( e, s, 0);
plane->SetPoint1( e, n, 0);
plane->SetPoint2( w, s, 0);
plane->SetXResolution(1);
plane->SetYResolution(1);
plane->Update();
vtkSmartPointer<vtkTextureMapToPlane> texturePlane =
vtkSmartPointer<vtkTextureMapToPlane>::New();
texturePlane->SetAutomaticPlaneGeneration(false);
texturePlane->SetOrigin(w, s, 0);
texturePlane->SetPoint1(e, s, 0);
texturePlane->SetPoint2(w, n, 0);
texturePlane->SetInput(plane->GetOutput());
texturePlane->Update();
mbds->SetBlock(1, texturePlane->GetOutput());
[/code]
On Wed, Apr 6, 2011 at 11:39 AM, Brian Panneton <brian.panneton at gmail.com>wrote:
> 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:
>
> [code]
> vtkSmartPointer<vtkImageReader2Factory> imageFactory =
> vtkSmartPointer<vtkImageReader2Factory>::New();
> vtkSmartPointer<vtkImageReader2> reader =
> imageFactory->CreateImageReader2(filename);
> reader->SetFileName(filename);
> reader->Update();
>
> vtkSmartPointer<vtkTextureMapToPlane> texturePlane =
> vtkSmartPointer<vtkTextureMapToPlane>::New();
> texturePlane->SetInput(reader->GetOutput());
> texturePlane->SetOrigin(0,0,0);
> texturePlane->SetPoint1(1, 0, 0);
> texturePlane->SetPoint2(0, 1, 0);
>
> mb->SetBlock(1, texturePlane->GetOutput());
> [\code]
>
> 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.
>
> How can I get the image to show up?
>
> Thanks,
> Brian Panneton
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110407/9db1889c/attachment.htm>
More information about the ParaView
mailing list