Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A C# DICOM Library
C#
Branch: master
Pull request Compare This branch is 80 commits ahead, 2 commits behind rexcardan:master.

Improve memory efficiency and performance

These changes greatly decreases memory required when reading in large pixel data elements.

The repeated "buffer.Take(read).ToArray()" ends up creating an excessive amount of smaller arrays as it scales up its backing buffer (the TakeIterator prevents the usual optimizations).
I need to process the meta data for a large amount of DICOM volumes but skipping over the pixel data element still needed about 200MB of memory for 40MB of pixel data and regrettably caused OutOfMemoryExceptions when bulk processing.

A Visual Studio 2015 diagnostic comparison: http://imgur.com/a/2OL1b
latest commit 972eb854a4
@SuneBuur SuneBuur authored anders9ustafsson committed

README.md

Portable Evil DICOM

NuGet NuGet

Copyright (c) 2011-2015 Rex Cardan. Portable Class Library adaptation (c) 2012-2015 Anders Gustafsson, Cureos AB.

A simple to use C# library for reading and manipulating DICOM files. Github is just the distro.

This project is a Portable Class Library adapted fork of Rex Cardan's original Evil DICOM library. For general information, online API and Getting Started tutorials, see here.

The following links will help you get started:

Project website at http://rexcardan.com/evildicom

Content Link
Introductory Video https://www.youtube.com/watch?v=rmYpxxqQ90s
Examples http://rexcardan.com/evildicom
Online API http://www.rexcardan.com/api/evildicom/index.html

Applicability

The EvilDicom.Core Visual Studio solution contains a Portable Class Library project and a unit test project. The PCL library EvilDICOM.Core supports the following targets:

  • .NET Framework version 4 and higher
  • Windows 8 and higher (f.k.a. Metro)
  • Silverlight version 5 and higher
  • Windows Phone (Silverlight) version 8 and higher
  • Windows Phone 8.1 and higher
  • Xamarin.Android
  • Xamarin.iOS Classic and Unified APIs

Public API Differences

To meet the requirements of a Portable Class Library project, the PCL library public API differs from Rex Cardan's original .NET library as follows:

  • DICOMBinaryReader and DICOMBinaryWriter constructors, DICOMFileReader.Read, DICOMFileReader.ReadFileMetadata, DICOMFileWriter.WriteLittleEndian, DICOMObject.Open, DICOMObject.SaveAs, DoseMatrix.Load and DoseMatrix.Save methods takes a Stream argument instead of a file path string.
  • ConsoleLogger is excluded

PCL example usage

Read a DICOM file with the name path:

var dcm = DICOMFileReader.Read(File.OpenRead(path));            // .NET and (Windows Phone) Silverlight applications

Write DICOM object dcm to a file with the name path:

DICOMFileWriter.WriteLittleEndian(File.OpenWrite(path), dcm);   // .NET and (Windows Phone) Silverlight applications
Something went wrong with that request. Please try again.