Thanks for replying and helping me out guys. I found what was going
wrong in my code. I needed to bring this one line inside the 'for' loop
in my code and it started working. <span class="q"><br><br> ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
<br><br></span>I guess sitting outside the 'for' loop it was pointing to the old image and causing the error.<br><br>Regards,<br><span class="sg">Ashish</span><br><br><div><span class="gmail_quote">On 1/14/07, <b class="gmail_sendername">
Thomas Lambertz</b> <<a href="mailto:thomas@hexerei-software.de">thomas@hexerei-software.de</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;">
Hi,<br><br>i havent found the thread start - so please be patient if my answer does<br>not fit.<br><br>Are the images to read in all of the same size ? If not i would suggest<br>use of reader->UpdateLargestPossibleRegion();
<br>instead of<br>reader->Update();.<br><br>Afaik, Update does only setup the OutputRequestedRegion only once. So if<br>there is a change in size it would not be recognized.<br><br><br>Another simple checks:<br><br>- what happens when you read in the same file in the loop ?
<br> reader->SetFileName( fileNames[0] );<br> instead of<br> reader->SetFileName( fileNames[fni] );<br><br>- what happens when you move<br> ReaderType::Pointer reader = ReaderType::New();<br> at the beginning inside the loop ?
<br> reader is a smartpointer so that the object should be deleted at<br>each loops end (leaving the scope where reader is declared in)<br><br><br>Greets,<br>Tom<br><br><br>Daniel Mace wrote:<br>> Ashish,<br>><br>
> The assertion errors tend to pop up (only/more often) with windows<br>> machines for some reason, so they are odd bugs to track down. I could<br>> be wrong, but I'm not entirely sure that your image file has set its
<br>> region settings correctly. Just to make sure, after the line<br>> -----------------<br>> InputImageType::Pointer image = reader->GetOutput();<br>> -----------------<br>><br>> add in a<br>> -----------------
<br>> image->Update()<br>> ----------------<br>><br>> Just to make sure that the image->GetRequestedRegion() actually<br>> returns a valid region. I'm pretty sure that assigning it to an image<br>
> doesn't actually create the image regions until it is forced to<br>> update. Had this code been in a ImageToImageFilter the Update() would<br>> be propagated down the line before the Regions and iterators were
<br>> called in the GenerateData() method. I don't think that is happening<br>> here.<br>><br>> Cheers,<br>> Dan<br></blockquote></div><br>