Git Product home page Git Product logo

fo-dicom's Introduction

fo-dicom logo

Fellow Oak DICOM

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

Features

  • Core functionality in Portable Class Library (PCL)
  • Targets .NET 4.5 and higher, Universal Windows Platform, Xamarin iOS, Xamarin Android, and Mono
  • DICOM dictionary version 2015c
  • High-performance, fully asynchronous async/await API
  • (.NET and UWP only) JPEG (including lossless), JPEG-LS, JPEG2000, and RLE image compression
  • Supports very large datasets with content loading on demand
  • Image rendering

Installation

Easiest is to obtain fo-dicom binaries from NuGet. This package contains all assemblies required to consume fo-dicom in a .NET application.

Starting with fo-dicom version 2.0, there will also be separate NuGet packages available for Dicom.Core, Dicom.Legacy and Dicom.Platform. Dicom.Core is the PCL library with core functionality, Dicom.Legacy is a PCL library with obsolete asynchronous API methods, and Dicom.Platform contains the support libraries required to run fo-dicom on specific target platforms. As of now, .NET 4.5 and higher, Universal Windows Platform, Xamarin iOS and Xamarin Android are the available platforms in the Dicom.Platform NuGet package.

fo-dicom can use a wide variety of logging frameworks. These connectors come in separate NuGet packages for NLog, Serilog, log4net and MetroLog. The MetroLog connector is a Portable Class Library, whereas the other logging connectors are .NET dedicated libraries.

v2.0 Breaking Changes

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);

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.

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.Add(DicomTag.PatientsName, "DOE^JOHN");

// creates a new instance of DicomFile
file = file.ChangeTransferSyntax(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", 104, false, "SCU-AE", "SCP-AE");             // Alt 1
await client.SendAsync("127.0.0.1", 104, 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", 104, false, "SCU-AE", "SCP-AE");             // Alt 1
await client.SendAsync("127.0.0.1", 104, false, "SCU-AE", "SCP-AE");  // Alt 2

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.

Contributors

License

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

fo-dicom's People

Contributors

anders9ustafsson avatar captainstark avatar chafey avatar do0om avatar gitter-badger avatar hdesouky avatar ianyates avatar lste avatar macl3an avatar mdubey82 avatar rcd avatar rickardraysearch avatar ryanmelenanoesis avatar swalex avatar thunderstriker avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.