ImJoy:增强数据科学的交互性和可扩展性!
ImJoy 是一个插件驱动的混合计算平台,用于配置深度学习应用程序,例如高级图像分析工具。
ImJoy项目于2018年在巴斯德研究所启动,目前由欧阳伟(斯德哥尔摩SciLifeLab & KTH)领导的ImJoy团队积极改进和维护。该团队由来自不同机构成员的组成,他们每周见面,不断改进软件并扩展插件生态系统。
包含最新文档的完整详细信息可在 https://imjoy.io/docs处获取。
开始使用
ImJoy 是一款渐进式 Web 应用程序,您无需安装即可直接在浏览器中运行。转到https://imjoy.io并点击“启动 ImJoy”。
ImJoy 也可以直接嵌入到文档中,例如,如果单击“运行”,您将看到相同的 ImJoy 界面:
api.createWindow({src: 'https://imjoy.io/#/app', passive: true})
由于ImJoy本身不提供任何功能插件,因此对于任何实际应用,您都需要使用相应的插件。例如,如果您单击下面的“运行”,您将看到一个演示插件,该插件使用在浏览器中运行的轻量级深度学习模型进行图像分类:
api.createWindow({src: 'https://github.com/imjoy-team/imjoy-plugins/blob/-/repository/HPA-Classification.imjoy.html'})
有关更多插件示例,请查看gallery。
ImJoy 插件开发
ImJoy 插件可以作为单个文本文件 (*.imjoy.html) 或托管在其他地方的 Web URL 提供。 构建 ImJoy 最常见的方法是提供插件文件。
这是 ImJoy 的基本插件文件:
<config lang="json">
{
"name": "Pokémon Chooser",
"type": "web-worker",
"tags": [],
"ui": "",
"version": "0.1.0",
"cover": "",
"description": "This is a demo plugin for choosing Pokémons",
"icon": "extension",
"inputs": null,
"outputs": null,
"api_version": "0.1.8",
"env": "",
"permissions": [],
"requirements": [],
"dependencies": []
}
</config>
<script lang="javascript">
class ImJoyPlugin{
async setup(){
await api.log("plugin initialized")
}
async choosePokemon(){
const pokemon = await api.prompt("What is your favorite Pokémon?", "Pikachu")
await api.showMessage("Your have chose " + pokemon + " as your Pokémon.")
}
async run(ctx){
await this.choosePokemon()
}
}
api.export(new ImJoyPlugin())
</script>
如果您有兴趣学习如何开发 ImJoy 插件,我们推荐我们为 I2K 会议制作的教程:https://imjoy.io/docs/#/i2k_tutorial。这是一个交互式文档,您可以在其中逐步进行操作。
开放集成
我们使命的一部分,我们尝试通过将现有和未来的软件工具与ImJoy RPC protocol连接起来。这不仅作为在内部用于连接相同工作流程中的插件,而且还提供了一种将其他软件工具集成到相同工作流程中的方法,或者将 ImJoy 插件系统引入网站、在线数据存储库、Web 应用程序和其他软件工具。
我们支持所有集成:1)将现有的网络应用程序或软件工具连接为 ImJoy 插件 2)将 ImJoy 核心集成到其他网站或软件工具。更多实施细节请参阅integration docs。
以下是集成示例列表:
在 ImageJ wiki 中运行 ImJoy 插件
作为开放集成的另一个示例,可以在 ImageJ wiki 中实现 ImJoy。在任何 Markdown 页面中,您可以通过以下方式轻松将 Markdown 代码块转换为执行和可编辑的代码块:
- 在 Markdown 文件的元数据中将
"imjoy"添加到extensions(也称为 Front Matter); - 在代码块之前添加注释
<!-- ImJoyPlugin: { ... } -->。在{}内,您可以提交用于设置 ImJoy 插件的设置。
例如,您的页面开头可能有以下内容:
---
title: My Awesome Page
extensions: ["imjoy"]
---
在您的页面中,使用上述设置来承载以下带有“运行”按钮的代码块:
api.alert("Hello from ImJoy!")
下面是对应的markdown代码:
<!-- ImJoyPlugin: { "type": "web-worker","editor_height": "200px"} -->
```js
api.alert("来自 ImJoy 的问候!")
```
您还可以将插件窗口嵌入到页面中:
api.createWindow({src: "https://hms-dbmi.github.io/vizarr", name: "Vizarr Demo"}).then((viewer)=>{
viewer.add_image({source: "https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/4495402.zarr", name: "Demo Image"})
})
或者显示一个弹出对话框:
api.showDialog({src: "https://hms-dbmi.github.io/vizarr", name: "visualizating HCS zarr images with vizarr"}).then((viewer)=>{
viewer.add_image({source: "https://minio-dev.openmicroscopy.org/idr/idr0001-graml-sysgro/JL_120731_S6A/pr_45/2551.zarr", name: "Demo Image"})
})
您还可以运行其他插件类型,包括将通过 mybinder.org 执行的 Python 插件。
from imjoy import api
类 ImJoyPlugin():
async def setup(self):
pass
async def choosePokemon(self):
pokemon = await api.prompt("What is your favorite Pokémon?", "Pikachu")
await api.showMessage("Your have chose " + pokemon + " as your Pokémon.")
async def run(self, ctx):
await self.choosePokemon()
api.export(ImJoyPlugin())
As a more useful demoo, the following code load an pixel classifier plugin for interactive image segmentation with scikit-image and scikit-learn. (Please note that it can take a few minutes to run for the first time.)
api.getPlugin({src: 'https://github.com/imjoy-team/imjoy-plugins/blob/-/repository/PixelClassifier.imjoy.html'}).then((插件)=>{
plugin.run()
})
For more detailed usage, please refer to ImJoy Docs.
Running ImageJ.JS in ImageJ wiki
ImageJ.JS is a web version of ImageJ, and it can be used as an ImJoy plugin and embeded directly in the ImageJ wiki. For more details, please refer to the ImageJ.JS page.
Documentation
Full documentation can be found at https://imjoy.io/docs/
Publication
- Ouyang, W., Mueller, F., Hjelmare, M. et al. ImJoy: an open-source computational platform for the deep learning era. Nature Methods (2019), https://doi.org/10.1038/s41592-019-0627-0, free access
Code of Conduct
Help us keep the ImJoy community open and inclusive. Please read and follow our Code of Conduct.