This page provides everything you need for getting started with the
XStream® HDVR® WebSDK 2.0.
The XStream HDVR WebSDK adds a rich layer to the SDK Application Stack that provides a client-side JavaScript API for integrating the XStream HDVR rendering engine into your application. This platform provides rapid application development to create rich zero-download web applications across a variety of platforms and mobile devices (including iOS, Android, and Windows Phone platforms). XStream HDVR WebSDK runs on web browsers, tablets (via HTML5) or embedded inside native applications using a JavaScript container such as Electron or other native frameworks.
Recommended browsers include Chrome, Firefox, Microsoft Edge, IE11, IE10, and Safari (Mac). While the example applications are written in HTML5, the API does not explicitly require HTML5. The HTML4 IMG (image) tag may be used in place of the HTML5 Canvas tag.
To maximize your integration efforts, we recommend that you begin by browsing through the full contents of the XStream HDVR WebSDK Documentation, and don’t hesitate to contact a Fovia representative if you have any questions.
Be sure to copy your existing hdrclic.dat file into the foviaserver directory. If you require a license, please contact your Fovia representative for a new license file. The top-level directory contains one executable: FoviaLauncher.exe. This launches the XStream HDVR WebSDK server and adds a System Tray icon that provides access the system logging information, and to exit the application. It is important that XStream HDVR WebSDK server is always launched using the FoviaLauncher.exe since it manages multiple processes, which includes the foviaserver/foviawebsdk.exe process. To activate the XStream HDVR WebSDK server, the license file (hdrclic.dat) must be placed inside the foviaserver sub-directory. The contents of the file distribution are described below. The first time the application is run, the Windows Firewall may display a prompt to permit the WebSDK to access the network:
Click Allow Access and continue. Upon a successful launch of the XStream HDVR WebSDK server, enter localhost:8088/apps/hellofovia on your the browser on the system running the web server. If running on a separate server, replace localhost with your server IP address of the system running the XStream HDVR WebSDK server. Left and right-click mouse operations allow manipulation of the volume. If using a mobile device with this server, standard touch gestures are supported.
The API documentation can be found in XStream HDVR WebSDK Documentation.
For convenience, links to the web app's HTML file and JavaScript are provided, so you can quickly navigate to the source code. The
live URL assumes the server is running on the local machine. Otherwise, modify localhost to your server IP address running
the XStream HDVR WebSDK server.
There are several basic "HelloFovia" examples, each of which introduce new concepts to consider when constructing your applications. This includes JavaScript vs. TypeScript, Promises vs. standard JavaScript callbacks, HTML5 Canvas vs IMG tags, and comparison of using Fovia.UI.HTMLViewport vs. lower level API RenderEngine classes.
The following lines of code enable you to quickly add a live volume rendering window into any web page with the default bone preset. Default mouse and touch gestures adaptors are used. This is a good example for testing a standard color volume view on a mobile device. The minimal lines of HTML to display a Fovia enabled HTML5 canvase is:
Fovia WebSDK HelloFovia Demo
Fovia.FoviaAPI.requestServerConnection(function (err) { Fovia.ServerContext.loadDICOMDir('data/democases/DICOM2').then(function (volumeDataContext) { var foviaViewport = new Fovia.UI.HTMLViewport("fovia",window.innerWidth,window.innerHeight); foviaViewport.initAndRender(volumeDataContext).then(function () { });
}); });
The four lines of JavaScript do the real work. This uses the preferred design pattern of using Promises, rather than the classic
JavaScript callbacks. While the last parameter to all methods take an optional callback, in place of the Promise, the Promise
design pattern greatly simplifies the integration. Optional parameters take on default values and do not need
to be specified. More importantly, multiple asynchronous tasks can be done together, rather than daisy chained.
One of the subsequent examples shows how to use JavaScript callbacks if this design pattern is preferred.
Fovia.FoviaAPI.requestServerConnection(function(err)
Fovia.ServerContext.loadDICOMDir('democases/DICOM2').then(function(volumeDataContext) {
var foviaViewport = new Fovia.UI.HTMLViewport("fovia", window.innerWidth, window.innerHeight);
foviaViewport.initAndRender(volumeDataContext).then(function () {});
While the four lines of code are sufficient for a prototype, the example is expanded upon to show the additional suggested error checking.
View the source /foviaserver/public/apps/hellofovia/hellofoviaComplete.js
To run the example, in the URL localhost:8088/apps/hellofovia/hellofoviaComplete.html, change “localhost” to your server IP address, and enter the URL into your browser.
This is an example that shows the same code, but instead of using Promises, the last parameter is the callback. The API supports both Promises and callbacks. It should be noted that the Fovia API supports promises on older browsers, so there is no technical reason not to use the Promise design pattern.
View the source /foviaserver/public/apps/hellofovia/nopromise.js
To run the example, in the URL localhost:8088/apps/hellofovia/nopromise.html, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows the same code, but instead of using the HTML5 Canvas tag, it uses the IMG tag. The JavaScript code example code is identical, since the ID for both Canvas and IMG is the same. Internal to the Web SDK, a check is made to determine how to render the final bits onto the display surface.
View the source /foviaserver/public/apps/hellofovia/hellofovia.js
To run the example, in the URL localhost:8088/apps/hellofovia/img.html, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows the same code, but in TypeScript. For larger applications, the use of TypeScript along with the supplied foviaAPI.d.ts will enable early detection of error in JavaScript code through type checking. It also supports intellisense for JavaScript in supported IDE’s including Visual Studio Code and WebStorm.
View the source /foviaserver/public/apps/hellofovia/typescript.ts
To run the example, in the URL localhost:8088/apps/hellofovia/typescript.html, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to display a MIP view with an initial slab thickness of 0 (MPR). Default mouse and touch gestures adaptors are used except for scroll adaptor. This app uses a custom scroll adaptor written in TypeScript and transpiled to JavaScript. This shows the code to write a custom adaptor.
View the source /foviaserver/public/apps/hellofovia/mip.js
To run the example, in the URL localhost:8088/apps/hellofovia/mip.html, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to use the system presets. A single view is displayed. Press "p" to cycle thorugh the presets.
View the source /foviaserver/public/apps/hellofovia/preset.js
To run the example, in the URL localhost:8088/apps/hellofovia/preset.html, change “localhost” to your server IP address, and enter the URL into your browser.
Fovia.UI.HTMLViewport provides a higher level of abstraction, including rendering of data onto the display surface and handling of mouse and touch gestures. In some cases, customers may want to bypass this and go directly to the lower-level API. This example shows how to build a simple app (with more lines of code), by using createOctree, createRenerEngine, and directly interact with the HTML elements.
View the source /foviaserver/public/apps/hellofovia/lowlevel.js
To run the example, in the URL localhost:8088/apps/hellofovia/lowlevel.html, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to create a 2x2 layout, along with the following:
View the source /foviaserver/public/apps/cvr/cvr.js
To run the example, in the URL localhost:8088/apps/cvr/, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to create a 2x2 layout, with a sagittal, axial, and coronal orthogonal views, along with the following:
View the source /foviaserver/public/apps/mpr/mpr.js
To run the example, in the URL localhost:8088/apps/mpr/, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to create a 2x2 layout, and manipulate the sagittal, axial, and coronal oblique views. It also uses the TypeScript based custom scroll adaptor earlier used in hellofovia/mip app. It allows you to create linked oblique views and scroll them using the custom adaptor.
View the source /foviaserver/public/apps/oblique/oblique.js
To run the example, in the URL localhost:8088/apps/oblique/, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to create a basic interactive segmentaiton application. Select the region you wish to segment and do a right-click drag. As you drag up, the region of the segmentation will increase. Drag right and left to increase or decrease the threshold. Results of the segmentation are displayed, and updated in the linked viewports.
View the source /foviaserver/public/apps/segment/segment.js
To run the example, in the URL localhost:8088/apps/segment/, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to load polygon objects into a scene and move them around. Use right-click to rotate, shift-right-click to move, and ctrl-right-click to resize.
View the source /foviaserver/public/apps/polygon/polygon.js
To run the example, and enter one of the URLs into your browser and change “localhost” to your server IP address
Examples to run include:
This example shows how to crop and slab views, and update the linked viewports. It also shows option to pass on mouse events to registered mouse handler or intercept them using custom mouse handlers. The function call Fovia.UI.HTMLViewport.setOverrideTouchAdaptor usage is included in the app for this.
View the source /foviaserver/public/apps/slab/slab.js
To run the example, in the URL localhost:8088/apps/slab/, change “localhost” to your server IP address, and enter the URL into your browser.
This example shows how to load a custom dataset. In order for the app to run, the raw.zip should be unzipped. It is located under democases folder in your delivery.
View the source /foviaserver/public/apps/customload/customload.js
To run the example, in the URL localhost:8088/apps/customload/, change “localhost” to your server IP address, and enter the URL into your browser.
The examples\customfunctions directory provides an example to create a custom native data loader. Follow this example, and the MSDev project to build a DLL to utilize your own custom DICOM loader and will replace FoviaCustomFunctions.dll inside foviaserver\nodeaddons. It is important that the MSDev project is set to x64. This example DLL is used with the foviaserver/public/apps/customload example app.
The examples\electron directory contains the Electron app that launches an example through a cross-platform desktop applications framework using JavaScript, HTML, and CSS. Once the XStream HDVR WebSDK server is running, simply click on the Electron.bat file to run the example outside the web browser.
The examples\staticpage directory contains an example static HTML page that can be launched from a local file system against the XStream HDVR WebSDK server running locally (localhost), rather than served up from the remote web server.
View the source example/staticpage/static.js To run the example, open up the following HTML page: /foviaserver/examples/staticpage/static.html in your browser.
The XStream HDVR WebSDK server can be easily configured to use SSL by updating the useSSL and nodePortSSL fields in the config/configuration.xml. As an example, when you change useSSL to 1 and restart the server and view the hellofovia app through a secure connection using a slightly modified example shown below.
View the source /foviaserver/public/apps/hellofovia/hellofoviassl.js
To run the example, in the URL localhost:8088/apps/hellofovia/lowlevel.html, change “localhost” to your server IP address, and enter the URL into your browser.
In a production environment, replace the demo server.crt and server.keys that are provided in the foviaserver/ssl directory with your company's official certificate.
This example uses the basic hellowfovia.js example to illustrate the various settings and debugging options that is used to configure the XStream HDVR WebSDK server, either using the client-side API, or through the config/configuration.xml file.
Changes to any value requires a restart of the XStream HDVR WebSDK server. The supplied file includes the default values. These properties are set on a global server level, but can be specified "per application" if desired as shown in hellofovia/config.js.
The "urls" tag contains a list of strings (relative file paths) that will
be appended to foviaserver/public. XStream HDVR WebSDK binds the URL
to these directories. The ones provided match precisely with the
distribution’s foviaserver/public. The ":id" qualifier allows a default
"index.html" file to be specified. For example, /apps/hellofovia/:id allows
/apps/hellofovia/ to be mapped to /apps/hellofovia/hellofovia.html.
For production environments, only public visible directories should be
listed. Ensure that "/scripts/:id" is included since this is required
for internal purposes.
The Fovia.Logger package provides basic logging functionality that can be
configured in a similar manner to "log4j". In addition to controlling the
level of debugging (debug, info, warn, error) for what appears in the
browser console, all messages are also sent to the
foviaserver/log/foviaServer_ddmmyyyy_hhmmss.log file.
View the source /foviaserver/public/apps/hellofovia/config.js
To run the example, in the URL localhost:8088/apps/hellofovia/config.html, change “localhost” to your server IP address, and enter the URL into your browser.
-->
Generated using TypeDoc