# HG changeset patch # User Sebastien Jodogne # Date 1597668491 -7200 # Node ID c5cdb6dc6865af2d696f0013651e4eb9e6a8ecbb # Parent be88fe7e4670e8a064f85a9f91ac960bb933164d New config option "Worklist.LimitAnswers" for the sample modality worklist plugin diff -r be88fe7e4670 -r c5cdb6dc6865 NEWS --- a/NEWS Fri Aug 14 08:26:07 2020 +0200 +++ b/NEWS Mon Aug 17 14:48:11 2020 +0200 @@ -4,6 +4,7 @@ * Add missing tag "Retrieve AE Title (0008,0054)" in C-FIND SCP responses * Fix DICOM SCP filters if some query tag has more than 256 characters * "/series/.../ordered-slices" supports spaces in Image Position/Orientation Patient tags +* New config option "Worklist.LimitAnswers" for the sample modality worklist plugin Version 1.7.2 (2020-07-08) diff -r be88fe7e4670 -r c5cdb6dc6865 OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp --- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Fri Aug 14 08:26:07 2020 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Mon Aug 17 14:48:11 2020 +0200 @@ -31,6 +31,7 @@ static std::string folder_; static bool filterIssuerAet_ = false; +static unsigned int limitAnswers_ = 0; /** * This is the main function for matching a DICOM worklist against a query. @@ -150,8 +151,8 @@ fs::path source(folder_); fs::directory_iterator end; - int parsedFilesCount = 0; - int matchedWorklistCount = 0; + unsigned int parsedFilesCount = 0; + unsigned int matchedWorklistCount = 0; try { @@ -171,6 +172,16 @@ // We found a worklist (i.e. a DICOM find with extension ".wl"), match it against the query if (MatchWorklist(answers, query, *matcher, it->path().string())) { + if (limitAnswers_ != 0 && + matchedWorklistCount >= limitAnswers_) + { + // Too many answers are to be returned wrt. the + // "LimitAnswers" configuration parameter. Mark the + // C-FIND result as incomplete. + OrthancPluginWorklistMarkIncomplete(OrthancPlugins::GetGlobalContext(), answers); + return OrthancPluginErrorCode_Success; + } + OrthancPlugins::LogInfo("Worklist matched: " + it->path().string()); matchedWorklistCount++; } @@ -179,9 +190,9 @@ } std::ostringstream message; - message << "Worklist C-Find: parsed " << parsedFilesCount << " files, found " << matchedWorklistCount << " match(es)"; + message << "Worklist C-Find: parsed " << parsedFilesCount + << " files, found " << matchedWorklistCount << " match(es)"; OrthancPlugins::LogInfo(message.str()); - } catch (fs::filesystem_error&) { @@ -189,9 +200,6 @@ return OrthancPluginErrorCode_DirectoryExpected; } - // Uncomment the following line if too many answers are to be returned - // OrthancPluginMarkWorklistAnswersIncomplete(OrthancPlugins::GetGlobalContext(), answers); - return OrthancPluginErrorCode_Success; } catch (OrthancPlugins::PluginException& e) @@ -239,6 +247,7 @@ } filterIssuerAet_ = worklists.GetBooleanValue("FilterIssuerAet", false); + limitAnswers_ = worklists.GetUnsignedIntegerValue("LimitAnswers", 0); } else { diff -r be88fe7e4670 -r c5cdb6dc6865 OrthancServer/Plugins/Samples/ServeFolders/Plugin.cpp --- a/OrthancServer/Plugins/Samples/ServeFolders/Plugin.cpp Fri Aug 14 08:26:07 2020 +0200 +++ b/OrthancServer/Plugins/Samples/ServeFolders/Plugin.cpp Mon Aug 17 14:48:11 2020 +0200 @@ -70,6 +70,7 @@ extensions_["wasm"] = "application/wasm"; extensions_["woff"] = "application/x-font-woff"; extensions_["xml"] = "application/xml"; + extensions_["pdf"] = "application/pdf"; }