[Insight-users] How to draw a curve or a straight line into an image ??

Dženan Zukić dzenanz at gmail.com
Fri Oct 12 06:22:18 EDT 2012


well, approximately like this:

   - clear image (set all pixels to zero)
   - for x=0 to image.size(0)
   - y=m*x+c
   - if y>=image.size(0) OR y<0 continue;
   - else image.setpixel(x,y,1)
   - next x

For parabola, you need to explicitly solve it for y to use above approach,
or solve for x and iterate over y and calculate x.
This approach doesn't do anti-aliasing, of course. If you need
anti-aliasing, you can use Xiaolin Wu's
algorithm<http://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm>
.

On Fri, Oct 12, 2012 at 10:57 AM, Raviteja, Allaparthi <
Allaparthi.Raviteja at philips.com> wrote:

>  Hi,
>
>
>
> I have been stuck with the problem of drawing a parabola of the form
>  ((y-k)*(y-k))=4a(x-h) and drawing a line of the form y=mx+c  into an image
> in ITK  .Could someone please help me out .
>
>
>
> Regards,
>
> Ravi Teja.
>
>
>
>
>
>
>
> ------------------------------
> The information contained in this message may be confidential and legally
> protected under applicable law. The message is intended solely for the
> addressee(s). If you are not the intended recipient, you are hereby
> notified that any use, forwarding, dissemination, or reproduction of this
> message is strictly prohibited and may be unlawful. If you are not the
> intended recipient, please contact the sender by return e-mail and destroy
> all copies of the original message.
>
> _____________________________________
> 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.php
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121012/8f22ad8f/attachment.htm>


More information about the Insight-users mailing list