Image viewer plugins - multiple parameters from different functions
Hi folks, kind of a follow up question of my last one (see here <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA>). <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA> I still have a chain of image processing tasks, which I want to visualize with the image viewer. Certain parameters should be changed on the fly, where i can see the results in the image viwer immediately by the use of plugins. Something like this basically: a, b = previous_function(image, parameter1 = 0.002 parameter = 0.02) new_image = next_function(image, a, b, another_parameter = 3) I managed to pass the values a and b, generated by a previous function using Juan's hint with functools. next_function which was fine as long as I don't want to change parameter1 and parameter2 interactively. What do I do now, when I want to change them? Using functools here won't get me far, since now I want to be able to change parameter1 and parameter2 with a slider, as well as another_parameter. Maybe there is still a way to achive this, I saw something like a callback argument for the widgets, but I am not sure how to use them or whether they are related to my problem at all. I would also be fine with writing my own Plugin class, but could not get my head around the given examples. I feel that something like this is quite common, so I hope there are already ways to achieve this. Thanks a lot for the great work, Marcel
Hi Marcel, I'm guessing you only need to see the final output of the pipeline? Why not define your own function? def piped(image, parameter1, parameter, another_parameter): a, b = previous_function(image, parameter1, parameter) new_image = next_function(image, a, b, another_parameter) return new_image Then use that in your plugin? Juan. On Thu, Jan 29, 2015 at 7:58 PM, Marcel Gutsche <marcel.gutsche@gmail.com> wrote:
Hi folks, kind of a follow up question of my last one (see here <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA>). <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA> I still have a chain of image processing tasks, which I want to visualize with the image viewer. Certain parameters should be changed on the fly, where i can see the results in the image viwer immediately by the use of plugins. Something like this basically: a, b = previous_function(image, parameter1 = 0.002 parameter = 0.02) new_image = next_function(image, a, b, another_parameter = 3) I managed to pass the values a and b, generated by a previous function using Juan's hint with functools. next_function which was fine as long as I don't want to change parameter1 and parameter2 interactively. What do I do now, when I want to change them? Using functools here won't get me far, since now I want to be able to change parameter1 and parameter2 with a slider, as well as another_parameter. Maybe there is still a way to achive this, I saw something like a callback argument for the widgets, but I am not sure how to use them or whether they are related to my problem at all. I would also be fine with writing my own Plugin class, but could not get my head around the given examples. I feel that something like this is quite common, so I hope there are already ways to achieve this. Thanks a lot for the great work, 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.
Hi Juan, thanks for the hint. That could work, but i forgot to mention, that the previous function is quite expensive to compute, so I would like to update the first one only, if the slider for its parameter is touched. Right now i try to reduce the amount of recomputations with memoization using the joblib module, but I think I need a while to figure out when exactly values are cached. Marcel Am Donnerstag, 29. Januar 2015 12:01:14 UTC+1 schrieb Juan Nunez-Iglesias:
Hi Marcel,
I'm guessing you only need to see the final output of the pipeline? Why not define your own function?
def piped(image, parameter1, parameter, another_parameter): a, b = previous_function(image, parameter1, parameter) new_image = next_function(image, a, b, another_parameter) return new_image
Then use that in your plugin?
Juan.
On Thu, Jan 29, 2015 at 7:58 PM, Marcel Gutsche <marcel....@gmail.com <javascript:>> wrote:
Hi folks,
kind of a follow up question of my last one (see here <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA>). <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA> I still have a chain of image processing tasks, which I want to visualize with the image viewer. Certain parameters should be changed on the fly, where i can see the results in the image viwer immediately by the use of plugins. Something like this basically:
a, b = previous_function(image, parameter1 = 0.002 parameter = 0.02) new_image = next_function(image, a, b, another_parameter = 3)
I managed to pass the values a and b, generated by a previous function using Juan's hint with functools.
next_function
which was fine as long as I don't want to change parameter1 and parameter2 interactively. What do I do now, when I want to change them?
Using functools here won't get me far, since now I want to be able to change parameter1 and parameter2 with a slider, as well as another_parameter.
Maybe there is still a way to achive this, I saw something like a callback argument for the widgets, but I am not sure how to use them or whether they are related to my problem at all. I would also be fine with writing my own Plugin class, but could not get my head around the given examples. I feel that something like this is quite common, so I hope there are already ways to achieve this.
Thanks a lot for the great work, 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...@googlegroups.com <javascript:>. For more options, visit https://groups.google.com/d/optout.
Marcel, It sounds like you want use IPython traitlets <http://ipython.org/ipython-doc/dev/api/generated/IPython.utils.traitlets.htm...>, something like: from IPython.utils.traitlets import HasTraits, Float, on_trait_change, Anyfrom skimage.viewer import ImageViewer class Pipeline(HasTraits): param1 = Float(0.1) param2 = Float(0.2) param3 = Float(0.3) viewer = Any @on_trait_change('param1, param2') def use_previous_function(self): # do something with previous function @on_trait_change(''param3') def use_next_function(self): # do something with next function v =ImageViewer(...) p = Pipeline(viewer=v) On Thursday, January 29, 2015 at 8:35:21 AM UTC-6, Marcel Gutsche wrote: Hi Juan,
thanks for the hint. That could work, but i forgot to mention, that the previous function is quite expensive to compute, so I would like to update the first one only, if the slider for its parameter is touched. Right now i try to reduce the amount of recomputations with memoization using the joblib module, but I think I need a while to figure out when exactly values are cached.
Marcel
Am Donnerstag, 29. Januar 2015 12:01:14 UTC+1 schrieb Juan Nunez-Iglesias:
Hi Marcel,
I'm guessing you only need to see the final output of the pipeline? Why not define your own function?
def piped(image, parameter1, parameter, another_parameter): a, b = previous_function(image, parameter1, parameter) new_image = next_function(image, a, b, another_parameter) return new_image
Then use that in your plugin?
Juan.
On Thu, Jan 29, 2015 at 7:58 PM, Marcel Gutsche <marcel....@gmail.com> wrote:
Hi folks,
kind of a follow up question of my last one (see here <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA>). <https://groups.google.com/forum/#%21topic/scikit-image/WXrwvxFd8xA> I still have a chain of image processing tasks, which I want to visualize with the image viewer. Certain parameters should be changed on the fly, where i can see the results in the image viwer immediately by the use of plugins. Something like this basically:
a, b = previous_function(image, parameter1 = 0.002 parameter = 0.02) new_image = next_function(image, a, b, another_parameter = 3)
I managed to pass the values a and b, generated by a previous function using Juan's hint with functools.
next_function
which was fine as long as I don't want to change parameter1 and parameter2 interactively. What do I do now, when I want to change them?
Using functools here won't get me far, since now I want to be able to change parameter1 and parameter2 with a slider, as well as another_parameter.
Maybe there is still a way to achive this, I saw something like a callback argument for the widgets, but I am not sure how to use them or whether they are related to my problem at all. I would also be fine with writing my own Plugin class, but could not get my head around the given examples. I feel that something like this is quite common, so I hope there are already ways to achieve this.
Thanks a lot for the great work, 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...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
participants (3)
-
Juan Nunez-Iglesias
-
Marcel Gutsche
-
Steven Silvester