View Issue Details

IDProjectCategoryView StatusLast Update
0003930Slicer4Module DICOMpublic2018-05-30 11:38
Reporterlassoan Assigned Topieper  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionunable to reproduce 
Product VersionSlicer 4.4.0 
Target VersionFixed in Version 
Summary0003930: Crash when trying to load a DICOM ultrasound image
Description

Slicer crashes when attempting to load an ultrasound image.

The root cause is a trivial bug in GDCMImageIO::InternalReadImageInformation(). If the image type is gdcm::MediaStorage::UltrasoundImageStorage but spacingTag(0x0028,0x0030) is not found then std::vector<double> sp remains empty but its first and second element is attempted to be accessed (spacing[0] = sp[0]), which causes an application crash.

Short-term fix: Make sure that only valid sp vector elements are accessed, for example by bounds checking:

        if (sp.size()>0)
          {
          spacing[0] = sp[0];
          }
        else
          {
          spacing[0] = 1.0;
          }
        if (sp.size()>1)
          {
          spacing[1] = sp[1];
          }
        else
          {
          spacing[1] = 1.0;
          }

Long-term fix: When image type is gdcm::MediaStorage::UltrasoundImageStorage then get spacing from PhysicalUnitsXDirection and PhysicalUnitsYDirection DICOM tags, as it is done in gdcmImageHelper.cxx GetUltraSoundSpacingValueFromSequence(). This should be fixed in GDCM or the workaround in GDCMImageIO::InternalReadImageInformation() should be made more sophisticated (e.g., by doing the same as it is done in GDCM GetUltraSoundSpacingValueFromSequence).

Additional Information

Sample ultrasound image DICOM tags:

# Dicom-File-Format

# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
(0002,0000) UL 214                                      #   4, 1 FileMetaInformationGroupLength
(0002,0001) OB 00\01                                    #   2, 1 FileMetaInformationVersion
(0002,0002) UI =UltrasoundImageStorage                  #  28, 1 MediaStorageSOPClassUID
(0002,0003) UI [1.2.826.0.1.3680043.2.307.115.72286121033.1881432473.1.2] #  56, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =LittleEndianExplicit                    #  20, 1 TransferSyntaxUID
(0002,0012) UI [1.2.826.0.1.3680043.2.307]              #  26, 1 ImplementationClassUID
(0002,0013) SH [2.1 rev-10b2]                           #  12, 1 ImplementationVersionName
(0002,0016) AE [DICOMatic]                              #  10, 1 SourceApplicationEntityTitle

