[Insight-users] ShapedNeighborhoodIterator get() and set() functions

nicrey nicolasreyv at gmail.com
Tue Aug 23 02:25:52 EDT 2011


Hi ITK Users,

I have some problems using the ShapedNeighborhoodIterator. The get()
function works perfectly using the ConstantBoundaryCondition that I want.
But I want to know if when using the set() function, do I have to "manually"
test if the pixel is outofbounds ?


IteratorType iterator(radius, image, image->GetLargestPossibleRegion());
for(iterator.GoToBegin(); !iterator.IsAtEnd(); ++iterator){

-->First Case: This works perfect.

IteratorType::ConstIterator ci = iterator.Begin();
    while (! ci.IsAtEnd()){
cout<&lt;endl&lt;&lt;ci.Get();
ci++;
}

--&gt;Second Case: This works perfect, now ci is not a constiterator.

IteratorType::Iterator ci = iterator.Begin();
    while (! ci.IsAtEnd()){
cout<&lt;endl&lt;&lt;ci.Get();
ci++;
}

--&gt;Third Case: This does not work, now ci is not a consiterator.

IteratorType::Iterator ci = iterator.Begin();
    while (! ci.IsAtEnd()){
cout<<endl<<ci.Get();
ci.Set(1.0); // Problem !!
ci++;
}
}

In the third case the problem is that I am trying to write out of bounds.
But that should not be tested by the boundary condition ? for the
application I am developing writing into a non existing pixel is fine.

Thanks,


-----
Nicolas Rey-Villamizar
PhD Student
BioImage Analytics Lab
University of Houston
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/ShapedNeighborhoodIterator-get-and-set-functions-tp6714925p6714925.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list