[Debian-med-packaging] Bug#753809: ginkgocadx and certain dicom files

David Clunie dclunie at dclunie.com
Sun Jan 31 14:23:16 UTC 2016


I agree with Mathieu Malaterre. This is an invalid DICOM
file, so the bug is in the source system, not the
recipient.

The error is caused by the (0002,0003) data element being
repeated:

- once within the meta information header (within the length
   specified by group length (0002,0003))

- once at the beginning of the data set

which can be interpreted as being incorrect in various
ways:

- group 0002 data elements may not occur outside the meta
   information header, as Mathieu points out

- data elements may not be repeated

- data elements must be in ascending numerical order

Since the meta information is encoded in explicit VR and
the data set in implicit VR, the two copies of (0002,0003)
are encoded slightly differently, but they do contain the
same value.

I mention this because it explains why toolkits behave
differently with this illegal file (as Mathieu and Jörg
have discussed in comp.protocols.dicom):

- those that determine the end of the meta information
   header based on the (mandatory) group length of group
   0002 may switch transfer syntax from explicit to implicit
   before the offending tag and read it, and then may or
   may not complain about its presence being illegal
   (duplicate or out of order), or may just silently
   ignore it

- those that use the change of group number from 0002 to
   something higher to detect the end of the meta header may
   not read the offending implicit VR encoded extra out of
   order group 0002 data element correctly if they try to
   parse it as explicit VR, and get out of sync

The Implementation Version Name in the meta information header
says "OFFIS_DCMTK_360", but dcmtk doesn't make this kind
of error, as far as I know, so Karsten, it would be good
to know what system actually encoded this bad DICOM file.

David

% andump debian_753809_badmetaelement.dcm
(0x0002,0x0000) UL File Meta Information Group Length 	 VR=<UL> 
VL=<0x0004>  [0x000000d8]
(0x0002,0x0001) OB File Meta Information Version 	 VR=<OB>   VL=<0x0002> 
  [0x00,0x01]
(0x0002,0x0002) UI Media Storage SOP Class UID 	 VR=<UI>   VL=<0x001a> 
<1.2.840.10008.5.1.4.1.1.1>
(0x0002,0x0003) UI Media Storage SOP Instance UID 	 VR=<UI> 
VL=<0x003a>  <1.2.276.0.7230010.3.1.4.2831160242.3411.1400154379.583031>
(0x0002,0x0010) UI Transfer Syntax UID 	 VR=<UI>   VL=<0x0012> 
<1.2.840.10008.1.2>
(0x0002,0x0012) UI Implementation Class UID 	 VR=<UI>   VL=<0x001c> 
<1.2.276.0.7230010.3.0.3.6.0>
(0x0002,0x0013) SH Implementation Version Name 	 VR=<SH>   VL=<0x0010> 
<OFFIS_DCMTK_360 >
(0x0002,0x0016) AE Source Application Entity Title 	 VR=<AE> 
VL=<0x0008>  <GNUMEDLH>
(0x0002,0x0003) UI Media Storage SOP Instance UID 	 VR=<UN> 
VL=<0x003a> 
[0x31,0x2e,0x32,0x2e,0x32,0x37,0x36,0x2e,0x30,0x2e,0x37,0x32,0x33,0x30,0x30,0x31,0x30,0x2e,0x33,0x2e,0x31,0x2e,0x34,0x2e,0x32,0x38,0x33,0x31,0x31,0x36,0x30,0x32,0x34,0x32,0x2e,0x33,0x34,0x31,0x31,0x2e,0x31,0x34,0x30,0x30,0x31,0x35,0x34,0x33,0x37,0x39,0x2e,0x35,0x38,0x33,0x30,0x33,0x31,0x00] 

(0x0008,0x0000) UL Group Length 	 VR=<UL>   VL=<0x0004>  [0x000001d2]
(0x0008,0x0005) CS Specific Character Set 	 VR=<CS>   VL=<0x000a> 
<ISO_IR 100>
...

