[vtkusers] Solid Voxelization with VTK

Berti Krüger berti_krueger at hotmail.com
Sat Sep 29 04:54:50 EDT 2018


Hi David,


thanks for the infos about the vtkPolyDataToImageStencil filter threaded approach.


Is there some way with the available vtk filters to rasterize the polygons themselves instead of rasterizing the volume enclosed by the polygons?


I know, i could in some way misuse the vtk renderer to do this by rendering the mesh without any shading, only in ambient, completely white with orthogonal projection etc. in a black render window, sized to the voxel resolution, then read the resulting screen pixels with the vtkWindowToImage Filter, fill the vtkImageData where i have white pixels, change the clipping planes to the next slice, draw the mesh again, read again ... and do that slice by slice for the depth part of the voxel resolution:


[cid:4ffb8812-3732-4885-bb29-4da9ff0b3467]


But are the available vtk filters able in some way to rasterize the polygons themselves ?


Or could it be done with some kind of signed distance field filter (i don't know if there is something in vtk)?


Thanks again.


Cheers,

Berti

________________________________
Von: David Gobbi <david.gobbi at gmail.com>
Gesendet: Samstag, 29. September 2018 03:44
An: Berti Krüger
Cc: VTK Users; Csaba Pinter
Betreff: Re: [vtkusers] Solid Voxelization with VTK

Hi Berti,

It's nice to see that the orientation voting gives such a clean result.  To get a result without gaps it would be necessary to take a completely different approach to the rasterization: rasterize the polygons themselves, instead of rasterizing the volume enclosed by the polygons.

Neither of the filters is parallel.  I designed them both so that they could be parallel, but I never wrote the threading code because they already worked fast enough for my application.

For instance, vtkPolyDataToImageStencil has this method:

    void vtkPolyDataToImageStencil::ThreadedExecute(
      vtkImageStencilData *data,
      int extent[6],
      int threadId)

The vtkImageStencilData object is made so that it can be written and read in a thread-safe manner, so in order to multithread this filter, one would just have to subdivide the extent along Z and then write a threaded "For()" loop, e.g. with vtkSMPTools.h.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180929/c2b4646d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: teapot_bw.png
Type: image/png
Size: 6802 bytes
Desc: teapot_bw.png
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180929/c2b4646d/attachment.png>


More information about the vtkusers mailing list