DICOM Plugin
View medical images with DicomPlugin
The DICOM plugin adds medical-image viewing to Doconut: multi-frame DICOM files render as an animated overview, individual frames, or both. DICOM is a plugin-only format — without this plugin (and its license capability), .dcm files cannot be opened at all.
Install the package
dotnet add package Doconut.NET6.DicomThe unversioned command installs the latest stable release. To pin the plugin to the current 26.7.0 release, pass the version separately:
dotnet add package Doconut.NET6.Dicom --version 26.7.0Keep the DICOM package at the same version as Doconut.NET6. The package ID is
Doconut.NET6.Dicom; .26.7.0 appears only in the downloaded .nupkg filename.
Register the plugin
builder.Services.AddDoconut(options =>
{
options.AddPlugin<Doconut.Plugins.Dicom.DicomPlugin>();
});The plugin (Name: "Doconut DICOM Viewer") registers viewers for the .dcm and .ima extensions, gated by the Dicom capability. A missing or insufficient non-temporary entitlement normally fails during AddDoconut(). Because no built-in viewer handles these formats, the runtime gate also fails hard if the capability later becomes unavailable:
LicenseException: This document type requires the 'Dicom' plugin license.Opening a DICOM file
var token = await viewer.OpenDocumentAsync(path, new DicomConfig
{
DisplayMode = DicomDisplayMode.AnimationAndFrames
});Display modes
Multi-frame DICOM files can be presented three ways (DicomDisplayMode):
| Mode | Pages produced | Use for |
|---|---|---|
AnimationOnly | Page 1 = animated GIF looping all frames | Quick cinematic review |
FramesOnly | Pages 1..N = one static PNG per frame | Frame-by-frame diagnostic navigation |
AnimationAndFrames (default) | Page 1 = animated GIF, pages 2..N = static frames | Overview + detail in one document |
Animation timing is controlled by AnimationFrameDelayMs (default 100 ms = 10 FPS; GIF granularity is 10 ms units) and LoopCount (0 = loop forever).
Resolution
DicomConfig renders at 100 DPI per axis by default. The resolution properties have a fallback chain worth knowing: if you don't set HorizontalResolution/VerticalResolution explicitly, they follow BaseConfig.ImageResolution when that is configured, and only then fall back to 100.
// Uniform bump via the base property…
new DicomConfig { ImageResolution = 150 };
// …or per-axis control
new DicomConfig { HorizontalResolution = 200, VerticalResolution = 150 };DICOM metadata availability on .NET 6
DICOM page rendering, individual frames, animation, transforms, and watermarking are supported. Technical tag metadata is not available in the .NET 6 package because the metadata reader has no .NET 6 build.
Viewer.GetDicomMetadataAsync(token) therefore returns null for a DICOM session and
logs a one-time warning. The corresponding ?token=…&meta middleware request returns
HTTP 501 Not Implemented with the stable error code
dicom_metadata_unsupported. Use the .NET 8 package when technical DICOM metadata is a
requirement.
Full config reference
The complete DicomConfig property table lives in API Reference → Format Configs. A production example from the reference app's per-extension switch:
".DCM" or ".IMA" => new DicomConfig { DisplayMode = DicomDisplayMode.AnimationAndFrames },Watermark and memory behavior
The normal page watermark decision also applies to DICOM output. For animated output, each GIF frame is stamped so the mark remains visible throughout playback. A custom DocOptions.Watermark is used only when the license path permits custom watermarks; it cannot replace an evaluation watermark.
Multiframe studies can generate both an animation and one static page per frame. AnimationAndFrames provides the richest navigation but also has the highest rendering and cache cost. For large studies:
- use
FramesOnlywhen frame inspection matters more than cinematic playback; - avoid increasing both resolution axes without measuring memory;
- close the session explicitly when the study is no longer open;
- keep
CachePagesenabled only when repeat access benefits outweigh the retained images.
Troubleshooting
| Symptom | Check |
|---|---|
.dcm is reported as unsupported | DicomPlugin registration and package deployment |
| Startup fails after adding the plugin | The loaded license grants Dicom |
| Only one page appears | The source may be single-frame, or DisplayMode is AnimationOnly |
| Animation is too fast or slow | AnimationFrameDelayMs; effective GIF timing uses 10 ms units |
| Memory grows on large multiframe files | Display mode, resolution, page cache, and explicit session close |
Metadata is null, or &meta returns 501 | Expected .NET 6 limitation; rendering is unaffected |
Was this page helpful?