[Insight-users] Segmentation Fault when using Iterators

nadan zhu nadan.zhu at gmail.com
Sun Jan 11 09:53:06 EST 2009


Hi,
     With your code, you should make sure the two images have the same
requestedregion.
Or change your code to

 while( !probIt.IsAtEnd() && !lobeIt.IsAtEnd() )
{
  while( !probIt.IsAtEndOfSlice() && !lobeIt.IsAtEndOfSlice() )
  {
    while( !probIt.IsAtEndOfLine() && !lobeIt.IsAtEndOfLine() )
...

On Mon, Jan 12, 2009 at 1:16 AM, Oliver Trebbe <otrebbe at uni-muenster.de>wrote:

> Hi guys,
>
> ive got a problem: my Iterators dont want to Iterate right:
>
> Code snippet:
>
> void probchecker::probcheck( )
> {
>  NCSIteratorType probIt( m_ProbImage, m_ProbImage->GetRequestedRegion() );
>  NCSIteratorType lobeIt( m_LobeImage, m_LobeImage->GetRequestedRegion() );
>
>
>  probIt.SetFirstDirection(  1 );
>  probIt.SetSecondDirection( 2 );
>  lobeIt.SetFirstDirection(  1 );
>  lobeIt.SetSecondDirection( 2 );
>
>  probIt.GoToBegin();
>  lobeIt.GoToBegin();
>
>  ImageType3D::IndexType probItIndex;
>
>  while( !probIt.IsAtEnd() || !lobeIt.IsAtEnd() )
>  {
>   while( !probIt.IsAtEndOfSlice() || !lobeIt.IsAtEndOfSlice() )
>   {
>     while( !probIt.IsAtEndOfLine() || !lobeIt.IsAtEndOfLine() )
>     {
> ... and so on...
> if i just test the lobeIt.IsAtEnd() in the first while loop it breaks and
> everything is over...
> so it has something to do with the lobeIt but i cant find ane failure...
> bug maybe?
>
> would be pleased about any help
>
>
> Regards
>
> Oliver
>
> --
> Oliver Trebbe
> Department of Neurology
> University of Muenster
> 48129 Muenster, Germany
>
>
> _______________________________________________
> 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://www.itk.org/pipermail/insight-users/attachments/20090112/62fd8053/attachment.htm>


More information about the Insight-users mailing list