diff Core/DicomFormat/DicomImageInformation.cpp @ 3519:fc26659493b6

added support for COLUMNS/ROWS tags with invalid 800\0 value observed in some US images
author amazy
date Thu, 19 Sep 2019 13:10:10 +0200
parents 4e43e67f8ecf
children 94f4a18a79cc
line wrap: on
line diff
--- a/Core/DicomFormat/DicomImageInformation.cpp	Thu Sep 05 13:11:35 2019 +0200
+++ b/Core/DicomFormat/DicomImageInformation.cpp	Thu Sep 19 13:10:10 2019 +0200
@@ -116,8 +116,9 @@
         photometric_ = PhotometricInterpretation_Unknown;
       }
 
-      width_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_COLUMNS).GetContent());
-      height_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_ROWS).GetContent());
+      values.GetValue(DICOM_TAG_COLUMNS).ParseFirstUnsignedInteger(width_); // in some US images, we've seen tag values of "800\0"; that's why we parse the 'first' value
+      values.GetValue(DICOM_TAG_ROWS).ParseFirstUnsignedInteger(height_);
+
       bitsAllocated_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_BITS_ALLOCATED).GetContent());
 
       try