napari / napari-core

BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

GPU powered functions as 'hot replacements' or 'overlays' for basic numpy operations #19

Open royerloic opened 6 years ago

royerloic commented 6 years ago

Would be great to have a mechanism for a plugin to 'hot replace' certain functions of other plugins.

For example, let's say we have the 'numpy' plugin that would encapsulate basic numpy array operations, such as the operation 'add-two-arrays'. Now, imagine we we want to have another plugin that would provide an accelerated implementation using the GPU. We need a mechanism to 'overlay' a function with another one. If there is a problem with the overlaid function, for example there is no GPU, it would call the original function.

Alternatively, we can also have a different entry in the menu for that operation, but I would like to avoid the menu mess that is seen in other tools. Also, the advantage of functional 'overlays' is that any other plugin using that function would be accelerated too.

ctrueden commented 6 years ago

FWIW, that kind of "function overloading on steroids" or "extensible case logic" is the primary design idea behind ImageJ Ops.