[Insight-users] 'Marching squares' -- Need to go from 2D binary images <-> 2D 'meshes'

Zachary Pincus zpincus at stanford.edu
Thu Dec 1 18:02:52 EST 2005


> 1) The Bresenham line iterator is already in ITK.
>    It was contributed by Benjamin King on June 2005
>
>  http://www.itk.org/Insight/Doxygen/html/ 
> classitk_1_1LineConstIterator.html
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1LineIterator.html

Hmm, now that I think of it, what's needed here is something more  
like the PathIterator (since Paths can use continuous indices, but  
the LineIterator only takes normal itk::Index points for the line ends).

Fortunately, it seems that a PathIterator is available.

> 2) This iterator is used by the PolylineMask2DImageFilter
>    in order to rasterize Polylines into 2D binary mask images.
>
> http://www.itk.org/Insight/Doxygen/html/ 
> classitk_1_1PolylineMask2DImageFilter.html

Great -- I don't know how I missed this.

> 4) What we seem to be missing from your list of desired
>    functionalities is a filter for taking a 2D image mask and
>    extracting the contours in the form of a PolyLineParametricPath.
>
>    However, such filter can easily be written by modifying the
>    SimpleContourExtractorImageFilter
>
> http://www.itk.org/Insight/Doxygen/html/ 
> classitk_1_1SimpleContourExtractorImageFilter.html

I'm not fully convinced this will be easy - the tricky part would be  
reconstructing properly-connected poly-line(s) from the individual  
segments generated from a modified contour extractor filter. (Such  
modifications, I think, would basically make it into a "marching  
squares"
filter -- which really isn't hard to implement.) But I suspect there  
will be a not-too-hard way to connect the points properly.

How is point-connection done in the (harder) case of marching cubes?  
Just keeping a list of all the "open" edge points in a mesh to  
connect to?

One other issue is that PolyLines can't capture planar objects with  
'holes' -- you would get extract two PolyLines from a 'donut' shape.  
This really isn't an issue for me since my shapes don't have holes,  
but if I were to make a general contours-to-geometry filter for ITK  
(which I would like to do, if I'm making one for myself!) would this  
issue need to be addressed?

Zach


More information about the Insight-users mailing list