Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add progress indicator of cellpose segmentation #8

Closed

Conversation

psobolewskiPhD
Copy link
Contributor

I was recently looking into this in the original cellpose-napari plugin
MouseLand/cellpose-napari#33
so I thought I'd see about implementing something similar here.
I'm not sure it's the cleanest approach? But it does work for me locally.

@psobolewskiPhD
Copy link
Contributor Author

Sorry about the tests, I sort of forgot and then was distracted.
The threading stuff makes them tricky!
I had issues with the making and removing of the hard coded dirs—tests would just stall. Seems like using temp dirs resolved it. Hopefully it works on CI too.
Interesting that ubuntu works here, but fails on the cellpose-napari repo.

@guiwitz
Copy link
Owner

guiwitz commented Aug 15, 2022

Hi @psobolewskiPhD,

I just went ahead with fixes (because I had made recent changes) and didn't even say thanks for your contribution! I hadn't used threading in napari previously so it's also a great way for me to learn. Also using these temporary folders is probably cleaner than what I had.

I just have one point that worries be a bit. Thanks to threading the UI remains interactive. This means that while e.g. one image gets analyzed, one can switch to another image or even another dataset. Once the computation is done, then the segmentation can appear on a totally different dataset. Not sure how to handle that. Re-load the corresponding dataset once computation is done? Not displaying the result if the image/dataset has changed?

What I could imagine is for example use threading only for the batch case where we can skip entirely the display of the result, but keep the "blocking" case for the single image analysis.

Any thoughts ?

@psobolewskiPhD
Copy link
Contributor Author

I just have one point that worries be a bit. Thanks to threading the UI remains interactive. This means that while e.g. one image gets analyzed, one can switch to another image or even another dataset. Once the computation is done, then the segmentation can appear on a totally different dataset. Not sure how to handle that. Re-load the corresponding dataset once computation is done? Not displaying the result if the image/dataset has changed?

This is a really good point.
To be honest, I didn't consider this. I was just mimicking the behavior of the cellpose-napari code, where they were already using thread_worker so adding progress to that to show a busy signal was easy.
Checking that plugin: indeed while a segmentation is running you can delete the image, change parameters, and the process completes. In the release version there is no indicator of anything happening, so it's even more confusing.
I mean that's sort of the point of the thread_worker, to not block the UI, but maybe it's not a big advantage here? On the other hand, for the batch processing, if everything is sent to a file and read back from a file, then maybe it's fine to be able to interact with napari?

BTW not sure what's going on with the macOS tests. I thought I had resolved the stalling locally by changing the file IO. But maybe I missed something.

@psobolewskiPhD
Copy link
Contributor Author

So the stalled macOS tests might have something to do with progress=True. Just adding that makes tests stall out on macOS in the cellpose-napari repo too:
MouseLand/cellpose-napari#33
🤯

@psobolewskiPhD
Copy link
Contributor Author

This is pretty old and I'm not sure the threading approach is the way to go. I will try something else hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants