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

Provide better access to local ImageJ2 installation #89

Merged
merged 10 commits into from
Aug 16, 2022

Conversation

gselzer
Copy link
Collaborator

@gselzer gselzer commented Aug 5, 2022

This PR provides the ability for users to:

  1. Specify a local ImageJ2 installation instead of loading a stock ImageJ2 (which, if necessary, will be downloaded at the latest version)
  2. If possible (i.e. if PyImageJ can run interactively) show the ImageJ2 GUI.

image

Limitations:

  1. Spawning the ImageJ2 GUI and then proceeding to close that ImageJ2 GUI closes napari. More investigation needed into why it is happening. Ideally, ImageJ2's close button would just hide the ImageJ2 GUI, such that you can still make napari-imagej calls after you close the ImageJ2 GUI (and potentially reopen the GUI at a later point).
  2. It is difficult to share images between the ImageJ2 "head-ful" behavior and napari. For example, if you use a local Fiji installation, you will see the classic "Blobs" command, and you can run it to get the "Blobs" image. But that image is displayed in a new layer. I'd want to see it displayed in napari instead. I'm assuming we can accomplish this with some new Service implementation (right @ctrueden?), but I don't know which yet.
  3. There is no guarantee that any third-party plugins will actually work. For example, using my local Fiji installation will provide functionality like BigDataViewer to napari-imagej. Running BigDataViewer presents the startup screen, but pressing Browse to search for an XML file will freeze both the popup and napari more generally, requiring me to kill napari. Is there a way that we can disclaim the limitations of third-party plugins if we can't support all of them?

TODO:

  • Test that we can specify a local Fiji installation in pytest
  • Ensure that "interactive" mode is used on Windows and Linux, but not on Mac
  • Make it clear why the ImageJ2 GUI button is disabled only on Mac.

Closes both #16 and #43

@gselzer gselzer added the enhancement New feature or request label Aug 5, 2022
@gselzer gselzer added this to the 0.2.0 milestone Aug 5, 2022
@gselzer gselzer requested a review from ctrueden August 5, 2022 17:12
@gselzer gselzer self-assigned this Aug 5, 2022
@gselzer gselzer linked an issue Aug 5, 2022 that may be closed by this pull request
@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch 21 times, most recently from 3014591 to 16ff442 Compare August 10, 2022 19:26
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2022

Codecov Report

Merging #89 (40f3620) into main (14ff815) will decrease coverage by 0.87%.
The diff coverage is 85.02%.

@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   93.36%   92.48%   -0.88%     
==========================================
  Files          15       17       +2     
  Lines        2501     2849     +348     
==========================================
+ Hits         2335     2635     +300     
- Misses        166      214      +48     
Impacted Files Coverage Δ
src/napari_imagej/_module_utils.py 90.35% <0.00%> (+0.64%) ⬆️
src/napari_imagej/widget_IJ2.py 83.94% <83.94%> (ø)
tests/test_IJ2GUIWidget.py 84.43% <84.43%> (ø)
src/napari_imagej/setup_imagej.py 95.74% <90.47%> (-0.44%) ⬇️
src/napari_imagej/widget.py 84.72% <100.00%> (+0.21%) ⬆️
tests/conftest.py 100.00% <100.00%> (ø)
tests/test_ImageJWidget.py 98.67% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch 3 times, most recently from 9692ef5 to 775b104 Compare August 10, 2022 19:58
@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch 3 times, most recently from e27ab3d to 07c7b43 Compare August 15, 2022 13:56
This commit squashed many WIP commits made during the development of
this functionality. The main developments of this commit:
* The ability to provide a local ImageJ2 installation instead of using a
fresh installation
* The ability to show the ImageJ(2) GUI to perform a bunch of ImageJ
stuff at once
* Buttons to transfer napari layers to/from ImageJ2
@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch 3 times, most recently from 3c5da59 to 933f874 Compare August 15, 2022 14:57
@gselzer gselzer marked this pull request as ready for review August 15, 2022 15:01
@gselzer
Copy link
Collaborator Author

gselzer commented Aug 15, 2022

TODO before merge:

  • Add documentation for what happens when ImageJ2 GUI is closed
  • Add issue for fixing ImageJ2 GUI post close disabling napari-imagej.
  • Move settings.yml to a user-space config directory. Ideally we could lean on a library for this. Make an issue for this and solve it there.
  • Also mention the scripts folder. That should be a setting too.
  • Remove the ImageJ UI widget, and squish it into the main widget.

@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch 6 times, most recently from 3db0b83 to 40f3620 Compare August 16, 2022 13:42
Now, starting up the buttons DOESN'T block until ImageJ is ready!

Also, we switch to icons only since it's more napari-like
Well, sometimes. What I've actually done is provide a setting that lets
the user choose whether to just use the active layer or to prompt the
user to choose the layer to be transferred.

I figured this was the best middle ground between the two, especially
since I had implementations of both coded.
We'll just squish the ImageJ2 GUI stuff into the main widget
@gselzer gselzer force-pushed the 16-allow-users-to-specify-their-imagej-distribution branch from e65000b to 17f87d8 Compare August 16, 2022 14:30
@gselzer gselzer merged commit 17712f5 into main Aug 16, 2022
@gselzer gselzer deleted the 16-allow-users-to-specify-their-imagej-distribution branch August 16, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to specify their ImageJ distribution
2 participants