[Insight-developers] fast image pixel access method
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon May 13 11:34:24 EDT 2013
Hello,
On May 13, 2013, at 11:03 AM, "Gao, Yi" <gaoyi.cn at gmail.com> wrote:
> When using NeighborhoodIterator, i'm not sure if the boundary checking is automatically turned on. I guess if that is by default on, then there is not much speed gain with it.
Because the region you specify to the Iterator is on the boundary it will turn on the boundary checking. You can either turn off the condition:
http://www.itk.org/Doxygen/html/classitk_1_1ConstNeighborhoodIterator.html#a438cb0146b802b04a771a2461952cff8
or you can change the region size you initialize the Iterator with.
You can just use the operator<< to check what the iterator is doing.
Also consider using a large type for the accumulation type, such as itk::NumericTraits<T>::AccumulatorType;
And consider using std::accumulate(it.Begin(), it.End(), 0 )
Brad
More information about the Insight-developers
mailing list