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

using python and 3d image #382

Open
Nal44 opened this issue Feb 6, 2024 · 12 comments
Open

using python and 3d image #382

Nal44 opened this issue Feb 6, 2024 · 12 comments

Comments

@Nal44
Copy link

Nal44 commented Feb 6, 2024

Hi,

I install all using python (3.10)

The widget launch, I select the image (tiff ) 3d,
then :

Downloading file 'vit_b_lm' from 'https://zenodo.org/records/10524791/files/vit_b_lm.pth?download=1' to 'C:\Users\m197816\AppData\Local\micro_sam\micro_sam\Cache\models'.
Precompute Image Embeddings: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 27/27 [02:14<00:00,  4.97s/it]
Traceback (most recent call last):
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\window.py", line 14, in <module>
    from napari._qt import Window
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\_qt\__init__.py", line 77, in <module>
    from napari._qt.qt_event_loop import get_app, gui_qt, quit_app, run
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\_qt\qt_event_loop.py", line 15, in <module>
    from napari._qt.dialogs.qt_notification import NapariQtNotification
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\_qt\dialogs\qt_notification.py", line 29, in <module>
    from napari._qt.qt_resources import QColoredSVGIcon
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\_qt\qt_resources\__init__.py", line 4, in <module>
    from napari._qt.qt_resources._svg import QColoredSVGIcon
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\_qt\qt_resources\_svg.py", line 8, in <module>
    from qtpy.QtSvg import QSvgRenderer
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\qtpy\QtSvg.py", line 13, in <module>
    from PyQt5.QtSvg import *
ImportError: DLL load failed while importing QtSvg: The specified procedure could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\m197816\.conda\envs\ucrosam38\Scripts\micro_sam.annotator-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\micro_sam\sam_annotator\annotator.py", line 506, in main
    annotator()
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\micro_sam\sam_annotator\annotator.py", line 492, in annotator
    annotator_3d(show_embeddings=False, **config_dict["args"])
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\micro_sam\sam_annotator\annotator_3d.py", line 302, in annotator_3d
    v.window.add_dock_widget(prompt_widget)
  File "C:\Users\m197816\.conda\envs\ucrosam38\lib\site-packages\napari\window.py", line 27, in __getattr__
    raise type(err)(
ImportError: An error occured when importing Qt dependencies.  Cannot show napari window.  See cause above

I remove and reinstalled pyqt but still ... same error .

Any ideas how to solve the problem ?

Thanks,

@constantinpape
Copy link
Contributor

This looks like some windows issue loading the DLLs.

I had a quick look at a related stack overflow: https://stackoverflow.com/questions/42863505/dll-load-failed-when-importing-pyqt5.

From browsing through this:

  • the easiest solution might be to just reboot your machine.
  • if that does not work: can you activate the conda environment and try to just start napari? Just type napari in the console and hit enter. Does that open the napari gui, or does it also throw an error?

@Nal44
Copy link
Author

Nal44 commented Feb 6, 2024

Napari runs when I launched it but the plugin is only available for embeddings (and cache), the dock widgets are not available.

I will reboot in a sec and let you know,

thanks a lot,

@constantinpape
Copy link
Contributor

I would suggest to use the dev branch instead: https://github.com/computational-cell-analytics/micro-sam/tree/dev
(Just switch to the branch where you cloned the git repo)

Then the plugins will be available in napari. (We will also release this version soon, but we need to document a bit more before this.)

@Nal44
Copy link
Author

Nal44 commented Feb 6, 2024

Ok great !

Super helpful :) , looking to use it a lot, especially for 3d nucleus, annotations are a pain and take forever using Labkit ...

My 3d model is pretty good but working to make a refined model, hence the idea to run inferences using my model then using your plugin for refinements, then training a refined model (if metrics are good) .

That will save me a lotttttttttttttttttttttttttttttttttttttt of time :)
thanks
antho

@Nal44
Copy link
Author

Nal44 commented Feb 6, 2024

I reboot my machine ,Error is gone :)

But using the point_prompts in 3d the automatic segmentation outputs are not great ...
Need to play around and understand how things work.

Thanks a lot :)

@Nal44
Copy link
Author

Nal44 commented Feb 6, 2024

To give you an idea using positive / negative prompts
with the initial parameters

thanks

example

@Nal44
Copy link
Author

Nal44 commented Feb 6, 2024

Thinking, do images needs any pre -filters ? something to normalize the images or else ?
I have the same using a 2d image ... (DAPI staining) ?
Thanks

@GenevieveBuckley
Copy link
Collaborator

I've always had better results with the box prompts, than the point prompts. Maybe you could try that?

@constantinpape
Copy link
Contributor

constantinpape commented Feb 7, 2024

To give you an idea using positive / negative prompts
with the initial parameters

These are way too many points. You need to give point prompts object by object when you use the annotator. Please watch the video for seeing how to use it: https://www.youtube.com/watch?v=ket7bDUP9tI&list=PLwYZXQJ3f36GQPpKCrSbHjGiH39X4XjSO&index=1

(And if you want to segment multiple objects at a time you can use box prompts, it's also shown in the video)

@Nal44
Copy link
Author

Nal44 commented Feb 7, 2024

Ok thanks,

Seems ok in 3D, but the masks diffuse too much on the out of focus (mask are getting larger toward the end / beginning),
Once i found out how to reduce the diffusion , then it will be useful :).

Does the automatic segmentation is available in 3D or not yet ?
Or I need to do one by one ?

Thanks a lot,
antho

@constantinpape
Copy link
Contributor

Seems ok in 3D, but the masks diffuse too much on the out of focus (mask are getting larger toward the end / beginning),
Once i found out how to reduce the diffusion , then it will be useful :).

Ok, thanks for the feedback! Will follow up on this next week. (We have seen this issue to, it should be possible to fix it by updating some parameters, will share details as soon as I can).

Does the automatic segmentation is available in 3D or not yet ?
Or I need to do one by one ?

It's implemented, but there are different versions of this and not everything is fully tested. I will follow up next week.

@Nal44
Copy link
Author

Nal44 commented Feb 13, 2024

Thanks, looking for the update :)
Enjoy your time off :D ,

great support !
antho

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

No branches or pull requests

3 participants