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

Karthik Krishnan karthik.krishnan at kitware.com
Fri Aug 7 03:19:08 EDT 2009


I think that works only for complex polygons, although there is no
documentation to that effect.

I took a look at the code; its comparing the angle (direction of the cross
product) between two consecutive points.


On Thu, Aug 6, 2009 at 5:28 PM, Arnaud GELAS
<arnaud_gelas at hms.harvard.edu>wrote:

> 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
>>
>>
>
>
> _______________________________________________
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090807/17499943/attachment.htm>


More information about the Insight-developers mailing list