ImageRegionIterator object in python

Hi,

I installed ITK on mac python 2.7 using command “python -m pip install itk”, and when I wanted to create an ImageRegionIterator object, it had an error – “AttributeError: ‘LazyITKModule’ object has no attribute ‘ImageRegionIterator’”. I had read the source code and found that there isn’t any file containing ImageRegionIterator.
I need to use the ImageRegionIterator and ImageRegionConstIterator in python. How can I create an ImageRegionIterator object in python script?

Thanks a lot!

Wanyu

Iterators are not wrapped in Python. Iterators are not efficient when wrapped. If you want to loop over the image you can either do it the slow way, with loops, or use NumPy arrays and NumPy features which will be more optimized.

2 Likes

I will replace iterators with Numpy array. It’s very helpful.
Thanks a lot!

Wanyu