Mercurial > hg > orthanc
changeset 3710:1c69af37d8ae storage-commitment
integration mainline->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Feb 2020 13:27:16 +0100 |
parents | bf8f17f23c26 (current diff) 1f4910999fe7 (diff) |
children | 14b363d972a8 |
files | NEWS Plugins/Engine/OrthancPlugins.cpp Resources/Configuration.json |
diffstat | 9 files changed, 69 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomParsing/DicomModification.cpp Thu Feb 27 17:06:45 2020 +0100 +++ b/Core/DicomParsing/DicomModification.cpp Fri Feb 28 13:27:16 2020 +0100 @@ -1324,6 +1324,12 @@ patientNameReplaced = (IsReplaced(DICOM_TAG_PATIENT_NAME) && GetReplacement(DICOM_TAG_PATIENT_NAME) == patientName); + + // New in Orthanc 1.6.0 + if (request.isMember("PrivateCreator")) + { + privateCreator_ = SerializationToolbox::ReadString(request, "PrivateCreator"); + } }
--- a/Core/DicomParsing/DicomModification.h Thu Feb 27 17:06:45 2020 +0100 +++ b/Core/DicomParsing/DicomModification.h Fri Feb 28 13:27:16 2020 +0100 @@ -187,7 +187,7 @@ void Serialize(Json::Value& value) const; - void SetPrivateCreator(std::string& privateCreator) + void SetPrivateCreator(const std::string& privateCreator) { privateCreator_ = privateCreator; }
--- a/Core/DicomParsing/FromDcmtkBridge.cpp Thu Feb 27 17:06:45 2020 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Fri Feb 28 13:27:16 2020 +0100 @@ -1404,7 +1404,7 @@ if (tag.IsPrivate()) { // https://forum.dcmtk.org/viewtopic.php?t=4527 - LOG(WARNING) << "You are using DCMTK <= 3.6.0: All the private tags " + LOG(WARNING) << "You are using DCMTK <= 3.6.1: All the private tags " "are considered as having a binary value representation"; key.setPrivateCreator(privateCreator.c_str()); return new DcmOtherByteOtherWord(key);
--- a/NEWS Thu Feb 27 17:06:45 2020 +0100 +++ b/NEWS Fri Feb 28 13:27:16 2020 +0100 @@ -51,6 +51,7 @@ * Fix issue #165 (Boundary parameter in multipart Content-Type is too long) * Fix issue #166 (CMake find_boost version is now broken with newer boost/cmake) * Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association) +* Fix issue #168 (Plugins can't read private tags from the configuration file) Version 1.5.8 (2019-10-16)
--- a/OrthancServer/OrthancConfiguration.cpp Thu Feb 27 17:06:45 2020 +0100 +++ b/OrthancServer/OrthancConfiguration.cpp Fri Feb 28 13:27:16 2020 +0100 @@ -865,4 +865,11 @@ return new TemporaryFile; } } + + + std::string OrthancConfiguration::GetDefaultPrivateCreator() const + { + // New configuration option in Orthanc 1.6.0 + return GetStringParameter("DefaultPrivateCreator", ""); + } }
--- a/OrthancServer/OrthancConfiguration.h Thu Feb 27 17:06:45 2020 +0100 +++ b/OrthancServer/OrthancConfiguration.h Fri Feb 28 13:27:16 2020 +0100 @@ -231,5 +231,7 @@ void ResetServerIndex(); TemporaryFile* CreateTemporaryFile() const; + + std::string GetDefaultPrivateCreator() const; }; }
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Thu Feb 27 17:06:45 2020 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp Fri Feb 28 13:27:16 2020 +0100 @@ -37,6 +37,7 @@ #include "../../Core/DicomParsing/FromDcmtkBridge.h" #include "../../Core/Logging.h" #include "../../Core/SerializationToolbox.h" +#include "../OrthancConfiguration.h" #include "../ServerContext.h" #include "../ServerJobs/MergeStudyJob.h" #include "../ServerJobs/ResourceModificationJob.h" @@ -63,6 +64,11 @@ { // curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"},"Priority":9}' + { + OrthancConfiguration::ReaderLock lock; + target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator()); + } + if (call.ParseJsonRequest(request)) { target.ParseModifyRequest(request); @@ -80,6 +86,11 @@ { // curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{"Replace":{"PatientName":"hello","0010-0020":"world"},"Keep":["StudyDescription", "SeriesDescription"],"KeepPrivateTags": true,"Remove":["Modality"]}' > Anonymized.dcm + { + OrthancConfiguration::ReaderLock lock; + target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator()); + } + if (call.ParseJsonRequest(request) && request.isObject()) { @@ -553,6 +564,11 @@ privateCreator = v.asString(); } + else + { + OrthancConfiguration::ReaderLock lock; + privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); + } // Inject time-related information
--- a/Plugins/Engine/OrthancPlugins.cpp Thu Feb 27 17:06:45 2020 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Fri Feb 28 13:27:16 2020 +0100 @@ -3049,9 +3049,18 @@ std::string dicom; { + // Fix issue 168 (Plugins can't read private tags from the + // configuration file) + // https://bitbucket.org/sjodogne/orthanc/issues/168/ + std::string privateCreator; + { + OrthancConfiguration::ReaderLock lock; + privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); + } + std::auto_ptr<ParsedDicomFile> file (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags), - "" /* TODO - private creator */)); + privateCreator)); if (p.pixelData) { @@ -3224,7 +3233,25 @@ DcmTagKey tag2(tag.GetGroup(), tag.GetElement()); DictionaryReadLocker locker; - const DcmDictEntry* entry = locker->findEntry(tag2, NULL); + const DcmDictEntry* entry = NULL; + + if (tag.IsPrivate()) + { + // Fix issue 168 (Plugins can't read private tags from the + // configuration file) + // https://bitbucket.org/sjodogne/orthanc/issues/168/ + std::string privateCreator; + { + OrthancConfiguration::ReaderLock lock; + privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); + } + + entry = locker->findEntry(tag2, privateCreator.c_str()); + } + else + { + entry = locker->findEntry(tag2, NULL); + } if (entry == NULL) {
--- a/Resources/Configuration.json Thu Feb 27 17:06:45 2020 +0100 +++ b/Resources/Configuration.json Fri Feb 28 13:27:16 2020 +0100 @@ -522,5 +522,10 @@ // to option "request_timeout_ms" of Mongoose/Civetweb. It will set // the socket options "SO_RCVTIMEO" and "SO_SNDTIMEO" to the // specified value. - "HttpRequestTimeout" : 30 + "HttpRequestTimeout" : 30, + + // Set the default private creator that is used by Orthanc when it + // looks for a private tag in its dictionary (cf. "Dictionary" + // option), or when it creates/modifies a DICOM file (new in Orthanc 1.6.0). + "DefaultPrivateCreator" : "" }