In short:
I’m searching for a way to calculate a multidimensional custom image filter on more than one axis of values in python.
What I mean is:
With scipy’s ndimage, I can use ndimage.generic_filter to apply the custom function myfunc to an N-dimensional numpy array. In myfunc, I just need to indicate how to process the pixel neighborhood of shape (size[0],…,size[N-1]) which is passed to the function.
Slightly different from that, what I would like to do is to provide an array of shape (S1,…,SN,V1,…VM) and apply the filter only along the spatial dimensions and interpret the remaining M axes as axes of values. The pixel neighborhood to process would then be of shape (size[0],…,size[N-1],V1,…,VM).
So far I’m having my own relatively naive implementation of such a filter, however it would be good to have a version handling the general case and dealing with border effects.
Thanks a lot in advance for hints or ideas! Cheers