# HG changeset patch # User Alain Mazy # Date 1667920222 -3600 # Node ID c02f0646297de548f1fad85c5aa773a7763f9d18 # Parent 317b31e99501af262a2c9a6d57d48d593827cce4 added support for /dicom-web/studies?0020000D=1.2.3&... diff -r 317b31e99501 -r c02f0646297d NEWS --- a/NEWS Mon Sep 26 15:20:39 2022 +0200 +++ b/NEWS Tue Nov 08 16:10:22 2022 +0100 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* added support for QIDO-RS query arguments (e.g: /dicom-web/studies?0020000D=1.2.3&...) + 2022-09-26 - v 0.3.0 ==================== diff -r 317b31e99501 -r c02f0646297d Plugin/DefaultAuthorizationParser.cpp --- a/Plugin/DefaultAuthorizationParser.cpp Mon Sep 26 15:20:39 2022 +0200 +++ b/Plugin/DefaultAuthorizationParser.cpp Tue Nov 08 16:10:22 2022 +0100 @@ -19,6 +19,7 @@ #include "DefaultAuthorizationParser.h" #include +#include namespace OrthancPlugins { @@ -47,11 +48,15 @@ dicomWebInstances_ = boost::regex( "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)/instances/([.0-9]+)(|/|/frames/.*)$"); + + dicomWebQidoRsFindStudies_ = boost::regex( + "^" + tmp + "/studies\?(.*)$"); } bool DefaultAuthorizationParser::Parse(AccessedResources& target, - const std::string& uri) + const std::string& uri, + const std::map& getArguments) { // The mutex below should not be necessary, but we prefer to // ensure thread safety in boost::regex @@ -127,6 +132,18 @@ AddOrthancInstance(target, what[2]); return true; } + else if (boost::regex_match(uri, what, dicomWebQidoRsFindStudies_)) + { + std::string studyInstanceUid; + + studyInstanceUid = Orthanc::HttpToolbox::GetArgument(getArguments, "0020000D", ""); + + if (!studyInstanceUid.empty()) + { + AddDicomStudy(target, studyInstanceUid); + } + return true; + } else { // Unknown type of resource: Consider it as a system access diff -r 317b31e99501 -r c02f0646297d Plugin/DefaultAuthorizationParser.h --- a/Plugin/DefaultAuthorizationParser.h Mon Sep 26 15:20:39 2022 +0200 +++ b/Plugin/DefaultAuthorizationParser.h Tue Nov 08 16:10:22 2022 +0100 @@ -35,6 +35,7 @@ boost::regex dicomWebStudies_; boost::regex dicomWebSeries_; boost::regex dicomWebInstances_; + boost::regex dicomWebQidoRsFindStudies_; boost::regex osimisViewerSeries_; boost::regex osimisViewerImages_; @@ -45,6 +46,7 @@ const std::string& dicomWebRoot); virtual bool Parse(AccessedResources& target, - const std::string& uri); + const std::string& uri, + const std::map& getArguments); }; } diff -r 317b31e99501 -r c02f0646297d Plugin/IAuthorizationParser.h --- a/Plugin/IAuthorizationParser.h Mon Sep 26 15:20:39 2022 +0200 +++ b/Plugin/IAuthorizationParser.h Tue Nov 08 16:10:22 2022 +0100 @@ -22,6 +22,7 @@ #include #include +#include namespace OrthancPlugins { @@ -39,6 +40,7 @@ const std::string& id) = 0; virtual bool Parse(AccessedResources& target, - const std::string& uri) = 0; + const std::string& uri, + const std::map& getArguments) = 0; }; } diff -r 317b31e99501 -r c02f0646297d Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Mon Sep 26 15:20:39 2022 +0200 +++ b/Plugin/Plugin.cpp Tue Nov 08 16:10:22 2022 +0100 @@ -73,7 +73,13 @@ { // Parse the resources that are accessed through this URI OrthancPlugins::IAuthorizationParser::AccessedResources accesses; - if (!authorizationParser_->Parse(accesses, uri)) // TODO: include getArguments (e.g. for StoneViewer call http://localhost:8044/dicom-web/studies?0020000D=1.2.276.0.7230010.3.1.2.2831156000.1.1499097860.742568&includefield=00081030) + std::map getArguments; + for (uint32_t i = 0; i < getArgumentsCount; i++) + { + getArguments[getArgumentsKeys[i]] = getArgumentsValues[i]; + } + + if (!authorizationParser_->Parse(accesses, uri, getArguments)) { return 0; // Unable to parse this URI }