Ensure that numpy reducing methods return scalars
ndarray methods such as sum(...) should produce scalar types, rather than a 0-d VTKArray. Add array_wrap(...) method to coerce 0-d array to scalar. This change is need to better integrate with other APIs that take ndarray's. For example this issue was discovered when trying the following"
from scipy import ndimage
ndimage.measurements.center_of_mass(vtkarray)
This produces:
File "/Library/Python/2.7/site-packages/scipy-0.18.1-py2.7-macosx-10.11-intel.egg/scipy/ndimage/measurements.py", line 1289, in center_of_mass
return [tuple(v) for v in numpy.array(results).T]
TypeError: 'numpy.float64' object is not iterable
The underlying cause of this error is the different type returned by sum(...).