[Insight-developers] Re: [Insight-users] ITK iterators debugging
problem in Visual Studio 8(VS 2005)
Luis Ibanez
luis.ibanez at kitware.com
Mon Nov 5 08:17:50 EST 2007
Hi Alex
You missed to show the section of code where you are using
the image iterators.
Chances are that you are now getting an image region
from the input image produced by the reader. If you
run the reader again and read a different image, then
that region will not match your current image.
You must make sure that you call UpdateLargestPossibleRegion()
in the last filter of your pipeline, or at least on the filter
from which you are taking the region that defines your iterator.
Also, make sure that you grab the region again, after you call
UpdateLargestPossible region.
Printing out the image data with
filter->GetOutput()->Print( std::cout );
and printing the region of the iterator, will help you to
understand when these two are not matching.
If you still find any problems, please post to the list the
section of code where you are using the ImageIterators.
Thanks
Luis
----------------------------
zjzhang at ee.cuhk.edu.hk wrote:
> Dear All:
>
> I have a problem with my own program. I use vs 2005 , itk 3.4
> version under windows xp. it happens with the debug mode of the
> program with the following code:
> ImageFileReader::Pointer fixedReader = ImageFileReader::New();
> fixedReader->SetFileName( filename );
> fixedReader->Update();
>
> every time when I call update() of the imagefilereader, there will be
> an error:
> Unhandled exception at 0x005ace01 in MyProgram.exe: 0xC0000005: Access
> violation reading location 0xcccccccc.
>
> and the debug breaks at file "list" with lines:
> #if _HAS_ITERATOR_DEBUGGING || _SECURE_SCL
> iterator begin()
> { // return iterator for beginning of mutable sequence
> return (iterator(_Nextnode(_Myhead), this));
> }
>
> I have seen there is a similar problem in:
> http://www.itk.org/pipermail/insight-users/2006-December/020472.html
> but It seem the discussion didn't reach a clear answer.
> if I add # cmakedefine _HAS_ITERATOR_DEBUGGING=0
> # cmakedefine _SECURE_SCL=0
> into the itkConfigure.h.in, line 49, it seems after cmake, it is still
> not defined in the itkconfigure.h file.
> But if I add some words in cmakelist.txt, I wonder if I need add
> _HAS_ITERATOR_DEBUGGING=0 every time in my program build on itk.
>
> I want to know how to solve this bug. Thank you for your help.
>
> regards,
> Alex
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-developers
mailing list