You probably don’t have to address each pixel individually, at least if the formula is solely based on the grey value of the image. Or do you take a region of the central pixel into account?
Two tricks if you only use the grey value of pixel at (x,y); use changeValues(gv,gv,ngv) where gv is the grey value and ngv = formula(gv), or create a lookup table, fill entry gv with ngv for every grey value, the apply lut.
If you need to access the environment of the pixels, start
Plugins>Macros>Record, then perform your steps to get to a new pixel value (you can select one single pixel if you zoom in far enough), then in a
Plugins>New>Macro create a for loop around what you just recorded.
Loops are common in the forum, just search for
setPixel( together with
for in the magnifier glass top right of this forum and you’ll find plenty of examples.