[Insight-users] Iterators: PROBLEM

Daniela Sacchetto danysunflower at hotmail.it
Sat Aug 7 08:30:50 EDT 2010





Thanks Sergiy!!

The problem was the manually created image Dsk; I change the lines as you said me and now it runs perfectly.

Regards,
Daniela

> Date: Fri, 6 Aug 2010 22:16:48 -0700
> From: volkovych at gmail.com
> To: insight-users at itk.org
> Subject: Re: [Insight-users] Iterators: PROBLEM
> 
> 
> I think the problem appears when the program tries to increment one of the
> iterators.
> Try to replace the "for" line to this:
> 
> for (DskIt.GoToBegin(), DFltIt.GoToBegin(),
> DSubIt.GoToBegin();!DskIt.IsAtEnd() && !DFltIt.IsAtEnd() &&
> !DSubIt.IsAtEnd(); ++DskIt, ++DFltIt, ++DSubIt)
> 
> If it doesn't go to the internal part of the loop at all, it means that one
> of your images is empty (the region wasn't allocated properly). You may
> identify which iterator creates a problem by:
> 
> DskIt.GoToBegin();
> if (DskIt.IsAtEnd())
>   std::cerr << "Not ok ;-("<< std::endl;
> 
> If the problem appeared due to the manually created image Dsk, try to
> allocate it with this lines:
> 
> ImageType::Pointer Dsk = ImageType::New(); 
> Dsk->SetRegions(DFlt->GetLargestPossibleRegion()); 
> Dsk->Allocate();
> 
> But be aware that DFlt and DSub images should already have been filled by
> the values before doing it.
> 
> Also you may initialize iterators based on the LargestPossibleRegion:
> 
> IteratorType DskIt (Dsk, Dsk->GetLargestPossibleRegion()); 
> ConstIteratorType DFltIt (DFlt, DFlt->GetLargestPossibleRegion()); 
> ConstIteratorType DSubIt (DSub, DSub->GetLargestPossibleRegion()); 
> 
> If it still doesn't work, please, place the larger part of code (I want to
> see how all images are obtained to be sure that you haven't errors in the
> other part of code).
> 
> Sergiy.
> -- 
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Iterators-PROBLEM-tp5381369p5383008.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100807/9a90f17c/attachment.htm>


More information about the Insight-users mailing list