Funny you should request this. I built a Cython framework do exactly what you want (arbitrary selem, boundary handling [padding], and even arbitrary weighting of the selem in 2D and 3D) for local *weighted *variance. The framework is about as useful as the actual calculation. Replace the innermost loop, change the name, and you get an entirely different non-linear weighted local feature. This requires a somewhat skilled user, but the framework is already done so it isn't as hard as it sounds. Trouble is, I used some features from cython.parallel so those would have to be stripped out, losing over an order of magnitude in speed. I've been kicking around submitting them, but going back and ripping out the parallel features is painful. If interested I can clean up and put them in a Gist or two. Josh On Monday, May 26, 2014 1:50:10 AM UTC-5, Chencan QIAN wrote:
Essentially, this is something similar to scipy.ndimage.filters.generic_filter (which is too slow because of its internal python for-loop), but implemented in cython as with skimage.filter.rank family.
Given the diversity within skimage.filter.rank, a generic function would be very useful. For example, I'd like to calculate local variance, which is conceptually similar to skimage.filter.rank.mean, but not supported currently.
I guess the absence of such a function must be due to some unresolved technical obstacle?
Thanks~
Chencan