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