[Insight-users] Re: image reader->Update() problem

Ashish Singh mrasingh at gmail.com
Sun Jan 14 19:30:33 EST 2007


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.

 ImageIOType::Pointer gdcmImageIO = ImageIOType::New();

I guess sitting outside the 'for' loop it was pointing to the old image and
causing the error.

Regards,
Ashish

On 1/14/07, Thomas Lambertz <thomas at hexerei-software.de> wrote:
>
> Hi,
>
> i havent found the thread start - so please be patient if my answer does
> not fit.
>
> Are the images to read in all of the same size ? If not i would suggest
> use of reader->UpdateLargestPossibleRegion();
> instead of
> reader->Update();.
>
> Afaik, Update does only setup the OutputRequestedRegion only once. So if
> there is a change in size it would not be recognized.
>
>
> Another simple checks:
>
> - what happens when you read in the same file in the loop ?
>     reader->SetFileName( fileNames[0] );
>     instead of
>     reader->SetFileName( fileNames[fni] );
>
> - what happens when you move
>     ReaderType::Pointer reader = ReaderType::New();
>     at the beginning inside the loop ?
>     reader is a smartpointer so that the object should be deleted at
> each loops end (leaving the scope where reader is declared in)
>
>
> Greets,
> Tom
>
>
> Daniel Mace wrote:
> > Ashish,
> >
> > The assertion errors tend to pop up (only/more often) with windows
> > machines for some reason, so they are odd bugs to track down.  I could
> > be wrong, but I'm not entirely sure that your image file has set its
> > region settings correctly.  Just to make sure, after the line
> > -----------------
> > InputImageType::Pointer image = reader->GetOutput();
> > -----------------
> >
> > add in a
> > -----------------
> > image->Update()
> > ----------------
> >
> > Just to make sure that the image->GetRequestedRegion() actually
> > returns a valid region.  I'm pretty sure that assigning it to an image
> > doesn't actually create the image regions until it is forced to
> > update.  Had this code been in a ImageToImageFilter the Update() would
> > be propagated down the line before the Regions and iterators were
> > called in the GenerateData() method.  I don't think that is happening
> > here.
> >
> > Cheers,
> > Dan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070114/ae3fde5e/attachment-0001.html


More information about the Insight-users mailing list