<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoPlainText">Hi,</p>
<p class="MsoPlainText"> </p>
<p class="MsoPlainText">I want to draw a line in to an image .</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> #include <iostream></p>
<p class="MsoPlainText">> #include “itkImageFileWriter.h”</p>
<p class="MsoPlainText">> #include "itkLineConstIterator.h"</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> #include "itkImage.h"</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> int main(int argc, char *argv[])</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> {</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> if( argc < 2 )</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> {</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> std::cerr << "Usage: " << std::endl;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> std::cerr << argv[0] << " outputImageFile " << std::endl;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> return EXIT_FAILURE;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> }</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> typedef itk::Image<unsigned char, 2> ImageType;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> ImageType::Pointer image = ImageType::New();</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> typedef itk::Image<unsigned char, 2> ImageType;</p>
<p class="MsoPlainText">> ImageType::Pointer image = ImageType::New();</p>
<p class="MsoPlainText">> typedef itk::ImageFileWriter<ImageType> FileWriterType;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> typedef itk::LineConstIterator< ImageType > LineIteratorType;</p>
<p class="MsoPlainText">> ImageType::IndexType point0;</p>
<p class="MsoPlainText">> point0[0] = 46;</p>
<p class="MsoPlainText">> point0[1] = 232;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> ImageType::IndexType point1;</p>
<p class="MsoPlainText">> point1[0] = 433;</p>
<p class="MsoPlainText">> point1[1] = 477;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> LineIteratorType it( image, point0, point1);</p>
<p class="MsoPlainText">> it.GoToBegin();</p>
<p class="MsoPlainText">> while (!it.IsAtEnd())</p>
<p class="MsoPlainText">> {</p>
<p class="MsoPlainText">> std::cout << (float)it.Get() << std::endl;</p>
<p class="MsoPlainText">> ++it;</p>
<p class="MsoPlainText">> }</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> FileWriterType::Pointer writer= FileWriterType::New();</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> writer->SetFileName(argv[1]);</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> writer->SetInput(image);</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> writer->Update();</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> cout<<"--->line iterator passed "<<endl;</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> return EXIT_SUCCESS;</p>
<p class="MsoPlainText">> }</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText"> </p>
<p class="MsoPlainText">I am in a confusion of setting the input here “writer->SetInput(image);” . 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"> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> Regards,</p>
<p class="MsoPlainText">> </p>
<p class="MsoPlainText">> Ravi Teja.</p>
<p class="MsoNormal"> </p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" 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>
</body>
</html>