scikit-image/scikit-image — pull request #511 by ankit-maverick (2013-04-19 23:46:43+00:00)
Title: First implementation of Integer Up/Downsampling

I would like you all to review this implementation and comment if things could be done in a better way. The question that I have currently is about the `dtype` of the output matrix. Currently, I am initializing output matrix as `np.zeros` which has `dtype float64`, to avoid saturation while performing `sum` downsampling and to retain precision while performing `mean` downsampling. Any better suggestions?

TODO :
- [ ] `resample()` for non-integer sampling
- [ ] Documentation
- [ ] Tests
- [ ] PEP8 check

Current api :
```p
>>> a = arange(12).reshape(3, 4)
>>> a
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
>>> dsum = downsample(a, (2, 2))
>>> dsum
array([[ 10., 18.]])
>>> dmean = downsample(a, (2, 2), 'mean')
>>> dmean
array([[ 2.5, 4.5]])
>>> udivide = upsample(a,(2, 2))
>>> udivide
array([[ 0. , 0. , 0.25, 0.25, 0.5 , 0.5 , 0.75, 0.75],
[ 0. , 0. , 0.25, 0.25, 0.5 , 0.5 , 0.75, 0.75],
[ 1. , 1. , 1.25, 1.25, 1.5 , 1.5 , 1.75, 1.75],
[ 1. , 1. , 1.25, 1.25, 1.5 , 1.5 , 1.75, 1.75],
[ 2. , 2. , 2.25, 2.25, 2.5 , 2.5 , 2.75, 2.75],
[ 2. , 2. , 2.25, 2.25, 2.5 , 2.5 , 2.75, 2.75]])
>>> uuniform = upsample(a, (2, 2), 'uniform')
>>> uuniform
array([[ 0., 0., 1., 1., 2., 2., 3., 3.],
[ 0., 0., 1., 1., 2., 2., 3., 3.],
[ 4., 4., 5., 5., 6., 6., 7., 7.],
[ 4., 4., 5., 5., 6., 6., 7., 7.],
[ 8., 8., 9., 9., 10., 10., 11., 11.],
[ 8., 8., 9., 9., 10., 10., 11., 11.]])
```