# HG changeset patch # User Sebastien Jodogne # Date 1399308214 -7200 # Node ID 55dae8c5a6abbaaf04fc734b6d37f4613c5b6a8e # Parent 7ebe4bf87196774d6a663d7fd472967b416e4d7b refactoring diff -r 7ebe4bf87196 -r 55dae8c5a6ab OrthancServer/DicomModification.cpp --- a/OrthancServer/DicomModification.cpp Mon May 05 18:39:36 2014 +0200 +++ b/OrthancServer/DicomModification.cpp Mon May 05 18:43:34 2014 +0200 @@ -269,7 +269,7 @@ for (Replacements::const_iterator it = replacements_.begin(); it != replacements_.end(); ++it) { - toModify.Replace(it->first, it->second, FromDcmtkBridge::ReplaceMode_InsertIfAbsent); + toModify.Replace(it->first, it->second, DicomReplaceMode_InsertIfAbsent); } // (4) Update the DICOM identifiers diff -r 7ebe4bf87196 -r 55dae8c5a6ab OrthancServer/FromDcmtkBridge.cpp --- a/OrthancServer/FromDcmtkBridge.cpp Mon May 05 18:39:36 2014 +0200 +++ b/OrthancServer/FromDcmtkBridge.cpp Mon May 05 18:43:34 2014 +0200 @@ -784,7 +784,7 @@ void ParsedDicomFile::Replace(const DicomTag& tag, const std::string& value, - FromDcmtkBridge::ReplaceMode mode) + DicomReplaceMode mode) { DcmTagKey key(tag.GetGroup(), tag.GetElement()); DcmElement* element = NULL; @@ -795,14 +795,14 @@ // This field does not exist, act wrt. the specified "mode" switch (mode) { - case FromDcmtkBridge::ReplaceMode_InsertIfAbsent: + case DicomReplaceMode_InsertIfAbsent: Insert(tag, value); break; - case FromDcmtkBridge::ReplaceMode_ThrowIfAbsent: + case DicomReplaceMode_ThrowIfAbsent: throw OrthancException(ErrorCode_InexistentItem); - case FromDcmtkBridge::ReplaceMode_IgnoreIfAbsent: + case DicomReplaceMode_IgnoreIfAbsent: return; } } @@ -823,14 +823,12 @@ if (tag == DICOM_TAG_SOP_CLASS_UID) { - Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value, - FromDcmtkBridge::ReplaceMode_InsertIfAbsent); + Replace(DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, value, DicomReplaceMode_InsertIfAbsent); } if (tag == DICOM_TAG_SOP_INSTANCE_UID) { - Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, - FromDcmtkBridge::ReplaceMode_InsertIfAbsent); + Replace(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID, value, DicomReplaceMode_InsertIfAbsent); } } diff -r 7ebe4bf87196 -r 55dae8c5a6ab OrthancServer/FromDcmtkBridge.h --- a/OrthancServer/FromDcmtkBridge.h Mon May 05 18:39:36 2014 +0200 +++ b/OrthancServer/FromDcmtkBridge.h Mon May 05 18:43:34 2014 +0200 @@ -35,6 +35,7 @@ #include "../Core/DicomFormat/DicomInstanceHasher.h" #include "../Core/RestApi/RestApiOutput.h" #include "../Core/Toolbox.h" +#include "ServerEnumerations.h" #include #include @@ -46,13 +47,6 @@ class FromDcmtkBridge { public: - enum ReplaceMode - { - ReplaceMode_InsertIfAbsent, - ReplaceMode_ThrowIfAbsent, - ReplaceMode_IgnoreIfAbsent - }; - static void Convert(DicomMap& target, DcmDataset& dataset); static DicomTag GetTag(const DcmElement& element); @@ -169,7 +163,7 @@ void Replace(const DicomTag& tag, const std::string& value, - FromDcmtkBridge::ReplaceMode mode = FromDcmtkBridge::ReplaceMode_InsertIfAbsent); + DicomReplaceMode mode = DicomReplaceMode_InsertIfAbsent); void RemovePrivateTags(); diff -r 7ebe4bf87196 -r 55dae8c5a6ab OrthancServer/ServerEnumerations.h --- a/OrthancServer/ServerEnumerations.h Mon May 05 18:39:36 2014 +0200 +++ b/OrthancServer/ServerEnumerations.h Mon May 05 18:43:34 2014 +0200 @@ -70,6 +70,13 @@ DicomRequestType_Store }; + enum DicomReplaceMode + { + DicomReplaceMode_InsertIfAbsent, + DicomReplaceMode_ThrowIfAbsent, + DicomReplaceMode_IgnoreIfAbsent + }; + /** * WARNING: Do not change the explicit values in the enumerations