[vtkusers] Proper use of vtkPolyDataToImageStencil and friends

Simon Wilson lists at xeosdd.net
Sun Sep 25 03:45:59 EDT 2011


Hi all,

I'm working with the PolyDataContourToImageData example code in my program to generate a binary image from a cut through a mesh (in my case, of a section of a trachea, with the ends "capped" to make a closed surface). 

I've played fairly extensively with the example code on its own, in order to allow me to take cuts along planes that aren't orthogonal. I do this by rotating the cut surface so that the plane's normal lies points in the +Z direction, and then following the remainder of the example code, which gives the desired result. But in my project, the same code generates just a black image, as shown at http://gwazi.com/images/stencil1.png, for the given extruded mesh.

I note that there's been changes to the vtkPolyDataToImageStencil class as of VTK 5.8. I've also experimented with this form, and get the following result: http://gwazi.com/images/stencil2.png (with the extrusion aded to show the region). I'm not certain what's happening here, but it looks like there's some strange triangulation occurring (for the white areas outside the extrusion area), and what looks to be just half the polygons inside the stencil are marked as white. 

Does anybody have any suggestions for things I should check? What are the requirements for vtkPolyDataToImageStencil and friends to generate a stencil image correctly? 

Thanks for your help!

Simon Wilson





More information about the vtkusers mailing list