Imported from https://github.com/tehret/vbm3d