nipy/nipy — pull request #227 by alexis-roche (2012-10-08 07:04:01+00:00)
Title: fixed bug in resampling for unsigned type images

This branch fixes a bug in the `resample` function from `nipy.algorithms.registration`, which returns an image with same dtype as the input image, meaning that any interpolated value needs be converted to the closest value according to the dtype. The conversion was not done properly for images encoded in unsigned integer types as negative values (which can arise here and there due to cubic spline interpolation) would be converted using a simple cast in C. This has been fixed by checking `dtype.kind` and forcing negative values to zero whenever `dtype.king=='u'`.