% dcdump -ignoreoutofordertags debian_753809_badmetaelement.dcm
Warning - Tags out of order - trailing garbage, wrong transfer syntax, 
or not valid DICOM
(0x0002,0x0003) UI Media Storage SOP Instance UID Error - Tag read 
failed - Implicit VR encoding even though supposed to be explicit
Warning - Bad group length - Group 0x2 specified as 0xd8 actually 0x11a
Error - Dicom dataset read failed
(0x0002,0x0000) UL File Meta Information Group Length 	 VR=<UL> 
VL=<0x0004>  [0x000000d8]
(0x0002,0x0001) OB File Meta Information Version 	 VR=<OB>   VL=<0x0002> 
  [0x00,0x01]
(0x0002,0x0002) UI Media Storage SOP Class UID 	 VR=<UI>   VL=<0x001a> 
<1.2.840.10008.5.1.4.1.1.1>
(0x0002,0x0003) UI Media Storage SOP Instance UID 	 VR=<UI> 
VL=<0x003a>  <1.2.276.0.7230010.3.1.4.2831160242.3411.1400154379.583031>
(0x0002,0x0003) UI Media Storage SOP Instance UID 	 VR=<UI> 
VL=<0x003a>  <1.2.276.0.7230010.3.1.4.2831160242.3411.1400154379.583031>
(0x0002,0x0010) UI Transfer Syntax UID 	 VR=<UI>   VL=<0x0012> 
<1.2.840.10008.1.2>
(0x0002,0x0012) UI Implementation Class UID 	 VR=<UI>   VL=<0x001c> 
<1.2.276.0.7230010.3.0.3.6.0>
(0x0002,0x0013) SH Implementation Version Name 	 VR=<SH>   VL=<0x0010> 
<OFFIS_DCMTK_360 >
(0x0002,0x0016) AE Source Application Entity Title 	 VR=<AE> 
VL=<0x0008>  <GNUMEDLH>
(0x0008,0x0000) UL Group Length 	 VR=<UL>   VL=<0x0004>  [0x000001d2]
(0x0008,0x0005) CS Specific Character Set 	 VR=<CS>   VL=<0x000a> 
<ISO_IR 100>
...

% java -cp pixelmed.jar com.pixelmed.dicom.AttributeList 
debian_753809_badmetaelement.dcm
Error: Illegal duplicate tag in dataset - (0x0002,0x0003) - replacing 
previous occurence
[main] INFO com.pixelmed.dicom.AttributeList Dumping ...
(0x0002,0x0000) FileMetaInformationGroupLength VR=<UL> VL=<0x4> [0xd8]
(0x0002,0x0001) FileMetaInformationVersion VR=<OB> VL=<0x2> []
(0x0002,0x0002) MediaStorageSOPClassUID VR=<UI> VL=<0x1a> 
<1.2.840.10008.5.1.4.1.1.1>
(0x0002,0x0003) MediaStorageSOPInstanceUID VR=<UI> VL=<0x3a> 
<1.2.276.0.7230010.3.1.4.2831160242.3411.1400154379.583031>
(0x0002,0x0010) TransferSyntaxUID VR=<UI> VL=<0x12> <1.2.840.10008.1.2>
(0x0002,0x0012) ImplementationClassUID VR=<UI> VL=<0x1c> 
<1.2.276.0.7230010.3.0.3.6.0>
(0x0002,0x0013) ImplementationVersionName VR=<SH> VL=<0x10> 
<OFFIS_DCMTK_360 >
(0x0002,0x0016) SourceApplicationEntityTitle VR=<AE> VL=<0x8> <GNUMEDLH>
(0x0008,0x0000) VR=<UN> VL=<0x4> [B at 12edcd21
(0x0008,0x0005) SpecificCharacterSet VR=<CS> VL=<0xa> <ISO_IR 100>
...



More information about the Debian-med-packaging mailing list