Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
1009:211c7944d65f | 1010:efe1c44628a1 |
---|---|
68 { | 68 { |
69 std::string value; | 69 std::string value; |
70 return (dataset.GetStringValue(value, tag) && | 70 return (dataset.GetStringValue(value, tag) && |
71 LinearAlgebra::ParseVector(target, value)); | 71 LinearAlgebra::ParseVector(target, value)); |
72 } | 72 } |
73 | 73 |
74 std::ostream& operator<<(std::ostream& s, const OrthancPlugins::DicomPath& dicomPath) | 74 |
75 void DicomPathToString(std::string& s, const OrthancPlugins::DicomPath& dicomPath) | |
75 { | 76 { |
76 std::stringstream tmp; | 77 std::stringstream tmp; |
77 for (size_t i = 0; i < dicomPath.GetPrefixLength(); ++i) | 78 for (size_t i = 0; i < dicomPath.GetPrefixLength(); ++i) |
78 { | 79 { |
79 OrthancPlugins::DicomTag tag = dicomPath.GetPrefixTag(i); | 80 OrthancPlugins::DicomTag tag = dicomPath.GetPrefixTag(i); |
80 | 81 |
81 // We use this other object to be able to use GetMainTagsName | 82 // We use this other object to be able to use GetMainTagsName |
82 // and Format | 83 // and Format |
83 Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement()); | 84 Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement()); |
84 size_t index = dicomPath.GetPrefixIndex(i); | 85 size_t index = dicomPath.GetPrefixIndex(i); |
85 tmp << tag2.GetMainTagsName() << " (" << tag2.Format() << ") [" << index << "] / "; | 86 tmp << tag2.GetMainTagsName() << " (" << tag2.Format() << ") [" << index << "] / "; |
86 } | 87 } |
87 const OrthancPlugins::DicomTag& tag = dicomPath.GetFinalTag(); | 88 const OrthancPlugins::DicomTag& tag = dicomPath.GetFinalTag(); |
88 Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement()); | 89 Orthanc::DicomTag tag2(tag.GetGroup(), tag.GetElement()); |
89 tmp << tag2.GetMainTagsName() << " (" << tag2.Format() << ")"; | 90 tmp << tag2.GetMainTagsName() << " (" << tag2.Format() << ")"; |
90 s << tmp.str(); | 91 s = tmp.str(); |
92 } | |
93 | |
94 std::ostream& operator<<(std::ostream& s, const OrthancPlugins::DicomPath& dicomPath) | |
95 { | |
96 std::string tmp; | |
97 DicomPathToString(tmp, dicomPath); | |
98 s << tmp; | |
91 return s; | 99 return s; |
92 } | 100 } |
93 | 101 |
94 | 102 |
95 DicomStructureSet2::DicomStructureSet2() | 103 DicomStructureSet2::DicomStructureSet2() |
225 unsigned int countPoints = 0; | 233 unsigned int countPoints = 0; |
226 | 234 |
227 countPointsPath.SetPrefixIndex(1, j); | 235 countPointsPath.SetPrefixIndex(1, j); |
228 if (!reader.GetUnsignedIntegerValue(countPoints, countPointsPath)) | 236 if (!reader.GetUnsignedIntegerValue(countPoints, countPointsPath)) |
229 { | 237 { |
230 LOG(ERROR) << "Dicom path " << countPointsPath << " is not valid (should contain an unsigned integer)"; | 238 std::string s; |
239 DicomPathToString(s, countPointsPath); | |
240 LOG(ERROR) << "Dicom path " << s << " is not valid (should contain an unsigned integer)"; | |
231 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); | 241 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); |
232 } | 242 } |
233 | 243 |
234 //LOG(INFO) << "Parsing slice containing " << countPoints << " vertices"; | 244 //LOG(INFO) << "Parsing slice containing " << countPoints << " vertices"; |
235 | 245 |