[Insight-developers] Questions about writing Polygon list to mask filter to Mask filter

kent williams norman-k-williams at uiowa.edu
Tue Aug 11 13:14:35 EDT 2009


I implemented (in an ad hoc, non-ITK manner) using a scan-line algorithm to
generate a binary image from a set of planar polygons.  I based the code on
Michael Abrash's code from his book "Graphics Programming Black Book", as
suggested by Dan Mueller.

I don't think there's any licensing issues with this code (the book is
on-line as a PDF file, and the source code has no licensing information),
but I will try and contact Mr. Abrash and ask him about it.

So I now know how to use the algorithm in a filter, and it is many times
faster than testing each point to see if it is within a polygon.  But I have
some questions about 'ITK-izing' it.

1. The existing polyline filters (itk::PolylineMask2DImageFilter,
itk::PolylineMaskImageFilter) are templated over the PolyLine type. The
tests for those filters use ParametricPaths.

What my code works on is a set of polygons, that are all congruent with a
slice in the 3D image.  So what class would be appropriate for input?  Is
there even a standard ITK way to have arbitary-length lists of input
objects?

Would it be better to have an 'AddPolygon' or 'AddPolyLine' method and add
instances of the Polyline type?

2. The polygons in my current code are all constrained to be embedded in an
image slice, though not necessarily the plane of the two fastest moving
indices -- I handle the index permutation. Do I just document this
limitation, or try and enforce it?




More information about the Insight-developers mailing list