rexcardan / Evil-DICOM

A C# DICOM Library
171 stars 98 forks source link

Sorting of elements in DICOMObject #29

Closed Sikkesoft closed 9 years ago

Sikkesoft commented 9 years ago

Rex,

When reading a Dicom File and enumrating the IDicomElements I noticed the following in the output

(0002,0012) ImplementationClassUID ,Type: UniqueIdentifier/System.String value 1.2.40.0.13.1.1 (0002,0013) ImplementationVersionName,Type: ShortString/System.String value dcm4che-1.4.29 (0008,9205) PixelPresentation ,Type: CodeString/System.String value MONOCHROME (0008,9206) VolumetricProperties ,Type: CodeString/System.String value SAMPLED (0008,9207) VolumeBasedCalculationTechnique,Type: CodeString/System.String value MAX_IP (0008,0005) SpecificCharacterSet ,Type: CodeString/System.String value ISO_IR 100 (0008,0008) ImageType ,Type: CodeString/System.String value DERIVED\PRIMARY\TOMOSYNTHESIS\MAXIMUM

I quickly found the bug to be located in the TagSorter; The code uses BitConverter.ToInt16(tagBytes_#,0) for 9205 that results in a negative value (-28155) So the solution is to use BitConverter.ToUInt16(tagBytes_#,0) instead

Andre Sikma

rexcardan commented 9 years ago

Good catch. It is patched in 1.0.5.4