Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/Core/DicomFormat/DicomMap.cpp Wed Sep 11 13:22:07 2019 +0200 +++ b/Core/DicomFormat/DicomMap.cpp Wed Sep 11 17:00:59 2019 +0200 @@ -41,6 +41,7 @@ #include "../Logging.h" #include "../OrthancException.h" #include "../Toolbox.h" +#include "DicomArray.h" namespace Orthanc @@ -876,9 +877,9 @@ } - bool DicomMap::CopyToString(std::string& result, - const DicomTag& tag, - bool allowBinary) const + bool DicomMap::LookupStringValue(std::string& result, + const DicomTag& tag, + bool allowBinary) const { const DicomValue* value = TestAndGetValue(tag); @@ -1275,4 +1276,27 @@ } } } + + + std::string DicomMap::GetStringValue(const DicomTag& tag, + const std::string& defaultValue, + bool allowBinary) const + { + std::string s; + if (LookupStringValue(s, tag, allowBinary)) + { + return s; + } + else + { + return defaultValue; + } + } + + + void DicomMap::Print(FILE* fp) const + { + DicomArray a(*this); + a.Print(fp); + } }