OHIF Plugin for The Visualization Toolkit (VTK)
- Load the OHIF Viewer on a study
- Paste the following into your JavaScript console to define the plugin and load the scripts.
var plugin = {
name: "VolumeRenderingPlugin",
url: "https://cdn.rawgit.com/OHIF/VTKPlugin/master/volumeRendering/main.js",
allowCaching: false,
moduleURLs: [
"https://cdn.rawgit.com/OHIF/VTKPlugin/master/lib/index.js",
],
scriptURLs: [
'https://unpkg.com/vtk.js',
]
};
OHIF.plugins.OHIFPlugin.reloadPlugin(plugin);
- Switch a viewport to use the plugin by specifying its viewport index:
OHIF.plugins.VolumeRenderingPlugin.setViewportToPlugin(0)
This will install a local copy of the OHIFViewer and let you run a server that can be used for plugin development.
You will get:
- a local scratch copy of the OHIF StandaloneViewer running on port 3000
- a web server to serve your plugin code on port 8000
- sample data from the links below will be pulled from public data stored on Amazon S3
- Run on a linux/mac environment with bash (windows not supported or tested)
- All the things needed to build OHIFViewers
- http-server
- Create a copy of the OHIF Standalone Viewer Meteor app (i.e. not built into a static site yet)
./setupDevSite.sh
- Install an HTTP server which supports CORS:
# If you get some EACCESS errors, use sudo.
npm install http-server -g
- Start the HTTP server with CORS enabled
- You will see some logs in your console whenever requests reach your server at http://localhost:8000
- This serves the plugin directory itself, so any changes you make to the plugin are instantly available.
http-server -p 8000 --cors
- Open another terminal tab and start the Standalone Viewer.
./startDevSite.sh
- This version of the StandaloneViewer has some scripts copied into it which enable the MultiplanarReformatting and VolumeRendering plugins by default.
- Note: If you change anything in these scripts, you will need to run
setupDevSite.sh
again.
- Test the installation by loading one of the following URLs: