Thanks for replying Dan. Yes that's what it is, reader->SetFileName(fileNames[fni]). <br>The fname was a typo in my previous message,sorry for that. It doesn't work with<br>reader->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> <<a href="mailto:dlm19@duke.edu">dlm19@duke.edu</a>> 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's the exact error message that it gives you? Also, where do you
<br>set "fname". perhaps it should be:<br>-----------<br>reader->SetFileName(fileNames[fni])<br>--------<br>unless you set fname somewhere else in the code that isn't present.<br><br>Cheers,<br>Dan<br><br>
Ashish Singh wrote:<br>> Hi,<br>><br>> I am a newbie to ITK. I was trying to read a set of dicom images from<br>> a directory and then use reader->update() to process each one of them<br>> one after the other. But the reader->update() gives me an error after
<br>> reading the first image. Can anyone please tell me how to fix this<br>> problem?<br>><br>> This is what my code looks like. It is not the complete code, but only<br>> the relevant part of it.<br>> ---------------
<br>> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br>> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br>> nameGenerator->SetInputDirectory( "D:\\testimages" );
<br>><br>> typedef std::vector<std::string> FileNamesContainer;<br>> FileNamesContainer fileNames = nameGenerator->GetInputFileNames();<br>> unsigned int numberOfFilenames = fileNames.size();
<br>> std::cout << numberOfFilenames << std::endl;<br>> unsigned int fni;<br>><br>> for(fni = 0; fni<numberOfFilenames; fni++)<br>> {<br>> std::cout << "filename # " << fni << " = ";
<br>> std::cout << fileNames[fni] << std::endl;<br>> }<br>><br>> for(fni = 0; fni<numberOfFilenames; fni++)<br>> {<br>> reader->SetFileName( fname);<br>><br>> reader->SetImageIO( gdcmImageIO );
<br>><br>> try<br>> {<br>> reader->Update();//this is where it gives me an error second<br>> time in the loop.<br>> }<br>> catch (itk::ExceptionObject & e)<br>> {<br>
> std::cerr << "exception in file reader " << std::endl;<br>> std::cerr << e << std::endl;<br>> return EXIT_FAILURE;<br>> }<br>> // code for processing the image //
<br>> //code for writing the processed image//<br>> }// for loop complete<br>> --------------------------------------<br>> The filenames are correctly read, the code runs fine the first time<br>> through the for loop, but second time it gives an error at the
<br>> reader->Update() line.<br>> Can anyone please tell me why is this happening and how to fix it?<br>><br>> Thanks,<br>> Ashish<br>><br>><br>> ------------------------------------------------------------------------
<br>><br>> _______________________________________________<br>> Insight-users mailing list<br>> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>> <a href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</a><br>><br><br></blockquote></div><br>