Pixel window implementation in computing correlation coefficient


I am trying to implement this intensity-based correlation coefficient formula using SNAP:

Is it possible to create to implement a 5x5 to 13x13 pixel window using just band math in SNAP or should I just stick with R/Python?


PS. I am already using the complex coherence in SNAP and I just want to compare the results of using an intensity-based one to my previous results. Thanks!