changeset 3342:63f59ad9381a

Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Apr 2019 13:36:13 +0200
parents 8f44dadcdbc1
children 6e42d676401c
files Core/DicomNetworking/DicomUserConnection.cpp Core/DicomParsing/ParsedDicomFile.cpp Core/DicomParsing/ParsedDicomFile.h NEWS OrthancServer/DicomInstanceToStore.cpp OrthancServer/OrthancFindRequestHandler.cpp UnitTestsSources/FromDcmtkTests.cpp
diffstat 7 files changed, 9 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Fri Apr 05 13:02:57 2019 +0200
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Fri Apr 05 13:36:13 2019 +0200
@@ -590,11 +590,11 @@
           }
         }
 
-        return new ParsedDicomFile(*fix);
+        return new ParsedDicomFile(*fix, GetDefaultDicomEncoding(), false /* be strict */);
       }
 
       default:
-        return new ParsedDicomFile(fields);
+        return new ParsedDicomFile(fields, GetDefaultDicomEncoding(), false /* be strict */);
     }
   }
 
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Fri Apr 05 13:02:57 2019 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Fri Apr 05 13:36:13 2019 +0200
@@ -1024,13 +1024,6 @@
   }
 
 
-  ParsedDicomFile::ParsedDicomFile(const DicomMap& map) : 
-    pimpl_(new PImpl)
-  {
-    CreateFromDicomMap(map, GetDefaultDicomEncoding(), false /* be strict by default */);
-  }
-
-
   ParsedDicomFile::ParsedDicomFile(const void* content, 
                                    size_t size) : pimpl_(new PImpl)
   {
--- a/Core/DicomParsing/ParsedDicomFile.h	Fri Apr 05 13:02:57 2019 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.h	Fri Apr 05 13:36:13 2019 +0200
@@ -101,8 +101,6 @@
                     Encoding defaultEncoding,
                     bool permissive);
 
-    ParsedDicomFile(const DicomMap& map);
-
     ParsedDicomFile(const void* content,
                     size_t size);
 
--- a/NEWS	Fri Apr 05 13:02:57 2019 +0200
+++ b/NEWS	Fri Apr 05 13:36:13 2019 +0200
@@ -2,6 +2,7 @@
 ===============================
 
 * Size of the Orthanc static binaries are reduced by compressing ICU data
+* Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)
 * Fix issue #138 (POST to modalities/{name} accepts invalid characters)
 
 
--- a/OrthancServer/DicomInstanceToStore.cpp	Fri Apr 05 13:02:57 2019 +0200
+++ b/OrthancServer/DicomInstanceToStore.cpp	Fri Apr 05 13:36:13 2019 +0200
@@ -179,7 +179,9 @@
           }
           else
           {
-            parsed_.TakeOwnership(new ParsedDicomFile(summary_.GetConstContent()));
+            parsed_.TakeOwnership(new ParsedDicomFile(summary_.GetConstContent(),
+                                                      GetDefaultDicomEncoding(),
+                                                      false /* be strict */));
           }                                
         }
 
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Fri Apr 05 13:02:57 2019 +0200
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Fri Apr 05 13:36:13 2019 +0200
@@ -371,7 +371,7 @@
     }
     else
     {
-      ParsedDicomFile dicom(result);
+      ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), true /* be permissive, cf. issue #136 */);
 
       for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin();
            tag != sequencesToReturn.end(); ++tag)
--- a/UnitTestsSources/FromDcmtkTests.cpp	Fri Apr 05 13:02:57 2019 +0200
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Fri Apr 05 13:36:13 2019 +0200
@@ -1119,7 +1119,7 @@
 
   {
     DicomMap m;
-    ParsedDicomFile dicom(m);
+    ParsedDicomFile dicom(m, GetDefaultDicomEncoding(), false);
     ASSERT_EQ(1u, dicom.GetDcmtkObject().getDataset()->card());
     CheckEncoding(dicom, Encoding_Ascii);
   }
@@ -1134,7 +1134,7 @@
   {
     DicomMap m;
     m.SetValue(DICOM_TAG_SPECIFIC_CHARACTER_SET, "ISO_IR 148", false);
-    ParsedDicomFile dicom(m);
+    ParsedDicomFile dicom(m, GetDefaultDicomEncoding(), false);
     ASSERT_EQ(1u, dicom.GetDcmtkObject().getDataset()->card());
     CheckEncoding(dicom, Encoding_Latin5);
   }