[Insight-developers] The quest for a fast polygon set to binary image filter.

Sylvain Jaume sylvain at csail.mit.edu
Thu Aug 6 16:05:15 EDT 2009


Hi Kent,

Have you tried to render your polygons offline into a file?

Sylvain

On Thu, Aug 6, 2009 at 4:01 PM, kent
williams<norman-k-williams at uiowa.edu> wrote:
> Before I start on this has anyone else had a crack at this problem?
>
> I want to generate a mask image from as set of polygons (generated by
> BRAINSTracer).  Currently what I do is basically
>
> for each polygon
>  find bounds of polygon
>  for each voxel in bounds
>    if voxel's position is inside the polygon then
>      voxel = 255
>    else
>      voxel = 0
>    endif
>  endfor
> endfor
>
> As you can imagine, this is not super speedy, especially since my polygons
> are derived (by vtkContourRepresentation) from a set of spline control
> points, so each test for polygon membership has to contend with potentially
> hundreds of vertices.
>
> I've spent most of today googling and trying things out before getting
> really frustrated.  What I have is a set of polygons, each of which lies on
> a 2D slice, and I want to generate a mask volume where every point inside
> any of the polygon is inside the mask.
>
> The best starting point I've found is this code from Graphics Gems:
> http://tog.acm.org/resources/GraphicsGems/gems/ConcaveScan.c
>
> This is pretty easily parallelizable on the per-slice level.
>
> But adapting this code is non-trivial for a number of reasons.  So has
> anyone else attacked this?
>
> I know about PolylineMask2DImageFilter and PolylineMaskImageFilter, but the
> former only works for convex polygons, and I can't figure out what the
> latter would do forme.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list