DICOM 3D Volume Render — SAM2 / MedSAM Segmentation

by Jonathan Colledge
Home Back to Calculators
🔒 Every DICOM stays in your browser — segmentation and 3D rendering run client-side (WebGPU / WASM / WebGL2) and nothing is uploaded.
⚠ Not for clinical use. Segmentations and renders require verification.
Load a study to begin
working…
Coverage per slice — one row per structure: solid = SAM keyframe, pale = region-grown. Click to jump.
Left-click a point on the structure · Right-click a point to exclude · Shift-drag a bounding box · Mouse-wheel / ↑ ↓ change slice · u undo point · Del remove keyframe · m alternative mask · n add structure.
Drag to rotate · wheel to zoom · double-click to reset
Structures in this render — colour, style & opacity
Auto renders air-filled structures (median HU below −500, e.g. tracheal lumen) as a translucent surface and everything else as a coloured volume. Change a structure to Surface or Volume to override. Air wall (tissue) replaces the crisp surface line with a wall: a shell of the tissue around the lumen, up to the chosen thickness, whose opacity follows that tissue’s real density — dense wall is opaque, low-density lung is see-through — so the wall varies in translucency instead of being one uniform sheet.
Scene
HU clear HU opaque
Loading Pyodide…

About this tool

Upload a CT series as a ZIP. The whole series is decoded in your browser into a Hounsfield-unit volume. Segment a structure by clicking on it with Segment Anything 2 or MedSAM (via transformers.js, WebGPU when available). That slice becomes a keyframe: the mask is then region-grown slice-to-slice through the stack in the direction you choose — each step tracks the structure by its Hounsfield range (re-estimated from the previous slice), confines it to a corridor around the previous outline, and lets a marker-controlled watershed on the image gradient place the boundary on the real edge. One slider controls how permissive that is. Add further SAM keyframes anywhere and the slices between two keyframes are filled — by region-growing from both ends, by interpolating one SAM outline into the other, or by a combination that uses the interpolated outline as a guide and lets the image refine its edge. Give each structure an upper and lower slice limit to stop growth where the structure ends. Add as many structures as you like, each with its own colour. Save progress writes your structures, SAM keyframes, limits and 3D settings to a small JSON file (no images, no patient name/ID); later, load the same CT series and that file — in either order, or dropped together — and carry on where you left off. The grown slices are re-grown from your keyframes, and the tool warns if the file doesn’t match the scan or if you try to close the page with unsaved work.

Press Generate VR to build a 3D scene of every segmented structure in its true anatomical position (patient orientation and voxel spacing from the DICOM header). Air-filled structures such as the tracheal lumen are drawn as a translucent surface, or as an air wall built from the density of the surrounding tissue; everything else is a coloured, lit volume. Each structure has its own opacity, and a lowest/highest slice can limit the z-axis extent of the whole 3D volume. Rotate freely, then export a range of view angles as a new DICOM Secondary-Capture (RGB) series that keeps the study's patient/study metadata but gets a new series UID, incremented series number, new SOP instance UIDs, instance numbers and creation date/time.

Notes & limits

Region growing follows Hounsfield range and edges, so it works best on structures with reasonable contrast to their surroundings (airway lumen, contrast-filled vessels). Where two similar-density structures touch without a visible wall (e.g. aorta and pulmonary artery in the same contrast phase) growth can cross between them — lower the slider or add a keyframe on the slice where it goes wrong. The 3D render is an orthographic projection at the chosen resolution; exported frames carry the true projected pixel spacing. Gantry-tilted acquisitions are not shear-corrected (the tool warns when tilt is detected). Multiframe DICOM and compressed transfer syntaxes that Pyodide's pydicom cannot decode are skipped and listed. Exported series are derived Secondary Capture images, not for clinical use.