0.4.x: statcounter

This PR adds a statcounter.py file based on that in pyspark, but with the additional optimization that only those values necessary for the requested statistics will be updated (so, for instance, we won't update the `m2`  variable, which is required for `stdev` and `variance`, if the only stat that we're trying to calculate is the mean).

Please note we've already got unit test coverage for the methods affected by this change, in test_images.py TestImagesStats.

This is a fix for #60.