High-performance native codec wrappers for SharpDicom (JPEG, JPEG 2000, JPEG-LS)
$ dotnet add package SharpDicom.CodecsHigh-performance native codec wrappers for SharpDicom supporting JPEG, JPEG 2000, and JPEG-LS compression.
Install the meta package, which automatically pulls in the correct runtime package for your platform:
dotnet add package SharpDicom.Codecs
| Platform | Runtime Identifier | Package |
|---|---|---|
| Windows x64 | win-x64 | SharpDicom.Codecs.runtime.win-x64 |
| Windows ARM64 | win-arm64 | SharpDicom.Codecs.runtime.win-arm64 |
| Linux x64 | linux-x64 | SharpDicom.Codecs.runtime.linux-x64 |
| Linux ARM64 | linux-arm64 | SharpDicom.Codecs.runtime.linux-arm64 |
| macOS x64 (Intel) | osx-x64 | SharpDicom.Codecs.runtime.osx-x64 |
| macOS ARM64 (Apple Silicon) | osx-arm64 | SharpDicom.Codecs.runtime.osx-arm64 |
This package contains pre-built binaries from the following open-source projects:
The codecs are automatically registered when you reference SharpDicom.Codecs:
using SharpDicom.Codecs.Native;
// Register native codecs with the SharpDicom codec registry
NativeCodecs.RegisterAll();
// Now decompress/compress DICOM files with supported transfer syntaxes
var file = DicomFile.Open("compressed.dcm");
var pixelData = file.Dataset.GetPixelData();
byte[] decompressed = pixelData.Decompress();
Native codecs provide significant performance improvements over pure C# implementations:
| Codec | Speedup vs Pure C# | Notes |
|---|---|---|
| JPEG | 3-5x | SIMD optimized (AVX2, NEON) |
| JPEG 2000 | 2-4x | Multi-threaded decode |
| JPEG-LS | 2-3x | Optimized for medical images |
The SharpDicom.Codecs package is licensed under GPL-3.0-or-later.
The bundled native libraries have their own licenses (all permissive BSD-style). See THIRD_PARTY_LICENSES.txt for complete license texts.