<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <link href="chrome://translator/skin/floatingPanel.css"
      type="text/css" rel="stylesheet">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      you have to allocate memory for your image data I guess. In my
      modification of your example I'm reading an existing image so I
      don't have to allocate memory. And I've changed
      itkLineConstIterator to the non-const iterator in order to modify
      the image data along the line.<br>
      <br>
      See also
      <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/ITK/Examples/Iterators/LineIterator">http://www.vtk.org/Wiki/ITK/Examples/Iterators/LineIterator</a>&nbsp; there
      you'll find an example for creating an image from scratch.<br>
      <br>
      Christina Ro&szlig;manith<br>
      --<br>
      <span
style="font-size:10pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"
        lang="EN-GB">Dept. of Neurology</span> <br>
      <span
style="font-size:10pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"
        lang="EN-GB">University Medical Center Mannheim<br>
        <br>
      </span><br>
      Am 08.10.2012 14:21, schrieb Raviteja, Allaparthi:<br>
    </div>
    <blockquote
cite="mid:4E2CCF5105F8F04B8F4C8C27EF66D089014E27F5@011-DB3MPN2-131.MGDPHG.emi.philips.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <style>
<!--
@font-face
        {font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
span.PlainTextChar
        {font-family:"Calibri","sans-serif"}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
        {}
-->
</style>
      <div class="WordSection1">
        <p class="MsoPlainText">Hi,</p>
        <p class="MsoPlainText">&nbsp;</p>
        <p class="MsoPlainText">I want to draw a line in to an image .</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; #include &lt;iostream&gt;</p>
        <p class="MsoPlainText">&gt; #include &#8220;itkImageFileWriter.h&#8221;</p>
        <p class="MsoPlainText">&gt; #include "itkLineConstIterator.h"</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; #include "itkImage.h"</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; int main(int argc, char *argv[])</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; {</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( argc &lt; 2 )</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: "
          &lt;&lt; std::endl;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; argv[0]
          &lt;&lt; "&nbsp; outputImageFile " &lt;&lt; std::endl;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typedef
          itk::Image&lt;unsigned char, 2&gt;&nbsp; ImageType;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; ImageType::Pointer image =
          ImageType::New();</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; typedef itk::Image&lt;unsigned
          char, 2&gt; ImageType;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; ImageType::Pointer image =
          ImageType::New();</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; typedef
          itk::ImageFileWriter&lt;ImageType&gt; FileWriterType;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; typedef
          itk::LineConstIterator&lt; ImageType &gt; LineIteratorType;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; ImageType::IndexType point0;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; point0[0] = 46;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; point0[1] = 232;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; ImageType::IndexType point1;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; point1[0] = 433;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; point1[1] = 477;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; LineIteratorType it( image,
          point0, point1);</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; it.GoToBegin();</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; while (!it.IsAtEnd())</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt;
          (float)it.Get() &lt;&lt; std::endl;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; ++it;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; FileWriterType::Pointer writer=
          FileWriterType::New();</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;
          writer-&gt;SetFileName(argv[1]);</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;SetInput(image);</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;Update();</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout&lt;&lt;"---&gt;line
          iterator passed "&lt;&lt;endl;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;&nbsp; return EXIT_SUCCESS;</p>
        <p class="MsoPlainText">&gt; }</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&nbsp;</p>
        <p class="MsoPlainText">I am in a confusion of setting the input
          here &#8220;writer-&gt;SetInput(image);&#8221; . &nbsp;Could someone please
          help me out ?
        </p>
        <p class="MsoPlainText">I am using InsightToolkit-4.1.0 with
          Visual Studio 2010 on Windows 7.</p>
        <p class="MsoPlainText">&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; </p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; Regards,</p>
        <p class="MsoPlainText">&gt;&nbsp;</p>
        <p class="MsoPlainText">&gt; Ravi Teja.</p>
        <p class="MsoNormal">&nbsp;</p>
      </div>
      <br>
      <hr>
      <font color="Gray" face="Arial" size="1">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.<br>
      </font>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_____________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Kitware offers ITK Training Courses, for more information visit:
<a class="moz-txt-link-freetext" href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a>

Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
</pre>
    </blockquote>
    <br>
    <div style="bottom: auto; left: 228px; right: auto; top: 233px;
      display: none;" class="translator-theme-default"
      id="translator-floating-panel">
      <div title="Zum &uuml;bersetzen klicken"
        id="translator-floating-panel-button"></div>
    </div>
  </body>
</html>