Fellow Oak DICOM for .NET, .NET Core, Universal Windows, Android, iOS, Mono and Unity
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github Added checklist to pull request sample Feb 23, 2017
.nuget upgraded to vs 2013 Feb 25, 2015
DICOM Merge pull request #685 from jwbruce93/Issue_675 Sep 12, 2018
Documentation Added initial Sandcastle project for API documentation. ISsue #28 Mar 2, 2017
Drawing/NetCore Updated copyright year to 2018 May 3, 2018
External Added JPEG-LS codec to .NET 3.5 based Unity package. Sep 22, 2017
Logging Updated copyright year to 2018 May 3, 2018
Native Merge pull request #681 from Cregganbane/development May 7, 2018
Platform Updated copyright year to 2018 May 3, 2018
Serialization/Json fix issue #643; extend unittest for parsing json DS; Remove warnings Jun 24, 2018
Setup Set version number to 4.0.0-rc1 May 22, 2018
Tests Merge branch 'development' into GH-617 Jul 25, 2018
Tools/DICOM Dump Remove warnings, update to new DicomDataset.Get*-methods Jun 23, 2018
packages Moved desktop unit tests to separate Desktop sub-folder. Connected to #… Feb 27, 2017
.editorconfig Changed indent size to 4 spaces Feb 5, 2016
.gitattributes add .gitattributes to help fix line-ending issues Sep 28, 2012
.gitignore Dummy copy resource files to enable Mono build with xbuild. Apr 28, 2017
ChangeLog.md Update ChangeLog.md Sep 12, 2018
Contributors.md Merge branch 'development' into Issue_675 Jul 13, 2018
DICOM.Desktop.sln Moved remaining core projects to Platform folder. Connected to #477 (#… Mar 9, 2017
DICOM.Full.sln Merge branch 'development' into GH-617 Jul 25, 2018
DICOM.Mono.sln Moved remaining core projects to Platform folder. Connected to #477 (#… Mar 9, 2017
DICOM.Unity.sln Make use of .NET 4.6 support in Unity build. Connected to #560 (#585) Aug 24, 2017
License.txt Updated copyright year to 2018 May 3, 2018
README.md Update README.md Jul 25, 2018
SharedAssemblyInfo.cs Set version number to 4.0.0-rc1 May 22, 2018

README.md

fo-dicom logo

Fellow Oak DICOM

NuGet NuGet Pre Release Build status Build status Stories in Ready Join the chat at https://gitter.im/fo-dicom/fo-dicom

Support Us!

If fo-dicom is a vital component in your open-source or commercial application and/or you want to contribute to its continued success, please consider making a small monetary contribution.

€25 €100 €500

License

This library is licensed under the Microsoft Public License (MS-PL). See License.txt for more information.

Features

  • Portable Class Library (PCL)
  • Targets .NET 4.5 and higher, .NET Core (.NET Standard 1.3 and higher), Universal Windows Platform, Xamarin iOS, Xamarin Android, Mono and Unity
  • DICOM dictionary version 2017c
  • High-performance, fully asynchronous async/await API
  • JPEG (including lossless), JPEG-LS, JPEG2000, and RLE image compression (limited on .NET Core, Xamarin, Mono and Unity platforms)
  • Supports very large datasets with content loading on demand
  • Platform-specific image rendering
  • JSON support
  • XML export (preview)
  • Anonymization (preview)

Installation

Easiest is to obtain fo-dicom binaries from NuGet. This package reference the core fo-dicom assemblies for all Microsoft and Xamarin platforms.

NuGet Packages

Valid for version 3.1.0 (incl. pre-releases) and later

Package Description
fo-dicom Dependencies package including core libraries for Microsoft and Xamarin platforms
fo-dicom.Portable Core library for PCL Profile 111
fo-dicom.Desktop Core library and native codec libraries for .NET 4.5.2 and higher
fo-dicom.NetCore Core library for .NET Core applications, Level 1.3 and higher
fo-dicom.Universal Core library and native codec libraries for Universal Windows Platform
fo-dicom.Android Core library for Xamarin Android
fo-dicom.iOS Core library for Xamarin iOS (Unified)
fo-dicom.Mono Core library for Mono 4.5 and higher
fo-dicom.log4net .NET connector to enable fo-dicom logging with log4net
fo-dicom.MetroLog PCL Profile 111 connector to enable fo-dicom logging with MetroLog
fo-dicom.NLog .NET connector to enable fo-dicom logging with NLog
fo-dicom.Serilog .NET connector to enable fo-dicom logging with Serilog
fo-dicom.Json PCL profile 111 library for JSON I/O support
fo-dicom.Drawing .NET Core library providing System.Drawing based image rendering and printing

