Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 1139:f167b672db94
/tools/lookup URI to map DICOM UIDs to Orthanc identifiers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Sep 2014 16:38:28 +0200 |
parents | 1701dcb6f554 |
children | 94c5f6623b3a |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Wed Sep 10 13:16:08 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Wed Sep 10 16:38:28 2014 +0200 @@ -781,6 +781,35 @@ } + static void Lookup(RestApiPostCall& call) + { + typedef std::list< std::pair<ResourceType, std::string> > Resources; + + std::string tag = call.GetPostBody(); + Resources resources; + + OrthancRestApi::GetIndex(call).LookupTagValue(resources, tag); + + Json::Value result = Json::arrayValue; + + for (Resources::const_iterator it = resources.begin(); + it != resources.end(); it++) + { + ResourceType type = it->first; + const std::string& id = it->second; + + Json::Value item = Json::objectValue; + item["Type"] = EnumerationToString(type); + item["ID"] = id; + item["Path"] = GetBasePath(type, id); + + result.append(item); + } + + call.GetOutput().AnswerJson(result); + } + + void OrthancRestApi::RegisterResources() { Register("/instances", ListResources<ResourceType_Instance>); @@ -849,6 +878,8 @@ Register("/{resourceType}/{id}/attachments/{name}/verify-md5", VerifyAttachment); Register("/{resourceType}/{id}/attachments/{name}", UploadAttachment); + Register("/tools/lookup", Lookup); + Register("/instances/{id}/content/*", GetRawContent); } }