comparison Core/DicomFormat/DicomMap.cpp @ 3518:a57c8163d9ae

DicomMap::GetStringValue()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Sep 2019 17:00:59 +0200
parents 957e06cbe76a
children 173c7f363d8f
comparison
equal deleted inserted replaced
3517:e481c2b32914 3518:a57c8163d9ae
39 39
40 #include "../Endianness.h" 40 #include "../Endianness.h"
41 #include "../Logging.h" 41 #include "../Logging.h"
42 #include "../OrthancException.h" 42 #include "../OrthancException.h"
43 #include "../Toolbox.h" 43 #include "../Toolbox.h"
44 #include "DicomArray.h"
44 45
45 46
46 namespace Orthanc 47 namespace Orthanc
47 { 48 {
48 static DicomTag patientTags[] = 49 static DicomTag patientTags[] =
874 LOG(ERROR) << "Store has failed because required tags (" << s << ") are missing for the following instance: " << t; 875 LOG(ERROR) << "Store has failed because required tags (" << s << ") are missing for the following instance: " << t;
875 } 876 }
876 } 877 }
877 878
878 879
879 bool DicomMap::CopyToString(std::string& result, 880 bool DicomMap::LookupStringValue(std::string& result,
880 const DicomTag& tag, 881 const DicomTag& tag,
881 bool allowBinary) const 882 bool allowBinary) const
882 { 883 {
883 const DicomValue* value = TestAndGetValue(tag); 884 const DicomValue* value = TestAndGetValue(tag);
884 885
885 if (value == NULL) 886 if (value == NULL)
886 { 887 {
1273 } 1274 }
1274 } 1275 }
1275 } 1276 }
1276 } 1277 }
1277 } 1278 }
1279
1280
1281 std::string DicomMap::GetStringValue(const DicomTag& tag,
1282 const std::string& defaultValue,
1283 bool allowBinary) const
1284 {
1285 std::string s;
1286 if (LookupStringValue(s, tag, allowBinary))
1287 {
1288 return s;
1289 }
1290 else
1291 {
1292 return defaultValue;
1293 }
1294 }
1295
1296
1297 void DicomMap::Print(FILE* fp) const
1298 {
1299 DicomArray a(*this);
1300 a.Print(fp);
1301 }
1278 } 1302 }