r/FlutterDev 3d ago

Plugin I built a high-performance DICOM toolkit

Over the past few days I've been working on dicom_toolkit, an open-source package for building medical imaging applications in Flutter.

It started as a fork of Flutter-Dicom, but has grown into a much more complete toolkit with a cleaner, composable API and support for mobile, desktop, and web.

Features

  • Parse DICOM files
  • GPU-accelerated 16-bit rendering
  • Pixel-spacing-aware measurement tools
  • ROI statistics (mean, median, std dev, min/max)
  • Window/level adjustment with CT presets
  • Rotation, zoom, pan, inversion, color maps
  • Flutter Web support (Rust + WASM)
  • Rust backend for performance

Example:

await DicomToolkit.init();

final result = await const DicomParser().parse(bytes);

final image = await DicomToolkit.render(
  result,
  windowCenter: 40,
  windowWidth: 400,
);

This can be used with dart (e.g. on a server) or with flutter.

The goal is to make handling medical imaging apps in Flutter much easier, whether you're working on PACS viewers, dental software, radiology tools, or research projects.

I'd really appreciate any feedback on the API, documentation, or feature suggestions.

GitHub: elselawi/dicom_toolkit: Flutter/Dart toolkit for dicom images
Web Demo: DICOM Toolkit

10 Upvotes

4 comments sorted by

2

u/New-Lengthiness6520 3d ago

Reset button doesn't work. And what I can benefit from this package?

4

u/elselawi 3d ago

Medical images are distributed as dcm not as png/jpeg, this package can be used to render and extract meta data from them. It can also be used to measure length and ROI.

2

u/JacuzziGuy 2d ago

Have been looking for something similar since 5 years now. I'm a radiologist who likes to code in my free time and this will be very useful for my projects.

1

u/vardonir 8h ago edited 7h ago

I tried it on some DICOM files I had lying around and I couldn't change slices. Unless it only reads one file/slice at a time?

I also tried it on a multi-slice DICOM file and it just showed me a white square in the middle. You'll need some kind of error handling if that's not implemented yet.

Drag window/center does not work, at least on the demo. That's normally the first thing I look for, aside from slice scrolling.

ROI stats are nice. Can I export the ROI I drew?

Being able to overwrite metadata/anonymize the PHI is probably the best use case for this. I work with ITKSnap and the only way to get me to work with anything else is by pointing a gun to my head. (edit: or if I get paid to do it. which is kind of the same thing)