itk-wasm
itk-wasm copied to clipboard
Add ImJoy reference example
CC @oeway
What kind of example do you have in mind? Maybe examples about support file IO and image processing for other ImJoy plugins?
Or perhaps we can even combine this with itk-vtk-viewer, say, a plugin to process images with itk.js, and another one with UI to call the process function and use the viewer to display.
This is a quick example for exposing an imread function implemented with itk.js:
<config lang="json">
{
"name": "Itk.js Example",
"type": "iframe",
"tags": [],
"ui": "",
"version": "0.1.0",
"cover": "",
"description": "An example for reading image file with itk.js",
"icon": "extension",
"inputs": null,
"outputs": null,
"api_version": "0.1.8",
"env": "",
"permissions": [],
"requirements": ["https://unpkg.com/[email protected]/umd/itk.js"],
"dependencies": []
}
</config>
<script lang="javascript">
class ImJoyPlugin {
async setup() {
api.log('plugin initialized')
}
imread(file){
return itk.readImageFile(null, file)
.then(({ image: itkImage, webWorker }) => {
webWorker.terminate()
return Promise.resolve(itkImage)
})
.catch(error => {
reject(error)
})
}
}
api.export(new ImJoyPlugin())
</script>
Also, how do you want to show it on the itk-js website? Optionally, we can also load the imjoy core to your docs website for the demo.
What kind of example do you have in mind? Maybe examples about support file IO and image processing for other ImJoy plugins?
Or perhaps we can even combine this with itk-vtk-viewer, say, a plugin to process images with itk.js, and another one with UI to call the process function and use the viewer to display.
Yes, yes, and yes :-D
This is a quick example for exposing an imread function implemented with itk.js:
Thanks!
Also, how do you want to show it on the itk-js website? Optionally, we can also load the imjoy core to your docs website for the demo.
I am thinking about some Markdown and code description along with an iframe embedded version of the app stored in the examples directory on this page:
https://insightsoftwareconsortium.github.io/itk-js/examples/
For the itk-wasm CLI we now have a bindings subcommand. We should generate an ImJoy WebWorker plugin. This plugin would use the jsDelivr deployed JS bindings.