Mercurial > hg > orthanc-dicomweb
changeset 310:dcaf234698a3 refactoring
Basic implementation of WADO-RS "Retrieve rendered instance"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Jun 2019 09:08:42 +0200 |
parents | 8594f9bcd556 |
children | 90b5bc463550 |
files | NEWS Plugin/Plugin.cpp |
diffstat | 2 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Jun 19 07:21:27 2019 +0200 +++ b/NEWS Wed Jun 19 09:08:42 2019 +0200 @@ -6,6 +6,7 @@ * Handling of the HTTP header "Forwarded" for WADO-RS * New URI: /dicom-web/servers/.../qido * New URI: /dicom-web/servers/.../delete +* Basic implementation of WADO-RS "Retrieve rendered instance" Version 0.6 (2019-02-27)
--- a/Plugin/Plugin.cpp Wed Jun 19 07:21:27 2019 +0200 +++ b/Plugin/Plugin.cpp Wed Jun 19 09:08:42 2019 +0200 @@ -411,6 +411,41 @@ } + +void RetrieveInstanceRendered(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) +{ + OrthancPluginContext* context = OrthancPlugins::GetGlobalContext(); + + if (request->method != OrthancPluginHttpMethod_Get) + { + OrthancPluginSendMethodNotAllowed(context, output, "GET"); + } + else + { + Orthanc::MimeType mime = Orthanc::MimeType_Jpeg; + + std::string publicId; + if (LocateInstance(output, publicId, request)) + { + std::map<std::string, std::string> headers; + headers["Accept"] = Orthanc::EnumerationToString(mime); + + OrthancPlugins::MemoryBuffer buffer; + if (buffer.RestApiGet("/instances/" + publicId + "/preview", headers, false)) + { + OrthancPluginAnswerBuffer(context, output, buffer.GetData(), + buffer.GetSize(), Orthanc::EnumerationToString(mime)); + } + } + } +} + + + + + static bool DisplayPerformanceWarning(OrthancPluginContext* context) { (void) DisplayPerformanceWarning; // Disable warning about unused function @@ -707,6 +742,8 @@ OrthancPlugins::RegisterRestCallback<ServeDicomWebClient>(root + "app/client/(.*)", true); OrthancPlugins::RegisterRestCallback<GetClientInformation>(root + "app/info", true); + OrthancPlugins::RegisterRestCallback<RetrieveInstanceRendered>(root + "studies/([^/]*)/series/([^/]*)/instances/([^/]*)/rendered", true); + std::string uri = root + "app/client/index.html"; OrthancPluginSetRootUri(context, uri.c_str()); }