Josh, why the parallel stripping out? Is it a Cython version requirement? We can always have this as a "dormant" PR for 1.0, for which we might bump up the version required. It might also be possible to wrap the import around a try-catch clause so that it fails gracefully on an earlier Cython version.


On Tue, May 27, 2014 at 1:07 PM, Josh Warner <> wrote:
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.


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?



You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit