[Insight-users] Bresenham Line Iterator

Miller, James V (Research) millerjv at crd.ge.com
Mon Jun 6 11:50:10 EDT 2005


Benjamin, 

This sound great!

Unfortunately, your tar file was stripped off the email. Could you send it again? If you add a .txt as an 
extension, it might slip through the filter that is stripping it off.

FYI, I checked in a few changes to the LineIterator this morning.  I wanted the iterator to vist both endpoints
on the line.  So if you specify the start and end index as the same, it will visit a single pixel.  To do this, 
I renamed m_EndIndex to m_LastIndex to be the endpoint of line specified by the user.  Internally, I calculate
a new m_EndIndex "would be" one pixel past the end of the line.  IsAtEnd() is supposed to report true if the 
iterator is one pixel past the end of the section it is iterating.  Determining m_EndIndex is tricky because
one would have to account for all the pixel overflow to determine how many components of the index change. So
I only set the m_MainDirection component of the m_EndIndex to be appropriate and only check that component
when determining IsAtEnd().

Jim



-----Original Message-----
From: Benjamin King [mailto:king.benjamin at mh-hannover.de]
Sent: Monday, June 06, 2005 9:26 AM
To: Miller, James V (Research); ITK
Subject: Re: [Insight-users] Bresenham Line Iterator


Hi Jim,

you did it! You successfully tricked me into writing a polygon scan conversion 
iterator for ITK. It iterates over the pixels inside or on the border of 
complex self intersecting 2D-polygons. This is somehow different from the 
line iterator and was more difficult to get correct.

I hope it's resonably fast as well.

It's not quite ITKish though, but pretty close.

Please check the code and the included example programs. If you find a bug or 
see a lack of documentation, please contact me, otherwise feel free to add 
the code to ITK.

> Thanks Benjamin,
>
> For scan conversion, I am mostly interested scan converting (filling) a 2D
> polygon parallel to one of the imaging axes. 2D polygon in a 2D plane.  A
> 2D polygon on a z=5 plane of a 3D volume. A 2D polygon on a x=5 plane of a
> 3D volume, etc.
>
> So the polygon would not have to be arbitrarily oriented but it would be
> nice if it could be parallel to any of the imaging axes.
>
> Any less scared?
>
> Jim

-- 
Benjamin King
Experimentelle Radiologie
Medizinische Hochschule Hannover
Tel.: +49  511  532-2663


More information about the Insight-users mailing list