Thanks for replying Dan. Yes that&#39;s what it is, reader-&gt;SetFileName(fileNames[fni]). <br>The fname was a typo in my previous message,sorry for that. It doesn&#39;t work with<br>reader-&gt;SetFileName(fileNames[fni])
<br><br>The exact error message is a pop up box, titled Microsft Visual C++ debug Library. It reads-<br>---------<br>Debug Assertion Failed!<br>Program:...<br>File: C:\program Files(x86)\Microsft Visual Studio 8\VC\include\vector
<br>Line: 756<br><br>Expression: vector subscript out of range<br><br>For information on how your program can cause assertion failure, see the Visual C++ documentation on asserts.<br><br>abort-retry-ignore<br>--------<br>
<br>Do you know what is going wrong here?<br><br>Thanks,<br>Ashish<br><br><div><span class="gmail_quote">On 1/11/07, <b class="gmail_sendername">Daniel Mace</b> &lt;<a href="mailto:dlm19@duke.edu">dlm19@duke.edu</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Ashish,<br><br>What&#39;s the exact error message that it gives you?&nbsp;&nbsp;Also, where do you
<br>set &quot;fname&quot;.&nbsp;&nbsp;perhaps it should be:<br>-----------<br>reader-&gt;SetFileName(fileNames[fni])<br>--------<br>unless you set fname somewhere else in the code that isn&#39;t present.<br><br>Cheers,<br>Dan<br><br>
Ashish Singh wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I am a newbie to ITK. I was trying to read a set of dicom images from<br>&gt; a directory and then use reader-&gt;update() to process each one of them<br>&gt; one after the other. But the reader-&gt;update() gives me an error after
<br>&gt; reading the first image. Can anyone please tell me how to fix this<br>&gt; problem?<br>&gt;<br>&gt; This is what my code looks like. It is not the complete code, but only<br>&gt; the relevant part of it.<br>&gt; ---------------
<br>&gt;&nbsp;&nbsp; typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>&gt;&nbsp;&nbsp; NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br>&gt;&nbsp;&nbsp; nameGenerator-&gt;SetInputDirectory( &quot;D:\\testimages&quot;&nbsp;&nbsp;);
<br>&gt;<br>&gt;&nbsp;&nbsp; typedef std::vector&lt;std::string&gt; FileNamesContainer;<br>&gt;&nbsp;&nbsp; FileNamesContainer fileNames = nameGenerator-&gt;GetInputFileNames();<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; unsigned int numberOfFilenames =&nbsp;&nbsp;fileNames.size();
<br>&gt;&nbsp;&nbsp; std::cout &lt;&lt; numberOfFilenames &lt;&lt; std::endl;<br>&gt;&nbsp;&nbsp; unsigned int fni;<br>&gt;<br>&gt;&nbsp;&nbsp; for(fni = 0; fni&lt;numberOfFilenames; fni++)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;filename # &quot; &lt;&lt; fni &lt;&lt; &quot; = &quot;;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; fileNames[fni] &lt;&lt; std::endl;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;<br>&gt;&nbsp;&nbsp; for(fni = 0; fni&lt;numberOfFilenames; fni++)<br>&gt;&nbsp;&nbsp; {<br>&gt;&nbsp;&nbsp; reader-&gt;SetFileName( fname);<br>&gt;<br>&gt;&nbsp;&nbsp; reader-&gt;SetImageIO( gdcmImageIO );
<br>&gt;<br>&gt;&nbsp;&nbsp; try<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;Update();//this is where it gives me an error second<br>&gt; time in the loop.<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;&nbsp;&nbsp; catch (itk::ExceptionObject &amp; e)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; &quot;exception in file reader &quot; &lt;&lt; std::endl;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; e &lt;&lt; std::endl;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt; // code for processing the image //
<br>&gt; //code for writing the processed image//<br>&gt; }// for loop complete<br>&gt; --------------------------------------<br>&gt; The filenames are correctly read, the code runs fine the first time<br>&gt; through the for loop, but second time it gives an error at the
<br>&gt; reader-&gt;Update() line.<br>&gt; Can anyone please tell me why is this happening and how to fix it?<br>&gt;<br>&gt; Thanks,<br>&gt; Ashish<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------
<br>&gt;<br>&gt; _______________________________________________<br>&gt; Insight-users mailing list<br>&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;<br><br></blockquote></div><br>