BUG: ndimage: use only normalized type_num in comparisons

Numpy type_num cannot be used in comparisons, since some of the values
are equivalent, depending on the platform.
Merge pull request #3071 from pv/ndimage-typenum

BUG: ndimage: use only normalized type_num in comparisons