I would like to characterize the background signal around specified pixels using a handmade function. As it will be applied to a large amount of data, I try to find an efficient