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.GetDicomMetadataAsync always returns null, and the widget's metadata request answers 501 Not Implemented. Use Doconut.NET8 if your application needs the tags.

Install the package

powershell
Install-Package Doconut.NETFramework.Dicom

Keep the DICOM package at the same version as Doconut.NETFramework.

Register the plugin

csharp
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:

text
LicenseException: This document type requires the 'Dicom' plugin license.

Opening a DICOM file

csharp
var token = await viewer.OpenDocumentAsync(path, new DicomConfig
{
    DisplayMode = DicomDisplayMode.AnimationAndFrames
});

Display modes

Multi-frame DICOM files can be presented three ways (DicomDisplayMode):

ModePages producedUse for
AnimationOnlyPage 1 = animated GIF looping all framesQuick cinematic review
FramesOnlyPages 1..N = one static PNG per frameFrame-by-frame diagnostic navigation
AnimationAndFrames (default)Page 1 = animated GIF, pages 2..N = static framesOverview 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.

csharp
// Uniform bump via the base property…
new DicomConfig { ImageResolution = 150 };

// …or per-axis control
new DicomConfig { HorizontalResolution = 200, VerticalResolution = 150 };

DICOM metadata

csharp
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:

csharp
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 FramesOnly when 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 CachePages on only when repeat access is worth the retained images.

Troubleshooting

SymptomCheck
.dcm is reported as unsupportedDicomPlugin registration and package deployment
Every request answers an empty 500 after adding the pluginThe license grants Dicom — Windows event log, source ASP.NET
Only one page appearsThe source may be single-frame, or DisplayMode is AnimationOnly
Page 1 does not animateThe handler in Web.config accepts HEAD
Animation is too fast or slowAnimationFrameDelayMs; GIF timing uses 10 ms units
Memory grows on large multi-frame filesDisplay mode, resolution, page cache, and explicit session close
Metadata is always nullExpected on this package — see the note at the top

Cette page était-elle utile ?