[vtkusers] Rendering an image with Kitware VTK

Entwicklung Kornicki kornicki.entwicklung at chello.at
Wed Dec 13 04:18:45 EST 2017


I have a problem inserting an image into an existing assembly using 
ActiViz Kitware VTK 5.8 (for C#).

This is how I defined the actor:

     private vtkImageActor psi_imgActor;
     psi_imgActor = vtkImageActor.New();
     Psi_DrawTable_Image();

In the method Psi_DrawTable_Image, I created the image and stored it as 
a file. I checked the file, it is okay and looks as it should, so that 
is not the problem.

Then I created a vtkBMPReader object and set the input of the actor:

     vtkBMPReader bmpReader = vtkBMPReader.New();
     bmpReader.SetFileName(filename);
     bmpReader.Update();
     psi_imgActor.SetInput(bmpReader.GetOutput());
     psi_imgActor.InterpolateOff();
     psi_imgActor.SetPosition(250, 200, 1000);

Finally, I added the actor to the assembly, where assembly3D is a 
variable of type vtkAssembly - I added everything that is visible to 
this assembly, except the 2D stuff (such as texts).

     if (psi_imgActor != null) assembly3D.AddPart(psi_imgActor);

Unfortunately, I do not get to see the image. What's wrong? Where's the 
mistake?

Thank you in advance.



More information about the vtkusers mailing list