Viewer Plugins -> Passing precalculated arguments

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

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@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@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
participants (2)
-
Juan Nunez-Iglesias
-
Marcel Gutsche