API Documentation

The API documentation for the core library (represented by fo-dicom.Desktop) and the log4net, NLog and Serilog connectors is available here.

Usage Notes

Image rendering configuration

Out-of-the-box, fo-dicom for .NET defaults to Windows Forms-style image rendering. To switch to WPF-style image rendering, call:

ImageManager.SetImplementation(WPFImageManager.Instance);

Logging configuration

By default, logging defaults to the no-op NullLogerManager. On .NET, several log managers are available and can be enabled like this:

LogManager.SetImplementation(ConsoleLogManager.Instance);  // or ...
LogManager.SetImplementation(NLogManager.Instance);        // or ...

On Universal Windows Platform, Xamarin iOS, Xamarin Android and Mono there is only one operational log manager available, namely MetroLogManager.Instance.

Cross-platform development

To facilitate cross-platform development, the core library is strong name signed and denoted Dicom.Core.dll on all platforms. From an assembly reference point-of-view this convention makes the core assemblies mutually replaceable. It is thus possible to develop a Portable Class Library that depends on the PCL Dicom.Core assembly, and when the developed Portable Class Library is used in a platform-specific application, the PCL Dicom.Core assembly can be replaced with the platform-specific Dicom.Core assembly without needing to re-build anything. fo-dicom.Json and fo-dicom.MetroLog are examples of portable class libraries that depend on the PCL Dicom.Core.dll.

The assembly naming convention is often referred to as the bait-and-switch trick. The fo-dicom package supports the bait-and-switch trick by automatically selecting the best suited Dicom.Core assembly depending on the targeted platform of the development project upon download from NuGet.

Sample applications

There are a number of simple sample applications that use fo-dicom available in separate repository here. These also include the samples that were previously included in the Examples sub-folder of the VS solutions.

Examples

File Operations

var file = DicomFile.Open(@"test.dcm");             // Alt 1
var file = await DicomFile.OpenAsync(@"test.dcm");  // Alt 2

var patientid = file.Dataset.Get<string>(DicomTag.PatientID);

file.Dataset.AddOrUpdate(DicomTag.PatientsName, "DOE^JOHN");

// creates a new instance of DicomFile
var newFile = file.Clone(DicomTransferSyntax.JPEGProcess14SV1);

file.Save(@"output.dcm");             // Alt 1
await file.SaveAsync(@"output.dcm");  // Alt 2

Render Image to JPEG

var image = new DicomImage(@"test.dcm");
image.RenderImage().AsBitmap().Save(@"test.jpg");                     // Windows Forms
image.RenderImage().AsUIImage().AsJPEG().Save(@"test.jpg", true);     // iOS

C-Store SCU

var client = new DicomClient();
client.AddRequest(new DicomCStoreRequest(@"test.dcm"));
client.Send("127.0.0.1", 12345, false, "SCU", "ANY-SCP");             // Alt 1
await client.SendAsync("127.0.0.1", 12345, false, "SCU", "ANY-SCP");  // Alt 2

C-Echo SCU/SCP

var server = new DicomServer<DicomCEchoProvider>(12345);

var client = new DicomClient();
client.NegotiateAsyncOps();
for (int i = 0; i < 10; i++)
    client.AddRequest(new DicomCEchoRequest());
client.Send("127.0.0.1", 12345, false, "SCU", "ANY-SCP");             // Alt 1
await client.SendAsync("127.0.0.1", 12345, false, "SCU", "ANY-SCP");  // Alt 2

C-Find SCU

var cfind = DicomCFindRequest.CreateStudyQuery(patientId: "12345");
cfind.OnResponseReceived = (DicomCFindRequest rq, DicomCFindResponse rp) => {
	Console.WriteLine("Study UID: {0}", rp.Dataset.Get<string>(DicomTag.StudyInstanceUID));
};

var client = new DicomClient();
client.AddRequest(cfind);
client.Send("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE");             // Alt 1
await client.SendAsync("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE");  // Alt 2

C-Move SCU

var cmove = new DicomCMoveRequest("DEST-AE", studyInstanceUid);

var client = new DicomClient();
client.AddRequest(cmove);
client.Send("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE");             // Alt 1
await client.SendAsync("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE");  // Alt 2