[Insight-users] Funny results from ImageRegionConstIterator.
johnjtchen at aol.co.uk
johnjtchen at aol.co.uk
Wed Jan 23 21:08:23 EST 2008
Hi Guys,
Environment: vista, vs2k5sp1, itk3.4.
Input mPreMaskImg image: 256 256 50 with 2000 points of intensity 255,
background intensity is 0.
Following codes generates funny results:
--------------------------------------------------------------------------------------
typedef itk::ImageRegionConstIterator <FloatImageType> constIterType;
constIterType itSeedsMAsk(mPreMaskImg ,
mPreMaskImg->GetBufferedRegion());
float countfordebug = 0;
float smallerthanfa = 0;
itSeedsMAsk.GoToBegin();
while (!itSeedsMAsk.IsAtEnd()) {
if (itSeedsMAsk.Get() > 0){
++countfordebug;
// if (mFAImg->GetPixel(itSeedsMAsk.GetIndex()) < mFAThreshold){
// ++smallerthanfa;
// break;
// }
}
++itSeedsMAsk;
}
pDoc->mOutputText << "countfordebug1 : " << countfordebug << std::endl;
pDoc->mOutputText << "smallerthanfa1 : " << smallerthanfa << std::endl;
******** results ********
countfordebug1 : 2000
smallerthanfa1 : 0
--------------------------------------------------------------------------------------
float countfordebug = 0;
float smallerthanfa = 0;
itSeedsMAsk.GoToBegin();
while (!itSeedsMAsk.IsAtEnd()) {
if (itSeedsMAsk.Get() > 0){
++countfordebug;
if (mFAImg->GetPixel(itSeedsMAsk.GetIndex()) < mFAThreshold){
++smallerthanfa;
break;
}
}
++itSeedsMAsk;
}
pDoc->mOutputText << "countfordebug1 : " << countfordebug << std::endl;
pDoc->mOutputText << "smallerthanfa1 : " << smallerthanfa << std::endl;
******** results ********
countfordebug1 : 48
smallerthanfa1 : 1
--------------------------------------------------------------------------------------
Has anyone experienced the same problem?
Did I do something wrong?
Or just I was crazy? Which it does make me went like that.....
Thanks.
More information about the Insight-users
mailing list