Viewer Plugins -> Passing precalculated arguments

Juan Nunez-Iglesias jni.soma at gmail.com
Wed Jan 28 06:10:02 EST 2015


Hi Marcel,




Check out functools.partial, which is a standard function in Python. It allows you to create functions with pre-evaluated arguments:




from skimage.restoration import denoise_tv_bregman

import functools

denoise = functools.partial(denoise_tv_bregman, weight=5, max_iter=10)

# use denoise_tv_bregman with weight and max_iter set:


denoise_plugin = Plugin(image_filter=denoise)




hth!

On Wed, Jan 28, 2015 at 9:59 PM, Marcel Gutsche <marcel.gutsche at gmail.com>
wrote:

> Hi everyone, 
> I'm working on an image processing project involving several consecutive 
> steps. For parameter optimization I would like to create a viewer plugin 
> which is capable to take these previous outputs into account. 
> So basically the introductory example found in the docs of 
> denoise_plugin = Plugin(image_filter=denoise_tv_bregman)
>   would be sufficient, if I could pass additional fixed arguments (like an 
> additional numpy array). 
> I hope I made myself clear, and someone can give me hint at where to look 
> at.
> Best regards, 
> Marcel  
> -- 
> 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 scikit-image+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150128/0d28d229/attachment.html>


More information about the scikit-image mailing list