[SciPy-dev] Should ndimage.measurements.* should return lists if index is a list?

Thouis (Ray) Jones thouis@broad.mit....
Fri Apr 17 13:57:46 CDT 2009


Current behavior:
>>> from scipy import ndimage
>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=[1,2])
[1.0, 4.0]
>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=[1])
1.0
>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=1)
1.0

I think the second result should be [1.0].  We're using the ndimage
code for image processing, and have to wrap the measurement functions
to make the code general for the case where there is only one object
in the image.

Less important, though it might make sense, is to have this code
return [] rather than raising an exception:
>>> ndimage.maximum([[1,2], [3,4]], [[1,0],[0,2]], index=[])


Ray Jones


More information about the Scipy-dev mailing list