diff Framework/Toolbox/DicomStructureSet2.cpp @ 1010:efe1c44628a1 toa2019092003

Fixed mysterious revert of a previous change + converted a .cpp to unix LF
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Sep 2019 12:41:06 +0200
parents 4f28d9459e31
children 29f5f2031310
line wrap: on
line diff
--- a/Framework/Toolbox/DicomStructureSet2.cpp	Fri Sep 20 12:14:43 2019 +0200
+++ b/Framework/Toolbox/DicomStructureSet2.cpp	Fri Sep 20 12:41:06 2019 +0200
@@ -70,14 +70,15 @@
     return (dataset.GetStringValue(value, tag) &&
       LinearAlgebra::ParseVector(target, value));
   }
-  
-  std::ostream& operator<<(std::ostream& s, const OrthancPlugins::DicomPath& dicomPath)
+
+
+  void DicomPathToString(std::string& s, const OrthancPlugins::DicomPath& dicomPath)
   {
     std::stringstream tmp;
     for (size_t i = 0; i < dicomPath.GetPrefixLength(); ++i)
     {
       OrthancPlugins::DicomTag tag = dicomPath.GetPrefixTag(i);
-      
+
       // We use this other object to be able to use GetMainTagsName
       // and Format
       Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement());
@@ -87,7 +88,14 @@
     const OrthancPlugins::DicomTag& tag = dicomPath.GetFinalTag();
     Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement());
     tmp << tag2.GetMainTagsName() << " (" << tag2.Format() << ")";
-    s << tmp.str();
+    s = tmp.str();
+  }
+
+  std::ostream& operator<<(std::ostream& s, const OrthancPlugins::DicomPath& dicomPath)
+  {
+    std::string tmp;
+    DicomPathToString(tmp, dicomPath);
+    s << tmp;
     return s;
   }
 
@@ -227,7 +235,9 @@
         countPointsPath.SetPrefixIndex(1, j);
         if (!reader.GetUnsignedIntegerValue(countPoints, countPointsPath))
         {
-          LOG(ERROR) << "Dicom path " << countPointsPath << " is not valid (should contain an unsigned integer)";
+          std::string s;
+          DicomPathToString(s, countPointsPath);
+          LOG(ERROR) << "Dicom path " << s << " is not valid (should contain an unsigned integer)";
           throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
         }