Pull request: morphology fix

Stéfan van der Walt stefan at sun.ac.za
Wed Oct 19 14:44:03 EDT 2011


On Wed, Oct 19, 2011 at 9:57 AM, Ralf Gommers
<ralf.gommers at googlemail.com> wrote:
>> Does anyone here have experience with such approaches?
>>
> scipy.interpolate has Cython code with simple Mako templating, look at
> interpnd.pyx and generate_interpnd.py. If it's flexible enough for your
> needs then it'll be a lot more pleasant than using C++.

This definitely gets us some way.  We can modify our _build.cython
call to first run the template engine on any .tpyx files.

But how should we dispatch to different functions, based on dtype?
Let's say we have support for int16, uint16 and double in our
algorithm, so via templating we'll get

myfunc_int16
myfunc_uint16
myfunc_double

for a single input argument (which is the most common case).  We can
then define a dispatch call such as

dtype_call('myfunc', img.dtype)

which calls the appropriate function.  Does this sound about right?

Regards
Stéfan



More information about the scikit-image mailing list