non-local-means: adapt final steps