# HG changeset patch # User Sebastien Jodogne # Date 1358500631 -3600 # Node ID a58a8be26aff0d73e65f03fbe7fd78c2ed4bd0f6 # Parent b51c67f28b333ee77c3fe9983a7eeab9af5a1112 generation of random uid in the rest api diff -r b51c67f28b33 -r a58a8be26aff OrthancServer/OrthancRestApi.cpp --- a/OrthancServer/OrthancRestApi.cpp Thu Jan 17 16:01:58 2013 +0100 +++ b/OrthancServer/OrthancRestApi.cpp Fri Jan 18 10:17:11 2013 +0100 @@ -317,6 +317,27 @@ call.GetOutput().AnswerJson(result); } + static void GenerateUid(RestApi::GetCall& call) + { + std::string level = call.GetArgument("level", ""); + if (level == "patient") + { + call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Patient), "text/plain"); + } + else if (level == "study") + { + call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Study), "text/plain"); + } + else if (level == "series") + { + call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Series), "text/plain"); + } + else if (level == "instance") + { + call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(DicomRootLevel_Instance), "text/plain"); + } + } + // List all the patients, studies, series or instances ---------------------- @@ -1441,5 +1462,7 @@ Register("/instances/{id}/anonymize", AnonymizeInstance); Register("/series/{id}/anonymize", AnonymizeSeriesInplace); Register("/studies/{id}/anonymize", AnonymizeStudyInplace); + + Register("/tools/generate-uid", GenerateUid); } }