Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 3709:1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Feb 2020 13:23:11 +0100 |
parents | 4922bdd046dd |
children | 2a170a8f1faf |
comparison
equal
deleted
inserted
replaced
3708:bc25deb40302 | 3709:1f4910999fe7 |
---|---|
35 #include "OrthancRestApi.h" | 35 #include "OrthancRestApi.h" |
36 | 36 |
37 #include "../../Core/DicomParsing/FromDcmtkBridge.h" | 37 #include "../../Core/DicomParsing/FromDcmtkBridge.h" |
38 #include "../../Core/Logging.h" | 38 #include "../../Core/Logging.h" |
39 #include "../../Core/SerializationToolbox.h" | 39 #include "../../Core/SerializationToolbox.h" |
40 #include "../OrthancConfiguration.h" | |
40 #include "../ServerContext.h" | 41 #include "../ServerContext.h" |
41 #include "../ServerJobs/MergeStudyJob.h" | 42 #include "../ServerJobs/MergeStudyJob.h" |
42 #include "../ServerJobs/ResourceModificationJob.h" | 43 #include "../ServerJobs/ResourceModificationJob.h" |
43 #include "../ServerJobs/SplitStudyJob.h" | 44 #include "../ServerJobs/SplitStudyJob.h" |
44 | 45 |
61 DicomModification& target, | 62 DicomModification& target, |
62 const RestApiPostCall& call) | 63 const RestApiPostCall& call) |
63 { | 64 { |
64 // curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"},"Priority":9}' | 65 // curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"},"Priority":9}' |
65 | 66 |
67 { | |
68 OrthancConfiguration::ReaderLock lock; | |
69 target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator()); | |
70 } | |
71 | |
66 if (call.ParseJsonRequest(request)) | 72 if (call.ParseJsonRequest(request)) |
67 { | 73 { |
68 target.ParseModifyRequest(request); | 74 target.ParseModifyRequest(request); |
69 } | 75 } |
70 else | 76 else |
78 DicomModification& target, | 84 DicomModification& target, |
79 RestApiPostCall& call) | 85 RestApiPostCall& call) |
80 { | 86 { |
81 // 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 | 87 // 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 |
82 | 88 |
89 { | |
90 OrthancConfiguration::ReaderLock lock; | |
91 target.SetPrivateCreator(lock.GetConfiguration().GetDefaultPrivateCreator()); | |
92 } | |
93 | |
83 if (call.ParseJsonRequest(request) && | 94 if (call.ParseJsonRequest(request) && |
84 request.isObject()) | 95 request.isObject()) |
85 { | 96 { |
86 bool patientNameReplaced; | 97 bool patientNameReplaced; |
87 target.ParseAnonymizationRequest(patientNameReplaced, request); | 98 target.ParseAnonymizationRequest(patientNameReplaced, request); |
551 throw OrthancException(ErrorCode_BadRequest); | 562 throw OrthancException(ErrorCode_BadRequest); |
552 } | 563 } |
553 | 564 |
554 privateCreator = v.asString(); | 565 privateCreator = v.asString(); |
555 } | 566 } |
567 else | |
568 { | |
569 OrthancConfiguration::ReaderLock lock; | |
570 privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator(); | |
571 } | |
556 | 572 |
557 | 573 |
558 // Inject time-related information | 574 // Inject time-related information |
559 std::string date, time; | 575 std::string date, time; |
560 SystemToolbox::GetNowDicom(date, time, true /* use UTC time (not local time) */); | 576 SystemToolbox::GetNowDicom(date, time, true /* use UTC time (not local time) */); |