Mercurial > hg > orthanc
changeset 6164:52f87859fec2
refactored DicomMap::LogMissingTagsForStore() as FormatMissingTagsForStore()
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Wed, 11 Jun 2025 15:23:12 +0200 |
| parents | 255fcf2f8541 |
| children | ecd7fdc5f8d4 |
| files | OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomFormat/DicomMap.h OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h OrthancServer/Sources/ServerContext.cpp |
| diffstat | 6 files changed, 18 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp Wed Jun 11 15:23:12 2025 +0200 @@ -31,7 +31,6 @@ #include "../Compatibility.h" #include "../Endianness.h" -#include "../Logging.h" #include "../OrthancException.h" #include "../Toolbox.h" #include "DicomArray.h" @@ -1220,7 +1219,7 @@ } - void DicomMap::LogMissingTagsForStore() const + std::string DicomMap::FormatMissingTagsForStore() const { std::string patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid; @@ -1244,14 +1243,14 @@ sopInstanceUid = ValueAsString(*this, DICOM_TAG_SOP_INSTANCE_UID); } - LogMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); + return FormatMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); } - void DicomMap::LogMissingTagsForStore(const std::string& patientId, - const std::string& studyInstanceUid, - const std::string& seriesInstanceUid, - const std::string& sopInstanceUid) + std::string DicomMap::FormatMissingTagsForStore(const std::string& patientId, + const std::string& studyInstanceUid, + const std::string& seriesInstanceUid, + const std::string& sopInstanceUid) { std::string s, t; @@ -1309,11 +1308,11 @@ if (t.size() == 0) { - LOG(ERROR) << "Store has failed because all the required tags (" << s << ") are missing (is it a DICOMDIR file?)"; + return "Store has failed because all the required tags (" + s + ") are missing (is it a DICOMDIR file?)"; } else { - LOG(ERROR) << "Store has failed because required tags (" << s << ") are missing for the following instance: " << t; + return "Store has failed because required tags (" + s + ") are missing for the following instance: " + t; } }
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.h Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomMap.h Wed Jun 11 15:23:12 2025 +0200 @@ -171,12 +171,12 @@ const void* dicom, size_t size); - void LogMissingTagsForStore() const; + std::string FormatMissingTagsForStore() const; - static void LogMissingTagsForStore(const std::string& patientId, - const std::string& studyInstanceUid, - const std::string& seriesInstanceUid, - const std::string& sopInstanceUid); + static std::string FormatMissingTagsForStore(const std::string& patientId, + const std::string& studyInstanceUid, + const std::string& seriesInstanceUid, + const std::string& sopInstanceUid); bool LookupStringValue(std::string& result, const DicomTag& tag,
--- a/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp Wed Jun 11 15:23:12 2025 +0200 @@ -192,7 +192,7 @@ if (e.GetErrorCode() == ErrorCode_InexistentTag) { - FromDcmtkBridge::LogMissingTagsForStore(**imageDataSet); + LOG(ERROR) << FromDcmtkBridge::FormatMissingTagsForStore(**imageDataSet); } else {
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Wed Jun 11 15:23:12 2025 +0200 @@ -3275,7 +3275,7 @@ } - void FromDcmtkBridge::LogMissingTagsForStore(DcmDataset& dicom) + std::string FromDcmtkBridge::FormatMissingTagsForStore(DcmDataset& dicom) { std::string patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid; @@ -3307,7 +3307,7 @@ sopInstanceUid.assign(c); } - DicomMap::LogMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); + return DicomMap::FormatMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); }
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h Wed Jun 11 15:23:12 2025 +0200 @@ -280,7 +280,7 @@ static bool LookupOrthancTransferSyntax(DicomTransferSyntax& target, DcmDataset& dicom); - static void LogMissingTagsForStore(DcmDataset& dicom); + static std::string FormatMissingTagsForStore(DcmDataset& dicom); static void RemovePath(DcmDataset& dataset, const DicomPath& path);
--- a/OrthancServer/Sources/ServerContext.cpp Wed Jun 11 14:35:44 2025 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Wed Jun 11 15:23:12 2025 +0200 @@ -846,7 +846,7 @@ { if (e.GetErrorCode() == ErrorCode_InexistentTag) { - summary.LogMissingTagsForStore(); + LOG(ERROR) << summary.FormatMissingTagsForStore(); } throw;
