TypeInitilizationException while attempting to open a DicomImage from a DICOM file with JPEG Transfer Syntax

117 views
Skip to first unread message

Stan Konce

unread,
Jun 15, 2015, 10:17:51 AM6/15/15
to fo-d...@googlegroups.com
Hello.
I am pretty new to this group, now busy testing a few free and commercial DICOM .NET libraries.
I have been quite successful performing a few unit tests with FO-DICOM until I stumbled over a first problem, namely, I have been so far unable to open a DicomImage from a file with JPEG Transfer Syntax. Whenever I try to perform a
    DicomImage image    = new DicomImage(fileName);
with a file containing a JPEG I am getting a TypeInitializationException in the DicomImage.Load(DicomDataset dataset, int frame)  function, namely, in its first operator,
    Dataset = DicomTranscoder.ExtractOverlays(dataset); // (*)
The inner exception sounds like "Cannot cast the underlying exported value of type 'Dicom.Imaging.Codec.DicomJpegProcess1Codec (ContractName=\"Dicom.Imaging.Codec.IDicomCodec\")' to type 'Dicom.Imaging.Codec.IDicomCodec'." which I cannot understand.

Interesting enough, the dataset itself in // (*) is loaded and seems to be valid. NativeDicom and NativeDicom64 dlls are referenced by the project and are physically in the same (working) folder where Dicom.dll is. Also, DICOM Dump can read and display the dataset.

I wonder what I am doing wrong.

Thanks for all tips and suggestions,
Stan

Anders Gustafsson Cureos AB

unread,
Aug 6, 2015, 9:16:24 AM8/6/15
to Fellow Oak DICOM for .NET
Hello Stan,

and sorry for the late reply. This still sounds like an issue with the "native" DLL:s. When you say they are referenced by the project, could you describe in more detail how? Have you included the DLLs in the project as "Content" items that are set to be copied to the output directory, or?

Which fo-dicom version are you using? I recommend that you use NuGet to reference the latest pre-release 1.1.0-rc2. The NuGet package automatically copies the relevant native DLL to the output directory when you build for the x86 or x64 platform.

Best regards,
Anders @ Cureos
Reply all
Reply to author
Forward
0 new messages