# Dicom-Data-Set
# Used TransferSyntax: Little Endian Explicit
(0008,0008) CS [ORIGINAL\PRIMARY]                       #  16, 2 ImageType
(0008,0012) DA [20141210]                               #   8, 1 InstanceCreationDate
(0008,0013) TM [134532]                                 #   6, 1 InstanceCreationTime
(0008,0014) UI [1.2.826.0.1.3680043.2.307.115]          #  30, 1 InstanceCreatorUID
(0008,0016) UI =UltrasoundImageStorage                  #  28, 1 SOPClassUID
(0008,0018) UI [1.2.826.0.1.3680043.2.307.115.72286121033.1881432473.1.2] #  56, 1 SOPInstanceUID
(0008,0020) DA [20111209]                               #   8, 1 StudyDate
(0008,0022) DA [20111209]                               #   8, 1 AcquisitionDate
(0008,0023) DA [20111209]                               #   8, 1 ContentDate
(0008,0030) TM (no value available)                     #   0, 0 StudyTime
(0008,0032) TM [125642]                                 #   6, 1 AcquisitionTime
(0008,0033) TM [125642]                                 #   6, 1 ContentTime
(0008,0050) SH (no value available)                     #   0, 0 AccessionNumber
(0008,0060) CS [US]                                     #   2, 1 Modality
(0008,0070) LO (no value available)                     #   0, 0 Manufacturer
(0008,0080) LO [XXX]            #  28, 1 InstitutionName
(0008,0090) PN (no value available)                     #   0, 0 ReferringPhysicianName
(0008,1030) LO [WARNING: Image orientation is unreliable] #  40, 1 StudyDescription
(0008,103e) LO [RM6C/OB]                                #   8, 1 SeriesDescription
(0008,1090) LO [GEMS Kretztechnik]                      #  18, 1 ManufacturerModelName
(0008,2111) ST [From Kretz File by TomoVision's DICOMatic 2.1 rev-10b2 (conversion... #  82, 1 DerivationDescription
(0008,2124) IS (no value available)                     #   0, 0 NumberOfStages
(0008,212a) IS (no value available)                     #   0, 0 NumberOfViewsInStage
(0010,0010) PN [XXX]                        #  16, 1 PatientName
(0010,0020) LO [XXX]                            #  12, 1 PatientID
(0010,0030) DA [19500101]                               #   8, 1 PatientBirthDate
(0010,0040) CS (no value available)                     #   0, 0 PatientSex
(0010,4000) LT [WARNING: Image orientation is unreliable] #  40, 1 PatientComments
(0012,0064) SQ (Sequence with undefined length #=0)     # u/l, 1 DeidentificationMethodCodeSequence
(fffe,e0dd) na (SequenceDelimitationItem)               #   0, 0 SequenceDelimitationItem
(0018,0010) LO (no value available)                     #   0, 0 ContrastBolusAgent
(0018,5100) CS (no value available)                     #   0, 0 PatientPosition
(0018,6011) SQ (Sequence with undefined length #=1)     # u/l, 1 SequenceOfUltrasoundRegions
  (fffe,e000) na (Item with undefined length #=11)        # u/l, 1 Item
    (0018,6012) US 1                                        #   2, 1 RegionSpatialFormat
    (0018,6014) US 1                                        #   2, 1 RegionDataType
    (0018,6016) UL 0                                        #   4, 1 RegionFlags
    (0018,6018) UL 0                                        #   4, 1 RegionLocationMinX0
    (0018,601a) UL 0                                        #   4, 1 RegionLocationMinY0
    (0018,601c) UL 319                                      #   4, 1 RegionLocationMaxX1
    (0018,601e) UL 111                                      #   4, 1 RegionLocationMaxY1
    (0018,6024) US 3                                        #   2, 1 PhysicalUnitsXDirection
    (0018,6026) US 3                                        #   2, 1 PhysicalUnitsYDirection
    (0018,602c) FD 0.052951246500015259                     #   8, 1 PhysicalDeltaX
    (0018,602e) FD 0.052951246500015259                     #   8, 1 PhysicalDeltaY
  (fffe,e00d) na (ItemDelimitationItem)                   #   0, 0 ItemDelimitationItem
(fffe,e0dd) na (SequenceDelimitationItem)               #   0, 0 SequenceDelimitationItem
(0018,a001) SQ (Sequence with undefined length #=1)     # u/l, 1 ContributingEquipmentSequence
  (fffe,e000) na (Item with undefined length #=8)         # u/l, 1 Item
    (0008,0070) LO [TomoVision]                             #  10, 1 Manufacturer
    (0008,1010) SH [XXX]                                   #   4, 1 StationName
    (0008,1090) LO [DICOMatic]                              #  10, 1 ManufacturerModelName
    (0018,1000) LO [10413A85]                               #   8, 1 DeviceSerialNumber
    (0018,1020) LO [2.1 rev-10b2]                           #  12, 1 SoftwareVersions
    (0018,a002) DT [20141210134532]                         #  14, 1 ContributionDateTime
    (0018,a003) ST [Converted from Kretz File]              #  26, 1 ContributionDescription
    (0040,a170) SQ (Sequence with undefined length #=1)     # u/l, 1 PurposeOfReferenceCodeSequence
      (fffe,e000) na (Item with undefined length #=3)         # u/l, 1 Item
        (0008,0100) SH [109103]                                 #   6, 1 CodeValue
        (0008,0102) SH [DCM]                                    #   4, 1 CodingSchemeDesignator
        (0008,0104) LO [Modifying Equipment]                    #  20, 1 CodeMeaning
      (fffe,e00d) na (ItemDelimitationItem)                   #   0, 0 ItemDelimitationItem
    (fffe,e0dd) na (SequenceDelimitationItem)               #   0, 0 SequenceDelimitationItem
  (fffe,e00d) na (ItemDelimitationItem)                   #   0, 0 ItemDelimitationItem
(fffe,e0dd) na (SequenceDelimitationItem)               #   0, 0 SequenceDelimitationItem
(0020,000d) UI [1.2.826.0.1.3680043.2.307.115.72286121033.1881432473] #  52, 1 StudyInstanceUID
(0020,000e) UI [1.2.826.0.1.3680043.2.307.115.72286121033.1881432473.1] #  54, 1 SeriesInstanceUID
(0020,0010) SH [48305072728]                            #  12, 1 StudyID
(0020,0011) IS (no value available)                     #   0, 0 SeriesNumber
(0020,0013) IS [1]                                      #   2, 1 InstanceNumber
(0020,0020) CS (no value available)                     #   0, 0 PatientOrientation
(0020,0032) DS [0\0\0]                                  #   6, 3 ImagePositionPatient
(0020,0037) DS [1\0\0\0\1\0]                            #  12, 6 ImageOrientationPatient
(0020,0052) UI [1.2.826.0.1.3680043.2.307.115.72286121033.1881432473.1001] #  58, 1 FrameOfReferenceUID
(0020,0060) CS (no value available)                     #   0, 0 Laterality
(0020,1040) LO (no value available)                     #   0, 0 PositionReferenceIndicator
(0020,4000) LT [WARNING: Image orientation is unreliable] #  40, 1 ImageComments
(0028,0002) US 1                                        #   2, 1 SamplesPerPixel
(0028,0004) CS [MONOCHROME2]                            #  12, 1 PhotometricInterpretation
(0028,0010) US 112                                      #   2, 1 Rows
(0028,0011) US 320                                      #   2, 1 Columns
(0028,0014) US 1                                        #   2, 1 UltrasoundColorDataPresent
(0028,0100) US 8                                        #   2, 1 BitsAllocated
(0028,0101) US 8                                        #   2, 1 BitsStored
(0028,0102) US 7                                        #   2, 1 HighBit
(0028,0103) US 0                                        #   2, 1 PixelRepresentation
(0028,1052) DS [0]                                      #   2, 1 RescaleIntercept
(0028,1053) DS [1]                                      #   2, 1 RescaleSlope
(0028,2110) CS [00]                                     #   2, 1 LossyImageCompression
(7fe0,0010) OB 00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00... # 35840, 1 PixelData
TagsNo tags attached.

Activities

pieper

pieper

2014-12-30 04:56

administrator   ~0012819

We need to get away from the generic dicom readers that ignore the SOPClassUID. Instead we should have custom interpretation classes that losslessly map SOPClasses into the appropriate MRML objects for display and manipulation inside slicer. The current GDCM readers in ITK are okay for many traditional use cases, but the design fails too often and needs to be replaced so we can correctly handle a wider range of datasets.

lassoan

lassoan

2015-01-05 12:07

developer   ~0012832

Yes, I agree that we should add modality-specific plugins to Slicer.

However, this issue is so sever and the crash is so easy to fix that it should be fixed in ITK. I didn't have the time to push this through through ITK's gerrit but it would be nice if somebody could do it.

pieper

pieper

2015-01-05 19:48

administrator   ~0012833

Agreed, it should be fixed in ITK. We could fix it in github.com/Slicer/ITK for now, and then try to get it back upstream. I think that supplying a sample dataset and showing that it crashes with a trivial ITK example would be all that's needed to get a simple patch accepted.

pieper

pieper

2015-05-14 15:52

administrator   ~0013057

Isn't this the one that Andrey worked on with Hans? If it's not already fixed in ITK we should migrate this issue report to the ITK tracker.

pieper

pieper

2015-05-14 15:52

administrator   ~0013058

Reminder sent to: fedorov

Andrey is this what you saw too?

jcfr

jcfr

2018-03-22 03:12

administrator   ~0015603

Isn't this the one that Andrey worked on with Hans? If it's not already fixed in ITK we should migrate this issue report to the ITK tracker.

@pieper @lassoan do you know if this has been addressed ? Was an issue reported in the ITK tracker ?

pieper

pieper

2018-03-23 19:08

administrator   ~0015612

As I recall there was a parallel thread going on either slicer-devel or the ITK list at the time. @fedorov do you remember?

fedorov

fedorov

2018-03-26 10:00

developer   ~0015613

@pieper that was a long while ago, it would be hard to find the details at this point. Indeed, I believe that issue was also related to spacing in US, but I think the issue was that the spacing was ignored. I may be wrong though. What I also remember is that the changes related to that issue were integrated into ITK, so this must be something else.

pieper

pieper

2018-03-26 10:33

administrator   ~0015614

It looks to me that the code has been re-written and I don't see the quoted block in the report in the current version of the code:

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/GDCM/src/itkGDCMImageIO.cxx

At this point unless we can replicate the crash I'd vote for closing this issue with an "unable to reproduce".

lassoan

lassoan

2018-05-30 01:53

developer   ~0015834

In recent Slicer versions, it does not seem to crash anymore.

lassoan

lassoan

2018-05-30 11:38

developer   ~0015838

Color ultrasound images seem to load correctly in latest Slicer version. Tested on Windows 10, 4.9.0-2018-05-29 (revision 27218), with data set http://www.rubomedical.com/dicom_files/dicom_viewer_0020.zip.

Issue History

Date Modified Username Field Change
2014-12-29 19:33 lassoan New Issue
2014-12-29 19:33 lassoan Status new => assigned
2014-12-29 19:33 lassoan Assigned To => pieper
2014-12-30 04:56 pieper Note Added: 0012819
2015-01-05 12:07 lassoan Note Added: 0012832
2015-01-05 19:48 pieper Note Added: 0012833
2015-05-14 15:52 pieper Note Added: 0013057
2015-05-14 15:52 pieper Status assigned => feedback
2015-05-14 15:52 pieper Note Added: 0013058
2018-03-22 03:10 jcfr Description Updated View Revisions
2018-03-22 03:10 jcfr Additional Information Updated View Revisions
2018-03-22 03:11 jcfr Description Updated View Revisions
2018-03-22 03:12 jcfr Note Added: 0015603
2018-03-23 19:08 pieper Note Added: 0015612
2018-03-26 10:00 fedorov Note Added: 0015613
2018-03-26 10:33 pieper Note Added: 0015614
2018-05-30 01:53 lassoan Status feedback => assigned
2018-05-30 01:53 lassoan Resolution open => unable to reproduce
2018-05-30 01:53 lassoan Note Added: 0015834
2018-05-30 11:38 lassoan Status assigned => resolved
2018-05-30 11:38 lassoan Note Added: 0015838