# HG changeset patch # User Alain Mazy # Date 1668004835 -3600 # Node ID 55539d564f4fae9a009d7e4b71862473dfeb77f9 # Parent c02f0646297de548f1fad85c5aa773a7763f9d18 added support for /dicom-web/series? & /dicom-web/instances? diff -r c02f0646297d -r 55539d564f4f Plugin/AssociativeArray.h --- a/Plugin/AssociativeArray.h Tue Nov 08 16:10:22 2022 +0100 +++ b/Plugin/AssociativeArray.h Wed Nov 09 15:40:35 2022 +0100 @@ -41,5 +41,10 @@ bool GetValue(std::string& value, const std::string& key) const; + + const std::map& GetMap() const + { + return map_; + } }; } diff -r c02f0646297d -r 55539d564f4f Plugin/DefaultAuthorizationParser.cpp --- a/Plugin/DefaultAuthorizationParser.cpp Tue Nov 08 16:10:22 2022 +0100 +++ b/Plugin/DefaultAuthorizationParser.cpp Wed Nov 09 15:40:35 2022 +0100 @@ -49,8 +49,8 @@ dicomWebInstances_ = boost::regex( "^" + tmp + "/studies/([.0-9]+)/series/([.0-9]+)/instances/([.0-9]+)(|/|/frames/.*)$"); - dicomWebQidoRsFindStudies_ = boost::regex( - "^" + tmp + "/studies\?(.*)$"); + dicomWebQidoRsFind_ = boost::regex( + "^" + tmp + "/(studies|series|instances)\?(.*)$"); } @@ -132,13 +132,23 @@ AddOrthancInstance(target, what[2]); return true; } - else if (boost::regex_match(uri, what, dicomWebQidoRsFindStudies_)) + else if (boost::regex_match(uri, what, dicomWebQidoRsFind_)) { - std::string studyInstanceUid; + std::string studyInstanceUid, seriesInstanceUid, sopInstanceUid; studyInstanceUid = Orthanc::HttpToolbox::GetArgument(getArguments, "0020000D", ""); + seriesInstanceUid = Orthanc::HttpToolbox::GetArgument(getArguments, "0020000E", ""); + sopInstanceUid = Orthanc::HttpToolbox::GetArgument(getArguments, "00080018", ""); - if (!studyInstanceUid.empty()) + if (!sopInstanceUid.empty() && !seriesInstanceUid.empty() && !studyInstanceUid.empty()) + { + AddDicomInstance(target, studyInstanceUid, seriesInstanceUid, sopInstanceUid); + } + else if (!seriesInstanceUid.empty() && !studyInstanceUid.empty()) + { + AddDicomSeries(target, studyInstanceUid, seriesInstanceUid); + } + else if (!studyInstanceUid.empty()) { AddDicomStudy(target, studyInstanceUid); } diff -r c02f0646297d -r 55539d564f4f Plugin/DefaultAuthorizationParser.h --- a/Plugin/DefaultAuthorizationParser.h Tue Nov 08 16:10:22 2022 +0100 +++ b/Plugin/DefaultAuthorizationParser.h Wed Nov 09 15:40:35 2022 +0100 @@ -35,7 +35,7 @@ boost::regex dicomWebStudies_; boost::regex dicomWebSeries_; boost::regex dicomWebInstances_; - boost::regex dicomWebQidoRsFindStudies_; + boost::regex dicomWebQidoRsFind_; boost::regex osimisViewerSeries_; boost::regex osimisViewerImages_; diff -r c02f0646297d -r 55539d564f4f Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Tue Nov 08 16:10:22 2022 +0100 +++ b/Plugin/Plugin.cpp Wed Nov 09 15:40:35 2022 +0100 @@ -73,13 +73,9 @@ { // Parse the resources that are accessed through this URI OrthancPlugins::IAuthorizationParser::AccessedResources accesses; - std::map getArguments; - for (uint32_t i = 0; i < getArgumentsCount; i++) - { - getArguments[getArgumentsKeys[i]] = getArgumentsValues[i]; - } + OrthancPlugins::AssociativeArray getArguments(getArgumentsCount, getArgumentsKeys, getArgumentsValues, true); - if (!authorizationParser_->Parse(accesses, uri, getArguments)) + if (!authorizationParser_->Parse(accesses, uri, getArguments.GetMap())) { return 0; // Unable to parse this URI } @@ -109,9 +105,6 @@ OrthancPlugins::AssociativeArray headers (headersCount, headersKeys, headersValues, false); - OrthancPlugins::AssociativeArray getArguments - (getArgumentsCount, getArgumentsKeys, getArgumentsValues, true); - // Loop over all the authorization tokens stored in the HTTP // headers, until finding one that is granted for (std::list::const_iterator