Created
December 21, 2016 22:55
-
-
Save petebankhead/6838b00a90ba168b9464717d71c221b6 to your computer and use it in GitHub Desktop.
Launching QuPath from within Fiji... sort of (it only partly works)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change this to reflect the path to QuPath! | |
// Here, I'm using a Mac. | |
// Note: I copied all native libraries (*.dylib, *.jnilib) into Fiji.app/lib/macos so that they could be found. | |
def pathQuPath = "/Users/pete/Desktop/QuPath.app/Contents/Java/" | |
// Get the Groovy classloader | |
def cl = this.class.classLoader | |
// Figure out where the main QuPath Jars are to be found | |
def dirBase = new File(pathQuPath) | |
def dirs = [new File(dirBase, "jars"), new File(dirBase, "qupath")] | |
// Add the most important QuPath Jars to the classpath, skipping ImageJ | |
cl.addURL(new File(dirBase, "QuPathApp.jar").toURL()) | |
for (def dir in dirs) { | |
for (def f in dir.listFiles()) { | |
String name = f.getName() | |
if (f.isFile() && name.endsWith(".jar")) { | |
if (!name.startsWith("ij")) | |
cl.addURL(f.toURL()) | |
} | |
} | |
} | |
cl.clearCache() | |
print(cl.getClassPath()) | |
// Launch QuPath | |
def cls = Class.forName("qupath.QuPath").main(new String[0]); | |
// Install the ImageJ plugins (this doesn't work...) | |
ij.Menus.installPlugin("qupathj.QUPath_Send_ROI_to_QuPath", ij.Menus.PLUGINS_MENU, "Send ROI to QuPath", "", ij.IJ.getInstance()); | |
ij.Menus.installPlugin("qupathj.QUPath_Send_Overlay_to_QuPath", ij.Menus.PLUGINS_MENU, "Send Overlay to QuPath", "", ij.IJ.getInstance()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment