VTKPlugin icon indicating copy to clipboard operation
VTKPlugin copied to clipboard

OHIF Plugin for The Visualization Toolkit (VTK)

OHIF VTK Plugin

Usage

OHIF Plugin for The Visualization Toolkit (VTK)

  1. Load the OHIF Viewer on a study
  2. 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);
  1. Switch a viewport to use the plugin by specifying its viewport index:
OHIF.plugins.VolumeRenderingPlugin.setViewportToPlugin(0)

Development

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

Prerequisites

  • Run on a linux/mac environment with bash (windows not supported or tested)
  • All the things needed to build OHIFViewers
  • http-server
  1. Create a copy of the OHIF Standalone Viewer Meteor app (i.e. not built into a static site yet)
./setupDevSite.sh
  1. Install an HTTP server which supports CORS:
# If you get some EACCESS errors, use sudo.
npm install http-server -g
  1. 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
  1. 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.
  1. Test the installation by loading one of the following URLs: