Search code examples
c#.netfo-dicom

Render JPEG 2000 Image Compression Dicom with Fo-Dicom


I'm try to create a simple WinForms viewer to show DICOM files generated in a NOVARAD PACS system. I'm using the following code from their GitHub page:

var image = new DicomImage(@"C:\myDicom.dcm");                        
image.RenderImage().AsClonedBitmap().Save(@"test.jpg");
Process.Start("test.jpg");

When I run this code I get the following error:

Dicom.Imaging.Codec.DicomCodecException: 'Decoding dataset with transfer syntax: JPEG 2000 Image Compression (Lossless Only) is not supported.'

I'm assuming I need to decompress from the JPEG 2000. Can this not be done with fo-dicom?

I was trying to play around with GDCM library but I couldn't find the C# wrapper, and noticed several comments saying they rolled it into fo-dicom.

Any suggestions?


Solution

  • In .NET Framework applications, the build architecture needs to be set to x86 or x64. Codec access on Any CPU architecture will not work, since there are no native codec libraries available for that architecture. For more information, see the fo-dicom wiki.