[Insight-developers] The quest for a fast polygon set to binary image filter.
Arnaud GELAS
arnaud_gelas at hms.harvard.edu
Thu Aug 6 17:28:33 EDT 2009
Hi Kent,
You may be interested by these files from vtkinria3d.
Arnaud
On 08/06/2009 04:01 PM, kent williams 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkFillImageWithPolyData.cxx
Type: text/x-c++src
Size: 13955 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090806/16e57d84/attachment.cxx>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkFillImageWithPolyData.h
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090806/16e57d84/attachment.asc>
More information about the Insight-developers
mailing list