Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Bio-Formats to a SciJava Jupyter notebook
#@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")
@ctrueden

This comment has been minimized.

Copy link
Owner Author

@ctrueden ctrueden commented Jun 22, 2017

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. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.