Getting Started
Medical image processing and visualization in the browser via WebAssembly.
The ImFusion Web SDK provides medical image processing and visualization capabilities in the browser via WebAssembly.
Installation
Install the SDK from npm:
Quick Start
Add a canvas element to your HTML:
Then initialize the SDK:
Load and visualize data:
See InitOptions for more initialization options, and ImFusion for the main API.
Loading Data
You can load data into the SDK module directly from an ArrayBuffer:
There are also helper function to load file(s) from other sources:
The following image and geometry/mesh formats are supported:
DICOM, NIFTI, PNG, OBJ, PLY, STL, OFF, ImFusionFile
Creating Images Programmatically
React Integration
The @imfusion/sdk-react package provides React components and hooks for integrating the ImFusion Web SDK into React applications.
Install both packages in your React application:
Start by wrapping your app with ImFusionProvider, rendering an ImFusionCanvas, and using the ready/loading/error components to handle SDK initialization:
For loading data, use useDataLoader:
For the full list of hooks and components, see the @imfusion/sdk-react module documentation.
Using Raw Bindings
The ImFusion Web SDK has two layers: C++ bindings compiled to WebAssembly, and a TypeScript wrapper that simplifies common tasks.
Wrapper
A high-level TypeScript API around the C++ bindings. Provides init which returns an ImFusion instance with convenience methods for loading and displaying data, automatic DPI scaling, input handling, and more.
C++ Bindings
The direct C++ functionality exposed to JavaScript. Use this when you need functionality not available on the ImFusion interface. You can access it directly via imf.bindings: