Open GenevieveBuckley opened 1 year ago
One specific example of a slow running process is slice interpolation, where writing new label data to the zarr file on disk can be time consuming https://github.com/jni/zarpaint/pull/32. Adding asynchronous behaviour to this would be a good follow up PR.
However I wanted this issue to be broader than just that one example. It would be good to identify all the places where this might be a helpful pattern to use.
Because zarpaint handles large datasets, some of the computations can be long running. Making these tasks asynchronous would improve useability, since the napari viewer would no longer freeze until the computation is complete.
A solution could be to use the napari
@thread_worker
decorator, ideally in combination with a progress bar so the user will know when the computation is complete.The napari threading guide shows this example:
And Talley explains several different ways to update the progress bar from a thread worker in this thread on forum.sc: