How Does the Non Local Means Filter Work?
Check out the description here.

Basically, it tries to find patterns of pixels all over the image, and average over these self-similarities rather than just using the pixels close to the current pixel.

So to answer your questions:

How is the the value of the non-local mean calculated?


Find all the pixels that are similar to the current pixel (non-local).

Find the average value of these.

How does that value replaces a pixel?


Find the non-local average as above.

Replace the current pixel with this non-local average.

How does that filter sweeps the image?



Well, provided you are creating a new image from the old one so that the mean calculation is being done on the old image and the mean assignment is being done on the new image, it shouldn't really matter.