[Insight-users] Problem with iterators
王琪
qi-wang02 at mails.thu.edu.cn
Tue Mar 28 03:24:55 EST 2006
hi,
I just wanted to use the image iterators to create a new image, and my code is as follows:
for (inputIt3.GoToEnd(),inputIt4.GoToEnd(),outputIt1.GoToEnd();
!inputIt3.IsAtBegin();
--inputIt3,--inputIt4,--outputIt1)
{
if (((inputIt3.Get()!=0)||(inputIt4.Get()!=0))&&(flag[inputIt3.GetIndex()[0]]==0))
{
if (inputIt3.Get()!=0)
outputIt1.Set(inputIt3.Get());
if (inputIt4.Get()!=0)
outputIt1.Set(inputIt4.Get());
flag[inputIt3.GetIndex()[0]]=1;
}
else
outputIt1.Set( itk::NumericTraits<unsigned char>::NonpositiveMin() );
}
There was no problem with compilation and link. But when I tried to run the programm it came into a problem. It was able to create only one image but couldn't end properly. Then I found whenever I tried to set the pixel value with iterators there were always some problems. Sometimes after changing the order of the codes or using another way of expression it can be overcome. I am very confused. What is the problem? Thanks a lot.
More information about the Insight-users
mailing list