Last active
January 13, 2020 09:26
-
-
Save ctrueden/c26b1eb592db2897ab1061031e726620 to your computer and use it in GitHub Desktop.
Add Bio-Formats to a SciJava Jupyter notebook
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
#@ImageJ ij | |
// -- Functions -- | |
registerAndCreatePlugin = { pluginClass, pluginType -> | |
info = new org.scijava.plugin.PluginInfo(pluginClass, pluginType) | |
ij.plugin().addPlugin(info) | |
ij.plugin().createInstance(info) | |
} | |
registerService = { serviceClass -> | |
service = registerAndCreatePlugin(serviceClass, org.scijava.service.Service.class) | |
ij.context().getServiceIndex().add(service) | |
} | |
// -- Add Bio-Formats support -- | |
#@repository("https://maven.imagej.net/content/groups/public") | |
#@dependency(group = "io.scif", module = "scifio-bf-compat", version = "2.0.3") | |
#@dependency(group = "ome", module = "formats-gpl", version = "5.5.2") | |
registerService(io.scif.ome.services.DefaultOMEXMLService.class) | |
bff = registerAndCreatePlugin(io.scif.bf.BioFormatsFormat.class, io.scif.Format.class) | |
ij.scifio().format().addFormat(bff) | |
// -- Load something! -- | |
myAwesomeData = ij.io().open("/path/to/myAwesomeImageThatOnlyBioFormatsCanRead") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above snippet should work for SciJava Jupyter Kernel version 0.4.0.
Future versions of the kernel will improve matters. If you are reading this and the date stamp above is old, please be aware that this gist has probably become obsolete. :-)