get centroids in python script

Then iterating through the cell and use GetCentroid can work. You can check in VTK source code if the geometric centroid is computed.

As you can see in VTK source code, GetCentroid is just a convenience method that uses ComputeCentroid internally. You can use whichever you prefer, they both compute what you need.

Performance should be good if you only have thousands of cells. If you have hundreds of thousands of cells then iterating through them in Python will be too slow. You can probably get the result 100x faster if you write a small C++ function or use vector operations in Python (e.g., retrieve all the cell point coordinates at once and compute centroid using a few numpy array operations).