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.
On .NET Framework 4.7.2, DICOM files render fully — pages, frames, and animation — but technical metadata (the DICOM tags) is not available.
Viewer.GetDicomMetadataAsyncalways returnsnull, and the widget's metadata request answers501 Not Implemented. UseDoconut.NET8if your application needs the tags.
Install the package
Install-Package Doconut.NETFramework.DicomKeep the DICOM package at the same version as Doconut.NETFramework.
Register the plugin
Doconut.DoconutHost.Initialize(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. If the license does not grant it, DoconutHost.Initialize throws from Application_Start and the site answers every request with an empty 500 (the reason is in the Windows event log). Because no built-in viewer handles these formats, opening one fails outright 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 and detail in one document |
Animation timing is controlled by AnimationFrameDelayMs (default 100 ms = 10 FPS; GIF timing uses 10 ms units) and LoopCount (0 = loop forever).
The viewer finds out that page 1 is animated by sending a HEAD request for it. The DocImage.axd handler must therefore accept HEAD in Web.config (verb="GET,HEAD,POST", see Installation); without it, IIS answers 404 before Doconut runs and animation detection never works.
Resolution
DicomConfig renders at 100 DPI per axis by default. If you don't set HorizontalResolution/VerticalResolution explicitly, they follow BaseConfig.ImageResolution when that is set, 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
var metadata = await viewer.GetDicomMetadataAsync(token);
// On .NET Framework this is always null: the DICOM metadata reader is not available for this
// target. Pages, frames and animation render normally.The method exists on this package so that code shared with the .NET 8 package compiles, but reading DICOM tags needs a component that has no .NET Framework build. Plan your user interface without them — for example, hide a metadata panel when the result is null.
Full config reference
The complete DicomConfig property table is in Format Configs. In a per-extension selection, the DICOM case looks like this:
case ".DCM": case ".IMA":
return 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 stays visible throughout playback. A custom DocOptions.Watermark is used only when the license permits custom watermarks; it cannot replace an evaluation watermark.
Multi-frame studies can produce both an animation and one static page per frame. AnimationAndFrames gives the richest navigation but also the highest rendering and memory cost — and on a single server that memory belongs to the IIS worker process. For large studies:
- use
FramesOnlywhen frame inspection matters more than playback; - avoid raising both resolution axes without measuring memory;
- close the session explicitly when the study is no longer open;
- keep
CachePageson only when repeat access is worth the retained images.
Troubleshooting
| Symptom | Check |
|---|---|
.dcm is reported as unsupported | DicomPlugin registration and package deployment |
Every request answers an empty 500 after adding the plugin | The license grants Dicom — Windows event log, source ASP.NET |
| Only one page appears | The source may be single-frame, or DisplayMode is AnimationOnly |
| Page 1 does not animate | The handler in Web.config accepts HEAD |
| Animation is too fast or slow | AnimationFrameDelayMs; GIF timing uses 10 ms units |
| Memory grows on large multi-frame files | Display mode, resolution, page cache, and explicit session close |
Metadata is always null | Expected on this package — see the note at the top |
Var den här sidan hjälpsam?