Recommended API for iterating over a whole image or its subset


I am writing a ParaView plugin where I encounter the following 2 cases:
1- for the 1rst I need to iterate over the surrounding adjacents points of a vtkImageData;
2- for the other one, I have to do a whole sweep merging 2 Images + and 2 optionals mask (1 as a 2D image, the second a regular 3D one).

As the 3D image may be large (~300MB for the smallest representative unit test, in float), I was wondering which API is now recommended.

I saw on the not up-to-date VTK reference book at p. 404 that you may use vtkImageIterator and I am wondering if this is still the recommended practice before diving into learning them.
With it I can go into multithreading, but may encounter some issue like this one ( under the road.

I also saw this tutorial about DataArray (, and it seemed to me that the dispatcher is the new way to go.

Which one should I be learning and using for each case ?
If it is the dispatcher do you have a link explaining it ?

Best regards,

PS: The data would always be «float» with only 1 component.

Hi Yohan,

Your question is quite vtk-centric.
You may have more luck for help in our VTK discourse :

Thank you Mathieu for the answer, I didn’t know that vtk had also its discourse.
Have a nice day