patches_center: new code to center patches (substract average patch) and store average patch to file