[Insight-users] Following a straight line through an image

Luis Ibanez luis.ibanez at kitware.com
Sun May 2 17:31:26 EDT 2010


Hi Dirk,

You may want to try the class : itk::LineIterator.

http://www.itk.org/Doxygen/html/classitk_1_1LineIterator.html

This class walks a Bresenham line through an ND image.

You can get the index at every iteration by calling the method

             GetIndex();

You will need to compute the starting and ending indexes of
the line. If you have physical coordinates for the starting and
ending points of the line, then you can convert them to indexes
by using the image method:

  image->TransformPhysicalPointToIndex( point, index );



     Regards,


          Luis


-------------------------------------------------------------------------
On Fri, Apr 30, 2010 at 4:15 AM, Dirk Boye <body at nabla.org> wrote:
> Dear list,
>
> I'd like to follow a straight line through an image.
> The starting point of the line is outside the image, the end point is
> somewhere inside.
> What I need to know are the pixel indeces the line passed
> and also the length of the line in each pixel. (this is very important)
>
> The image will have anisotropic spacing (like 0.7 x 0.7 x 4)
>
> Can i do this with itkPolyLineParametricPath?
> I couldn't find any example code for that.
>
>
> Thanks,
> Dirk
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.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-users
>


More information about the Insight-users mailing list