Mercurial > hg > orthanc
changeset 6573:bd866774d56d
PermissiveStoreSopClasses accepts regex
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Tue, 27 Jan 2026 12:46:31 +0100 |
| parents | 43ff4470024d |
| children | 0000864c1f63 |
| files | OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp OrthancServer/Resources/Configuration.json |
| diffstat | 2 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp Tue Jan 27 12:15:02 2026 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp Tue Jan 27 12:46:31 2026 +0100 @@ -28,8 +28,10 @@ #include "../Logging.h" #include "../OrthancException.h" #include "../SerializationToolbox.h" +#include "../Toolbox.h" #include <boost/lexical_cast.hpp> +#include <boost/regex.hpp> #include <stdexcept> @@ -557,6 +559,23 @@ bool RemoteModalityParameters::IsPermissiveStoreSopClassUid(const std::string& sopClassUid) const { - return permissiveStoreSopClasses_.find(sopClassUid) != permissiveStoreSopClasses_.end(); + for (std::set<std::string>::const_iterator it = permissiveStoreSopClasses_.begin(); it != permissiveStoreSopClasses_.end(); ++it) + { + if (it->find('*') != std::string::npos || it->find('?') != std::string::npos) + { + boost::regex pattern(Toolbox::WildcardToRegularExpression(*it)); + + if (boost::regex_match(sopClassUid, pattern)) + { + return true; + } + } + else if (sopClassUid == *it) + { + return true; + } + } + + return false; } }
--- a/OrthancServer/Resources/Configuration.json Tue Jan 27 12:15:02 2026 +0100 +++ b/OrthancServer/Resources/Configuration.json Tue Jan 27 12:46:31 2026 +0100 @@ -516,7 +516,7 @@ * * The "PermissiveStoreSopClasses" option allows one to ignore * errors when a modality does not accept to receive the given - * SOP Classes. + * SOP Classes. Each entry can contain wildcards ("?" or "*"). * E.g. CVI42 does not accept Encapsulated PDF files; by setting * "PermissiveStoreSopClasses": ["1.2.840.10008.5.1.4.1.1.104.1"], * a C-Store to CVI42 will be able to complete even if the study
