Adding utilities for NL-means algorithm. Fixing 3D related utils.