Skip to content

Conversation

petebankhead
Copy link
Member

@petebankhead petebankhead commented Dec 12, 2024

PR drawing heavily on @ctrueden's work - especially https://forum.image.sc/t/embedding-fiji-inside-qupath/105065

This adds support for launching QuPath from gradle with

gradlew run -Pfiji=true

to bring in Fiji & its dependencies in a way that makes it possible to work with a 'full' version of Fiji from within QuPath, rather than ImageJ. Using

gradlew run

defaults to 'regular' QuPath with ImageJ.

It's also possible to build the (large) self-contained packages with

gradlew jpackage -Pfiji=true

or, faster with

./gradlew jpackage -x generateLicenseReport

at the expense of omitting the dependency license report.

We don't have plans to distribute a QuPath+Fiji build at the moment - rather, this is intended for power-users who create the builds themselves for their own use. Although with Gradle that should be pretty easy, as long as you have Java 17+ installed (Java 21 preferred).

Big caveat

It's currently only possible to launch Fiji once from within QuPath: if you close it, then the next time you try to open it you'll get a more standard ImageJ without many extra plugins. I haven't figured out how to get Fiji back, or to prevent it being disposed in the first place. Reopening Fiji should now work

Small caveats

Dependency resolution is left up to Gradle; it's not guaranteed that QuPath will behave identically when launching in this way - and there might be commands in either Fiji or QuPath that don't work as expected.

Although that also means that QuPath's script editor will auto-discover and add support for a few more scripting languages.
And Fiji's will be equipped with Groovy 4 instead of Groovy 3.

Provisional (limited) support for including Fiji dependencies when calling `gradlew run`
This made it impossible to build with a different Java version.
Now it should build using Java 17 or later (Gradle itself requests 16 or later, so we strengthen this to 17 so we can use the newer syntax)
Setting scripting-groovy to version 1.0.0 turned out to be the key step.
Switching to 3 wasn't an option, because it needed to be 3.0.4 and it seemed unhappy with Java 21.
@petebankhead petebankhead added this to the v0.6.0 milestone Dec 12, 2024
Don't require `-Pfiji=true` for Fiji-friendly builds
Hides the window, but avoids disposing the instance; this makes it possible to reopen Fiji without losing all the plugins.
This means you can open ImageJ without having to send an image to it
It was causing trouble with accelerators, and didn't show in the right place anyway
@petebankhead petebankhead marked this pull request as ready for review December 12, 2024 20:18
@petebankhead petebankhead merged commit b7c6b36 into qupath:main Dec 13, 2024
3 checks passed
@petebankhead petebankhead deleted the qupath-fiji branch December 13, 2024 06:25
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.

1 participant