Ultrasound clips: outline, follow, teach, in the browser
We built ultrasound tools into our free DICOM viewer and an annotation page, for teaching and research. Drag a box and an AI running in the browser outlines the structure. Follow moves the outline through a clip with the picture, stops where the picture changes too much, and never touches a frame you fixed. Fill between keyframes fills the frames between two outlines. DICOM files with MPEG-2, H.264 or HEVC video inside open at any length. A teacher can ask a live class to vote or to outline something. Outlines save as DICOM SEG or COCO, or straight back to the PACS. Nothing is uploaded, and it is not a medical device.

The problem
A teaching site with thousands of ultrasound cases holds stills and clips: from scanners, from a PACS, as DICOM files and as plain video. Teachers want structures outlined on them, and students want to see the outline move with the anatomy through a clip. Doing that by hand is slow: a 3-second clip has 90 frames.
Five things had to hold:
- Nothing uploaded. Ultrasound frames carry names, IDs and dates burned into the picture.
- The person decides. An outline someone corrected is never changed by a tool afterwards.
- Every file that comes in opens: clips, DICOM video, files from a PACS.
- Standard files out: DICOM SEG for a PACS, COCO for training a model.
- Clear limits: for teaching and research, not diagnosis, and it says so above the image.
What it does
| Outline with AI | Drag a box: an AI (LiteMedSAM, Apache 2.0) traces the structure, running in the browser. Correct with the brush |
| Names | The common names of the body area the file says it shows, or your own |
| Follow | The outline moves with the picture through the clip, back or forward. No AI |
| Stops on its own | Where the picture under the outline no longer looks like the keyframe, or the structure fades or jumps. It says why |
| Outline here with AI | Where Follow stopped: the AI outlines it there, and Follow goes on |
| Fill between keyframes | Two outlines, the frames between them filled. The main button once there are two |
| Your frames stay yours | A frame you drew or corrected is a keyframe; nothing overwrites it |
| Video inside DICOM | MPEG-2, H.264 and HEVC, at any length: the video stays compressed and frames are unpacked as you play |
| From and to a PACS | Open a study over DICOMweb; Save to PACS adds the outlines to the same study as a new series |
| Saved outlines | Listed by name and frame; Correct these outlines takes them up again, and saving makes a new series |
| Live class | In a live visit, ask the class to vote or to outline a structure; each student sees how close they came. Nothing stored |
| Share with the edges covered | The scan area is suggested; guests get black around it |
Two places: the DICOM viewer (Outline, on ultrasound) and the annotation page, which also takes PNG, JPEG and video files.
The decisions
AI where it is good, and nowhere else
LiteMedSAM outlines what is inside a box well, and it runs in the browser, so the picture never leaves the computer. We tried more: asking it to find structures over the whole image (it outlined background and screen text), and asking a general AI to name and place structures from the picture. On 30 ultrasound images, a box drawn by a person and outlined by the model did best, so the naming AI was removed. The person names; the AI traces.
Follow moves the picture, it doesn’t guess again
The first Follow asked the AI again on every frame. On real moving clips it stopped after 1 to 15 frames, and without its stops it drifted. Now Follow measures how the picture moves from frame to frame, coarse to fine, and moves the person’s outline with it, matched against the keyframe again at each step so small errors don’t add up. It takes about 0.2 seconds a frame and needs no download.
We measured it on public clips with experts’ outlines on every frame (PFUS1, CC BY 4.0). Over all nine clips, Follow did better than an outline left still and better than a video tracking AI we tried (EdgeTAM); on the five clips we kept aside for the end, leaving the outline still did slightly better. Two outlines with Fill between them did better than one outline with Follow. So Fill is the main button once there are two keyframes. Pelvic floor structures move slowly; a beating heart would be a harder test, and we found no heart clips with outlines whose license allows it.
Stop when unsure, and say why
At every frame the picture under the outline is compared with the keyframe’s. Below one level, Follow stops and writes nothing there; a little higher, the frame turns amber on the timeline as one to check. The older stops stay: the structure gone, faded, jumped, or changed shape or size. Stop works within about two seconds, as the work runs beside the page.
Video files from scanners
Endoscopy and some ultrasound machines store a clip as video inside the DICOM file. Browsers decode H.264 and HEVC; nothing in a browser plays MPEG-2, so we wrote a decoder for it, checked against FFmpeg to within 2 of 255 on every pixel. A long video isn’t unpacked at once: it stays compressed, and frames are decoded as they are played or stepped to. A real 36-second HD clip opens in under a second. Firefox doesn’t decode HEVC frame by frame yet, and says so.
Standard files, and the PACS keeps its own
Outlines save as DICOM SEG, which a PACS and other viewers read, and as COCO, which most training code reads. Save to PACS asks first, sends from the browser straight to the PACS, checks that it arrived, and only adds: the images and earlier outlines stay as they were. Correcting saved outlines makes a new series.
The limits, always in view
“Not a medical device” sits right above the image, with the full disclaimer behind it. The tools name nothing by themselves and measure nothing. Burned-in text inside the scan area stays in saved pictures and shared frames, so each frame has to be checked.
How it was checked
- Follow: unit tests on pictures with known movement (shifts, growth, changes in brightness), a made-up clip with a known outline on every frame, and real clips with experts’ outlines. In the browser, playback steps follow a made-up clip through a frame the person fixed and check that it stays exactly as it was.
- Video: the MPEG-2 decoder against FFmpeg on stills, predicted and bidirectional pictures, interlaced coding, odd sizes and damaged streams. H.264 and HEVC in Chromium, Firefox and WebKit: every frame in its place and in the right colors. A real MPEG-2 endoscopy clip (451 frames) and a 1,080-frame HD H.264 clip from public test sets.
- PACS: Save to PACS against Orthanc on our own computer, then the outlines opened again with the images.
- No upload: the browser tests check that no request carries an image.
- More than 200 checks in the browser playback, run on this work before it went live.
What it means for a teaching site
A case library can keep its images on its own server and still give teachers and students these tools in the browser. Outlines drawn and checked by teachers become a training set for a model of its own later. If that’s on your table, the first 30-minute call is free.
Try it: the viewer · the annotation page · annotate ultrasound clips in the browser · what the viewer needs · segmentations in 2D and 3D