Mercurial > hg > orthanc
changeset 176:81f11fb357f2
uid generation
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 07 Nov 2012 17:21:21 +0100 |
parents | 662af781a227 |
children | 81b6f3013738 |
files | OrthancServer/FromDcmtkBridge.cpp OrthancServer/FromDcmtkBridge.h |
diffstat | 2 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp Mon Nov 05 12:31:02 2012 +0100 +++ b/OrthancServer/FromDcmtkBridge.cpp Wed Nov 07 17:21:21 2012 +0100 @@ -57,6 +57,7 @@ #include <dcmtk/dcmdata/dcvrss.h> #include <dcmtk/dcmdata/dcvrul.h> #include <dcmtk/dcmdata/dcvrus.h> +#include <dcmtk/dcmdata/dcuid.h> #include <boost/math/special_functions/round.hpp> @@ -614,4 +615,26 @@ result[GetName(it->first)] = it->second->AsString(); } } + + + std::string FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel level) + { + char uid[100]; + + switch (level) + { + case DicomRootLevel_Instance: + return dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT); + + case DicomRootLevel_Series: + return dcmGenerateUniqueIdentifier(uid, SITE_SERIES_UID_ROOT); + + case DicomRootLevel_Study: + return dcmGenerateUniqueIdentifier(uid, SITE_STUDY_UID_ROOT); + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + }
--- a/OrthancServer/FromDcmtkBridge.h Mon Nov 05 12:31:02 2012 +0100 +++ b/OrthancServer/FromDcmtkBridge.h Wed Nov 07 17:21:21 2012 +0100 @@ -45,6 +45,13 @@ ImageExtractionMode_UInt16 }; + enum DicomRootLevel + { + DicomRootLevel_Study, + DicomRootLevel_Series, + DicomRootLevel_Instance + }; + class FromDcmtkBridge { public: @@ -105,5 +112,7 @@ static void ToJson(Json::Value& result, const DicomMap& values); + + static std::string GenerateUniqueIdentifier(DicomRootLevel level); }; }