Mercurial > hg > orthanc
annotate Core/DicomParsing/DicomModification.cpp @ 3860:9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 24 Apr 2020 17:30:41 +0200 |
parents | 2a170a8f1faf |
children |
rev | line source |
---|---|
786 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3513
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
786 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2323
diff
changeset
|
34 #include "../PrecompiledHeaders.h" |
786 | 35 #include "DicomModification.h" |
36 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
37 #include "../Compatibility.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2323
diff
changeset
|
38 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2323
diff
changeset
|
39 #include "../OrthancException.h" |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
40 #include "../SerializationToolbox.h" |
790 | 41 #include "FromDcmtkBridge.h" |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
42 #include "ITagVisitor.h" |
786 | 43 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
44 #include <memory> // For std::unique_ptr |
795 | 45 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
46 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
47 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2008 = |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
48 "Orthanc " ORTHANC_VERSION " - PS 3.15-2008 Table E.1-1"; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
49 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
50 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2017c = |
2314 | 51 "Orthanc " ORTHANC_VERSION " - PS 3.15-2017c Table E.1-1 Basic Profile"; |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
52 |
786 | 53 namespace Orthanc |
54 { | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
55 class DicomModification::RelationshipsVisitor : public ITagVisitor |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
56 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
57 private: |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
58 DicomModification& that_; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
59 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
60 bool IsEnabled(const DicomTag& tag) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
61 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
62 return (!that_.IsCleared(tag) && |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
63 !that_.IsRemoved(tag) && |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
64 !that_.IsReplaced(tag)); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
65 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
66 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
67 void RemoveIfEnabled(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
68 const DicomTag& tag) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
69 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
70 if (IsEnabled(tag)) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
71 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
72 dicom.Remove(tag); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
73 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
74 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
75 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
76 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
77 public: |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
78 RelationshipsVisitor(DicomModification& that) : |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
79 that_(that) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
80 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
81 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
82 |
3195 | 83 virtual void VisitNotSupported(const std::vector<DicomTag>& parentTags, |
84 const std::vector<size_t>& parentIndexes, | |
85 const DicomTag& tag, | |
86 ValueRepresentation vr) | |
87 { | |
88 } | |
89 | |
90 virtual void VisitEmptySequence(const std::vector<DicomTag>& parentTags, | |
91 const std::vector<size_t>& parentIndexes, | |
92 const DicomTag& tag) | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
93 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
94 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
95 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
96 virtual void VisitBinary(const std::vector<DicomTag>& parentTags, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
97 const std::vector<size_t>& parentIndexes, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
98 const DicomTag& tag, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
99 ValueRepresentation vr, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
100 const void* data, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
101 size_t size) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
102 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
103 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
104 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
105 virtual void VisitIntegers(const std::vector<DicomTag>& parentTags, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
106 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
107 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
108 ValueRepresentation vr, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
109 const std::vector<int64_t>& values) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
110 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
111 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
112 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
113 virtual void VisitDoubles(const std::vector<DicomTag>& parentTags, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
114 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
115 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
116 ValueRepresentation vr, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
117 const std::vector<double>& value) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
118 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
119 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
120 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
121 virtual void VisitAttributes(const std::vector<DicomTag>& parentTags, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
122 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
123 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
124 const std::vector<DicomTag>& value) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
125 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
126 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
127 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
128 virtual Action VisitString(std::string& newValue, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
129 const std::vector<DicomTag>& parentTags, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
130 const std::vector<size_t>& parentIndexes, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
131 const DicomTag& tag, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
132 ValueRepresentation vr, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
133 const std::string& value) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
134 { |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
135 if (!IsEnabled(tag)) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
136 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
137 return Action_None; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
138 } |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
139 else if (parentTags.size() == 2 && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
140 parentTags[0] == DICOM_TAG_REFERENCED_FRAME_OF_REFERENCE_SEQUENCE && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
141 parentTags[1] == DICOM_TAG_RT_REFERENCED_STUDY_SEQUENCE && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
142 tag == DICOM_TAG_REFERENCED_SOP_INSTANCE_UID) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
143 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
144 // in RT-STRUCT, this ReferencedSOPInstanceUID is actually referencing a StudyInstanceUID !! |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
145 // (observed in many data sets including: https://wiki.cancerimagingarchive.net/display/Public/Lung+CT+Segmentation+Challenge+2017) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
146 // tested in test_anonymize_relationships_5 |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
147 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Study); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
148 return Action_Replace; |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
149 } |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
150 else if (tag == DICOM_TAG_FRAME_OF_REFERENCE_UID || |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
151 tag == DICOM_TAG_REFERENCED_FRAME_OF_REFERENCE_UID || |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
152 tag == DICOM_TAG_REFERENCED_SOP_INSTANCE_UID || |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
153 tag == DICOM_TAG_RELATED_FRAME_OF_REFERENCE_UID) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
154 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
155 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Instance); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
156 return Action_Replace; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
157 } |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
158 else if (parentTags.size() == 1 && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
159 parentTags[0] == DICOM_TAG_CURRENT_REQUESTED_PROCEDURE_EVIDENCE_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
160 tag == DICOM_TAG_STUDY_INSTANCE_UID) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
161 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
162 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Study); |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
163 return Action_Replace; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
164 } |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
165 else if (parentTags.size() == 2 && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
166 parentTags[0] == DICOM_TAG_CURRENT_REQUESTED_PROCEDURE_EVIDENCE_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
167 parentTags[1] == DICOM_TAG_REFERENCED_SERIES_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
168 tag == DICOM_TAG_SERIES_INSTANCE_UID) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
169 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
170 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Series); |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
171 return Action_Replace; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
172 } |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
173 else if (parentTags.size() == 3 && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
174 parentTags[0] == DICOM_TAG_REFERENCED_FRAME_OF_REFERENCE_SEQUENCE && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
175 parentTags[1] == DICOM_TAG_RT_REFERENCED_STUDY_SEQUENCE && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
176 parentTags[2] == DICOM_TAG_RT_REFERENCED_SERIES_SEQUENCE && |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
177 tag == DICOM_TAG_SERIES_INSTANCE_UID) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
178 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
179 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Series); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
180 return Action_Replace; |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
181 } |
3344
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
182 else if (parentTags.size() == 1 && |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
183 parentTags[0] == DICOM_TAG_REFERENCED_SERIES_SEQUENCE && |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
184 tag == DICOM_TAG_SERIES_INSTANCE_UID) |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
185 { |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
186 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Series); |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
187 return Action_Replace; |
90b4a5001c24
Anonymization: Preserve hierarchical relationships in (0008,1115) [] (0020,000e)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3195
diff
changeset
|
188 } |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
189 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
190 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
191 return Action_None; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
192 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
193 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
194 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
195 void RemoveRelationships(ParsedDicomFile& dicom) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
196 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
197 // Sequences containing the UID relationships |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
198 RemoveIfEnabled(dicom, DICOM_TAG_REFERENCED_IMAGE_SEQUENCE); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
199 RemoveIfEnabled(dicom, DICOM_TAG_SOURCE_IMAGE_SEQUENCE); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
200 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
201 // Individual tags |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
202 RemoveIfEnabled(dicom, DICOM_TAG_FRAME_OF_REFERENCE_UID); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
203 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
204 // The tags below should never occur at the first level of the |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
205 // hierarchy, but remove them anyway |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
206 RemoveIfEnabled(dicom, DICOM_TAG_REFERENCED_FRAME_OF_REFERENCE_UID); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
207 RemoveIfEnabled(dicom, DICOM_TAG_REFERENCED_SOP_INSTANCE_UID); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
208 RemoveIfEnabled(dicom, DICOM_TAG_RELATED_FRAME_OF_REFERENCE_UID); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
209 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
210 }; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
211 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
212 |
2323 | 213 bool DicomModification::CancelReplacement(const DicomTag& tag) |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
214 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
215 Replacements::iterator it = replacements_.find(tag); |
2323 | 216 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
217 if (it != replacements_.end()) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
218 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
219 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
220 replacements_.erase(it); |
2323 | 221 return true; |
222 } | |
223 else | |
224 { | |
225 return false; | |
226 } | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
227 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
228 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
229 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
230 void DicomModification::ReplaceInternal(const DicomTag& tag, |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
231 const Json::Value& value) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
232 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
233 Replacements::iterator it = replacements_.find(tag); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
234 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
235 if (it != replacements_.end()) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
236 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
237 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
238 it->second = NULL; // In the case of an exception during the clone |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
239 it->second = new Json::Value(value); // Clone |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
240 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
241 else |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
242 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
243 replacements_[tag] = new Json::Value(value); // Clone |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
244 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
245 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
246 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
247 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
248 void DicomModification::ClearReplacements() |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
249 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
250 for (Replacements::iterator it = replacements_.begin(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
251 it != replacements_.end(); ++it) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
252 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
253 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
254 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
255 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
256 replacements_.clear(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
257 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
258 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
259 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
260 void DicomModification::MarkNotOrthancAnonymization() |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
261 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
262 Replacements::iterator it = replacements_.find(DICOM_TAG_DEIDENTIFICATION_METHOD); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
263 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
264 if (it != replacements_.end() && |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
265 (it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2008 || |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
266 it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2017c)) |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
267 { |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
268 delete it->second; |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
269 replacements_.erase(it); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
270 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
271 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
272 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
273 void DicomModification::RegisterMappedDicomIdentifier(const std::string& original, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
274 const std::string& mapped, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
275 ResourceType level) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
276 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
277 UidMap::const_iterator previous = uidMap_.find(std::make_pair(level, original)); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
278 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
279 if (previous == uidMap_.end()) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
280 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
281 uidMap_.insert(std::make_pair(std::make_pair(level, original), mapped)); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
282 } |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
283 } |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
284 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
285 std::string DicomModification::MapDicomIdentifier(const std::string& original, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
286 ResourceType level) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
287 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
288 std::string mapped; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
289 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
290 UidMap::const_iterator previous = uidMap_.find(std::make_pair(level, original)); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
291 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
292 if (previous == uidMap_.end()) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
293 { |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
294 if (identifierGenerator_ == NULL) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
295 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
296 mapped = FromDcmtkBridge::GenerateUniqueIdentifier(level); |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
297 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
298 else |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
299 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
300 if (!identifierGenerator_->Apply(mapped, original, level, currentSource_)) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
301 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
302 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
303 "Unable to generate an anonymized ID"); |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
304 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
305 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
306 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
307 uidMap_.insert(std::make_pair(std::make_pair(level, original), mapped)); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
308 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
309 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
310 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
311 mapped = previous->second; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
312 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
313 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
314 return mapped; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
315 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
316 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
317 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
318 void DicomModification::MapDicomTags(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
319 ResourceType level) |
786 | 320 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3709
diff
changeset
|
321 std::unique_ptr<DicomTag> tag; |
786 | 322 |
323 switch (level) | |
324 { | |
788 | 325 case ResourceType_Study: |
786 | 326 tag.reset(new DicomTag(DICOM_TAG_STUDY_INSTANCE_UID)); |
327 break; | |
328 | |
788 | 329 case ResourceType_Series: |
786 | 330 tag.reset(new DicomTag(DICOM_TAG_SERIES_INSTANCE_UID)); |
331 break; | |
332 | |
788 | 333 case ResourceType_Instance: |
786 | 334 tag.reset(new DicomTag(DICOM_TAG_SOP_INSTANCE_UID)); |
335 break; | |
336 | |
337 default: | |
338 throw OrthancException(ErrorCode_InternalError); | |
339 } | |
340 | |
341 std::string original; | |
342 if (!dicom.GetTagValue(original, *tag)) | |
343 { | |
344 original = ""; | |
345 } | |
346 | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
347 std::string mapped = MapDicomIdentifier(Toolbox::StripSpaces(original), level); |
786 | 348 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
349 dicom.Replace(*tag, mapped, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
350 false /* don't try and decode data URI scheme for UIDs */, |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
351 DicomReplaceMode_InsertIfAbsent, privateCreator_); |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
352 } |
786 | 353 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
354 |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
355 DicomModification::DicomModification() : |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
356 removePrivateTags_(false), |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
357 level_(ResourceType_Instance), |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
358 allowManualIdentifiers_(true), |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
359 keepStudyInstanceUid_(false), |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
360 keepSeriesInstanceUid_(false), |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
361 keepSopInstanceUid_(false), |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
362 updateReferencedRelationships_(true), |
2721 | 363 isAnonymization_(false), |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
364 //privateCreator_("PrivateCreator"), |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
365 identifierGenerator_(NULL) |
786 | 366 { |
367 } | |
368 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
369 DicomModification::~DicomModification() |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
370 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
371 ClearReplacements(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
372 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
373 |
787
ac18946afa74
refactoring of anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
786
diff
changeset
|
374 void DicomModification::Keep(const DicomTag& tag) |
786 | 375 { |
2323 | 376 bool wasRemoved = IsRemoved(tag); |
377 bool wasCleared = IsCleared(tag); | |
378 | |
786 | 379 removals_.erase(tag); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
380 clearings_.erase(tag); |
2323 | 381 |
382 bool wasReplaced = CancelReplacement(tag); | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
383 |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
384 if (tag == DICOM_TAG_STUDY_INSTANCE_UID) |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
385 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
386 keepStudyInstanceUid_ = true; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
387 } |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
388 else if (tag == DICOM_TAG_SERIES_INSTANCE_UID) |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
389 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
390 keepSeriesInstanceUid_ = true; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
391 } |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
392 else if (tag == DICOM_TAG_SOP_INSTANCE_UID) |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
393 { |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
394 keepSopInstanceUid_ = true; |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
395 } |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
396 else if (tag.IsPrivate()) |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
397 { |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
398 privateTagsToKeep_.insert(tag); |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
399 } |
2323 | 400 else if (!wasRemoved && |
401 !wasReplaced && | |
402 !wasCleared) | |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
403 { |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
404 LOG(WARNING) << "Marking this tag as to be kept has no effect: " << tag.Format(); |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
405 } |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
406 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
407 MarkNotOrthancAnonymization(); |
786 | 408 } |
409 | |
410 void DicomModification::Remove(const DicomTag& tag) | |
411 { | |
412 removals_.insert(tag); | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
413 clearings_.erase(tag); |
2323 | 414 CancelReplacement(tag); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
415 privateTagsToKeep_.erase(tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
416 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
417 MarkNotOrthancAnonymization(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
418 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
419 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
420 void DicomModification::Clear(const DicomTag& tag) |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
421 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
422 removals_.erase(tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
423 clearings_.insert(tag); |
2323 | 424 CancelReplacement(tag); |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
425 privateTagsToKeep_.erase(tag); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
426 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
427 MarkNotOrthancAnonymization(); |
786 | 428 } |
429 | |
430 bool DicomModification::IsRemoved(const DicomTag& tag) const | |
431 { | |
432 return removals_.find(tag) != removals_.end(); | |
433 } | |
434 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
435 bool DicomModification::IsCleared(const DicomTag& tag) const |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
436 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
437 return clearings_.find(tag) != clearings_.end(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
438 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
439 |
786 | 440 void DicomModification::Replace(const DicomTag& tag, |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
441 const Json::Value& value, |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
442 bool safeForAnonymization) |
786 | 443 { |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
444 clearings_.erase(tag); |
786 | 445 removals_.erase(tag); |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
446 privateTagsToKeep_.erase(tag); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
447 ReplaceInternal(tag, value); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
448 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
449 if (!safeForAnonymization) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
450 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
451 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
452 } |
786 | 453 } |
454 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
455 |
786 | 456 bool DicomModification::IsReplaced(const DicomTag& tag) const |
457 { | |
458 return replacements_.find(tag) != replacements_.end(); | |
459 } | |
460 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
461 const Json::Value& DicomModification::GetReplacement(const DicomTag& tag) const |
786 | 462 { |
463 Replacements::const_iterator it = replacements_.find(tag); | |
464 | |
465 if (it == replacements_.end()) | |
466 { | |
467 throw OrthancException(ErrorCode_InexistentItem); | |
468 } | |
469 else | |
470 { | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
471 return *it->second; |
786 | 472 } |
473 } | |
474 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
475 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
476 std::string DicomModification::GetReplacementAsString(const DicomTag& tag) const |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
477 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
478 const Json::Value& json = GetReplacement(tag); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
479 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
480 if (json.type() != Json::stringValue) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
481 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
482 throw OrthancException(ErrorCode_BadParameterType); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
483 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
484 else |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
485 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
486 return json.asString(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
487 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
488 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
489 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
490 |
786 | 491 void DicomModification::SetRemovePrivateTags(bool removed) |
492 { | |
493 removePrivateTags_ = removed; | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
494 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
495 if (!removed) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
496 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
497 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
498 } |
786 | 499 } |
500 | |
788 | 501 void DicomModification::SetLevel(ResourceType level) |
786 | 502 { |
503 uidMap_.clear(); | |
504 level_ = level; | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
505 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
506 if (level != ResourceType_Patient) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
507 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
508 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
509 } |
786 | 510 } |
511 | |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
512 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
513 void DicomModification::SetupAnonymization2008() |
786 | 514 { |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
515 // This is Table E.1-1 from PS 3.15-2008 - DICOM Part 15: Security and System Management Profiles |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
516 // https://raw.githubusercontent.com/jodogne/dicom-specification/master/2008/08_15pu.pdf |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
517 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
518 removals_.insert(DicomTag(0x0008, 0x0014)); // Instance Creator UID |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
519 //removals_.insert(DicomTag(0x0008, 0x0018)); // SOP Instance UID => set in Apply() |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
520 removals_.insert(DicomTag(0x0008, 0x0050)); // Accession Number |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
521 removals_.insert(DicomTag(0x0008, 0x0080)); // Institution Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
522 removals_.insert(DicomTag(0x0008, 0x0081)); // Institution Address |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
523 removals_.insert(DicomTag(0x0008, 0x0090)); // Referring Physician's Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
524 removals_.insert(DicomTag(0x0008, 0x0092)); // Referring Physician's Address |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
525 removals_.insert(DicomTag(0x0008, 0x0094)); // Referring Physician's Telephone Numbers |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
526 removals_.insert(DicomTag(0x0008, 0x1010)); // Station Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
527 removals_.insert(DicomTag(0x0008, 0x1030)); // Study Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
528 removals_.insert(DicomTag(0x0008, 0x103e)); // Series Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
529 removals_.insert(DicomTag(0x0008, 0x1040)); // Institutional Department Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
530 removals_.insert(DicomTag(0x0008, 0x1048)); // Physician(s) of Record |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
531 removals_.insert(DicomTag(0x0008, 0x1050)); // Performing Physicians' Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
532 removals_.insert(DicomTag(0x0008, 0x1060)); // Name of Physician(s) Reading Study |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
533 removals_.insert(DicomTag(0x0008, 0x1070)); // Operators' Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
534 removals_.insert(DicomTag(0x0008, 0x1080)); // Admitting Diagnoses Description |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
535 //removals_.insert(DicomTag(0x0008, 0x1155)); // Referenced SOP Instance UID => RelationshipsVisitor |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
536 removals_.insert(DicomTag(0x0008, 0x2111)); // Derivation Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
537 //removals_.insert(DicomTag(0x0010, 0x0010)); // Patient's Name => cf. below (*) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
538 //removals_.insert(DicomTag(0x0010, 0x0020)); // Patient ID => cf. below (*) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
539 removals_.insert(DicomTag(0x0010, 0x0030)); // Patient's Birth Date |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
540 removals_.insert(DicomTag(0x0010, 0x0032)); // Patient's Birth Time |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
541 removals_.insert(DicomTag(0x0010, 0x0040)); // Patient's Sex |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
542 removals_.insert(DicomTag(0x0010, 0x1000)); // Other Patient Ids |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
543 removals_.insert(DicomTag(0x0010, 0x1001)); // Other Patient Names |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
544 removals_.insert(DicomTag(0x0010, 0x1010)); // Patient's Age |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
545 removals_.insert(DicomTag(0x0010, 0x1020)); // Patient's Size |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
546 removals_.insert(DicomTag(0x0010, 0x1030)); // Patient's Weight |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
547 removals_.insert(DicomTag(0x0010, 0x1090)); // Medical Record Locator |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
548 removals_.insert(DicomTag(0x0010, 0x2160)); // Ethnic Group |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
549 removals_.insert(DicomTag(0x0010, 0x2180)); // Occupation |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
550 removals_.insert(DicomTag(0x0010, 0x21b0)); // Additional Patient's History |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
551 removals_.insert(DicomTag(0x0010, 0x4000)); // Patient Comments |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
552 removals_.insert(DicomTag(0x0018, 0x1000)); // Device Serial Number |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
553 removals_.insert(DicomTag(0x0018, 0x1030)); // Protocol Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
554 //removals_.insert(DicomTag(0x0020, 0x000d)); // Study Instance UID => set in Apply() |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
555 //removals_.insert(DicomTag(0x0020, 0x000e)); // Series Instance UID => set in Apply() |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
556 removals_.insert(DicomTag(0x0020, 0x0010)); // Study ID |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
557 //removals_.insert(DicomTag(0x0020, 0x0052)); // Frame of Reference UID => cf. RelationshipsVisitor |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
558 removals_.insert(DicomTag(0x0020, 0x0200)); // Synchronization Frame of Reference UID |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
559 removals_.insert(DicomTag(0x0020, 0x4000)); // Image Comments |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
560 removals_.insert(DicomTag(0x0040, 0x0275)); // Request Attributes Sequence |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
561 removals_.insert(DicomTag(0x0040, 0xa124)); // UID |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
562 removals_.insert(DicomTag(0x0040, 0xa730)); // Content Sequence |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
563 removals_.insert(DicomTag(0x0088, 0x0140)); // Storage Media File-set UID |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
564 //removals_.insert(DicomTag(0x3006, 0x0024)); // Referenced Frame of Reference UID => RelationshipsVisitor |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
565 //removals_.insert(DicomTag(0x3006, 0x00c2)); // Related Frame of Reference UID => RelationshipsVisitor |
786 | 566 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
567 // Some more removals (from the experience of DICOM files at the CHU of Liege) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
568 removals_.insert(DicomTag(0x0010, 0x1040)); // Patient's Address |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
569 removals_.insert(DicomTag(0x0032, 0x1032)); // Requesting Physician |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
570 removals_.insert(DicomTag(0x0010, 0x2154)); // PatientTelephoneNumbers |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
571 removals_.insert(DicomTag(0x0010, 0x2000)); // Medical Alerts |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
572 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
573 // Set the DeidentificationMethod tag |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
574 ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2008); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
575 } |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
576 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
577 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
578 void DicomModification::SetupAnonymization2017c() |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
579 { |
2313
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
580 /** |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
581 * This is Table E.1-1 from PS 3.15-2017c (DICOM Part 15: Security |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
582 * and System Management Profiles), "basic profile" column. It was |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
583 * generated automatically with the |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
584 * "../Resources/GenerateAnonymizationProfile.py" script. |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
585 * https://raw.githubusercontent.com/jodogne/dicom-specification/master/2017c/part15.pdf |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
586 **/ |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
587 |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
588 // TODO: (50xx,xxxx) with rule X // Curve Data |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
589 // TODO: (60xx,3000) with rule X // Overlay Data |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
590 // TODO: (60xx,4000) with rule X // Overlay Comments |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
591 // Tag (0x0008, 0x0018) is set in Apply() /* U */ // SOP Instance UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
592 // Tag (0x0008, 0x1140) => RelationshipsVisitor /* X/Z/U* */ // Referenced Image Sequence |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
593 // Tag (0x0008, 0x1155) => RelationshipsVisitor /* U */ // Referenced SOP Instance UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
594 // Tag (0x0008, 0x2112) => RelationshipsVisitor /* X/Z/U* */ // Source Image Sequence |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
595 // Tag (0x0010, 0x0010) is set below (*) /* Z */ // Patient's Name |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
596 // Tag (0x0010, 0x0020) is set below (*) /* Z */ // Patient ID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
597 // Tag (0x0020, 0x000d) is set in Apply() /* U */ // Study Instance UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
598 // Tag (0x0020, 0x000e) is set in Apply() /* U */ // Series Instance UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
599 // Tag (0x0020, 0x0052) => RelationshipsVisitor /* U */ // Frame of Reference UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
600 // Tag (0x3006, 0x0024) => RelationshipsVisitor /* U */ // Referenced Frame of Reference UID |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
601 // Tag (0x3006, 0x00c2) => RelationshipsVisitor /* U */ // Related Frame of Reference UID |
2313
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
602 clearings_.insert(DicomTag(0x0008, 0x0020)); // Study Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
603 clearings_.insert(DicomTag(0x0008, 0x0023)); /* Z/D */ // Content Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
604 clearings_.insert(DicomTag(0x0008, 0x0030)); // Study Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
605 clearings_.insert(DicomTag(0x0008, 0x0033)); /* Z/D */ // Content Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
606 clearings_.insert(DicomTag(0x0008, 0x0050)); // Accession Number |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
607 clearings_.insert(DicomTag(0x0008, 0x0090)); // Referring Physician's Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
608 clearings_.insert(DicomTag(0x0008, 0x009c)); // Consulting Physician's Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
609 clearings_.insert(DicomTag(0x0010, 0x0030)); // Patient's Birth Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
610 clearings_.insert(DicomTag(0x0010, 0x0040)); // Patient's Sex |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
611 clearings_.insert(DicomTag(0x0018, 0x0010)); /* Z/D */ // Contrast Bolus Agent |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
612 clearings_.insert(DicomTag(0x0020, 0x0010)); // Study ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
613 clearings_.insert(DicomTag(0x0040, 0x1101)); /* D */ // Person Identification Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
614 clearings_.insert(DicomTag(0x0040, 0x2016)); // Placer Order Number / Imaging Service Request |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
615 clearings_.insert(DicomTag(0x0040, 0x2017)); // Filler Order Number / Imaging Service Request |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
616 clearings_.insert(DicomTag(0x0040, 0xa073)); /* D */ // Verifying Observer Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
617 clearings_.insert(DicomTag(0x0040, 0xa075)); /* D */ // Verifying Observer Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
618 clearings_.insert(DicomTag(0x0040, 0xa088)); // Verifying Observer Identification Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
619 clearings_.insert(DicomTag(0x0040, 0xa123)); /* D */ // Person Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
620 clearings_.insert(DicomTag(0x0070, 0x0001)); /* D */ // Graphic Annotation Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
621 clearings_.insert(DicomTag(0x0070, 0x0084)); // Content Creator's Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
622 removals_.insert(DicomTag(0x0000, 0x1000)); // Affected SOP Instance UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
623 removals_.insert(DicomTag(0x0000, 0x1001)); /* TODO UID */ // Requested SOP Instance UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
624 removals_.insert(DicomTag(0x0002, 0x0003)); /* TODO UID */ // Media Storage SOP Instance UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
625 removals_.insert(DicomTag(0x0004, 0x1511)); /* TODO UID */ // Referenced SOP Instance UID in File |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
626 removals_.insert(DicomTag(0x0008, 0x0014)); /* TODO UID */ // Instance Creator UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
627 removals_.insert(DicomTag(0x0008, 0x0015)); // Instance Coercion DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
628 removals_.insert(DicomTag(0x0008, 0x0021)); /* X/D */ // Series Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
629 removals_.insert(DicomTag(0x0008, 0x0022)); /* X/Z */ // Acquisition Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
630 removals_.insert(DicomTag(0x0008, 0x0024)); // Overlay Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
631 removals_.insert(DicomTag(0x0008, 0x0025)); // Curve Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
632 removals_.insert(DicomTag(0x0008, 0x002a)); /* X/D */ // Acquisition DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
633 removals_.insert(DicomTag(0x0008, 0x0031)); /* X/D */ // Series Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
634 removals_.insert(DicomTag(0x0008, 0x0032)); /* X/Z */ // Acquisition Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
635 removals_.insert(DicomTag(0x0008, 0x0034)); // Overlay Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
636 removals_.insert(DicomTag(0x0008, 0x0035)); // Curve Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
637 removals_.insert(DicomTag(0x0008, 0x0058)); /* TODO UID */ // Failed SOP Instance UID List |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
638 removals_.insert(DicomTag(0x0008, 0x0080)); /* X/Z/D */ // Institution Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
639 removals_.insert(DicomTag(0x0008, 0x0081)); // Institution Address |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
640 removals_.insert(DicomTag(0x0008, 0x0082)); /* X/Z/D */ // Institution Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
641 removals_.insert(DicomTag(0x0008, 0x0092)); // Referring Physician's Address |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
642 removals_.insert(DicomTag(0x0008, 0x0094)); // Referring Physician's Telephone Numbers |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
643 removals_.insert(DicomTag(0x0008, 0x0096)); // Referring Physician Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
644 removals_.insert(DicomTag(0x0008, 0x009d)); // Consulting Physician Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
645 removals_.insert(DicomTag(0x0008, 0x0201)); // Timezone Offset From UTC |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
646 removals_.insert(DicomTag(0x0008, 0x1010)); /* X/Z/D */ // Station Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
647 removals_.insert(DicomTag(0x0008, 0x1030)); // Study Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
648 removals_.insert(DicomTag(0x0008, 0x103e)); // Series Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
649 removals_.insert(DicomTag(0x0008, 0x1040)); // Institutional Department Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
650 removals_.insert(DicomTag(0x0008, 0x1048)); // Physician(s) of Record |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
651 removals_.insert(DicomTag(0x0008, 0x1049)); // Physician(s) of Record Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
652 removals_.insert(DicomTag(0x0008, 0x1050)); // Performing Physicians' Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
653 removals_.insert(DicomTag(0x0008, 0x1052)); // Performing Physician Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
654 removals_.insert(DicomTag(0x0008, 0x1060)); // Name of Physician(s) Reading Study |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
655 removals_.insert(DicomTag(0x0008, 0x1062)); // Physician(s) Reading Study Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
656 removals_.insert(DicomTag(0x0008, 0x1070)); /* X/Z/D */ // Operators' Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
657 removals_.insert(DicomTag(0x0008, 0x1072)); /* X/D */ // Operators' Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
658 removals_.insert(DicomTag(0x0008, 0x1080)); // Admitting Diagnoses Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
659 removals_.insert(DicomTag(0x0008, 0x1084)); // Admitting Diagnoses Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
660 removals_.insert(DicomTag(0x0008, 0x1110)); /* X/Z */ // Referenced Study Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
661 removals_.insert(DicomTag(0x0008, 0x1111)); /* X/Z/D */ // Referenced Performed Procedure Step Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
662 removals_.insert(DicomTag(0x0008, 0x1120)); // Referenced Patient Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
663 removals_.insert(DicomTag(0x0008, 0x1195)); /* TODO UID */ // Transaction UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
664 removals_.insert(DicomTag(0x0008, 0x2111)); // Derivation Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
665 removals_.insert(DicomTag(0x0008, 0x3010)); /* TODO UID */ // Irradiation Event UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
666 removals_.insert(DicomTag(0x0008, 0x4000)); // Identifying Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
667 removals_.insert(DicomTag(0x0010, 0x0021)); // Issuer of Patient ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
668 removals_.insert(DicomTag(0x0010, 0x0032)); // Patient's Birth Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
669 removals_.insert(DicomTag(0x0010, 0x0050)); // Patient's Insurance Plan Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
670 removals_.insert(DicomTag(0x0010, 0x0101)); // Patient's Primary Language Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
671 removals_.insert(DicomTag(0x0010, 0x0102)); // Patient's Primary Language Modifier Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
672 removals_.insert(DicomTag(0x0010, 0x1000)); // Other Patient IDs |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
673 removals_.insert(DicomTag(0x0010, 0x1001)); // Other Patient Names |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
674 removals_.insert(DicomTag(0x0010, 0x1002)); // Other Patient IDs Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
675 removals_.insert(DicomTag(0x0010, 0x1005)); // Patient's Birth Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
676 removals_.insert(DicomTag(0x0010, 0x1010)); // Patient's Age |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
677 removals_.insert(DicomTag(0x0010, 0x1020)); // Patient's Size |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
678 removals_.insert(DicomTag(0x0010, 0x1030)); // Patient's Weight |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
679 removals_.insert(DicomTag(0x0010, 0x1040)); // Patient Address |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
680 removals_.insert(DicomTag(0x0010, 0x1050)); // Insurance Plan Identification |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
681 removals_.insert(DicomTag(0x0010, 0x1060)); // Patient's Mother's Birth Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
682 removals_.insert(DicomTag(0x0010, 0x1080)); // Military Rank |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
683 removals_.insert(DicomTag(0x0010, 0x1081)); // Branch of Service |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
684 removals_.insert(DicomTag(0x0010, 0x1090)); // Medical Record Locator |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
685 removals_.insert(DicomTag(0x0010, 0x1100)); // Referenced Patient Photo Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
686 removals_.insert(DicomTag(0x0010, 0x2000)); // Medical Alerts |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
687 removals_.insert(DicomTag(0x0010, 0x2110)); // Allergies |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
688 removals_.insert(DicomTag(0x0010, 0x2150)); // Country of Residence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
689 removals_.insert(DicomTag(0x0010, 0x2152)); // Region of Residence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
690 removals_.insert(DicomTag(0x0010, 0x2154)); // Patient's Telephone Numbers |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
691 removals_.insert(DicomTag(0x0010, 0x2155)); // Patient's Telecom Information |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
692 removals_.insert(DicomTag(0x0010, 0x2160)); // Ethnic Group |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
693 removals_.insert(DicomTag(0x0010, 0x2180)); // Occupation |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
694 removals_.insert(DicomTag(0x0010, 0x21a0)); // Smoking Status |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
695 removals_.insert(DicomTag(0x0010, 0x21b0)); // Additional Patient's History |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
696 removals_.insert(DicomTag(0x0010, 0x21c0)); // Pregnancy Status |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
697 removals_.insert(DicomTag(0x0010, 0x21d0)); // Last Menstrual Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
698 removals_.insert(DicomTag(0x0010, 0x21f0)); // Patient's Religious Preference |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
699 removals_.insert(DicomTag(0x0010, 0x2203)); /* X/Z */ // Patient Sex Neutered |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
700 removals_.insert(DicomTag(0x0010, 0x2297)); // Responsible Person |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
701 removals_.insert(DicomTag(0x0010, 0x2299)); // Responsible Organization |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
702 removals_.insert(DicomTag(0x0010, 0x4000)); // Patient Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
703 removals_.insert(DicomTag(0x0018, 0x1000)); /* X/Z/D */ // Device Serial Number |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
704 removals_.insert(DicomTag(0x0018, 0x1002)); /* TODO UID */ // Device UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
705 removals_.insert(DicomTag(0x0018, 0x1004)); // Plate ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
706 removals_.insert(DicomTag(0x0018, 0x1005)); // Generator ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
707 removals_.insert(DicomTag(0x0018, 0x1007)); // Cassette ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
708 removals_.insert(DicomTag(0x0018, 0x1008)); // Gantry ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
709 removals_.insert(DicomTag(0x0018, 0x1030)); /* X/D */ // Protocol Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
710 removals_.insert(DicomTag(0x0018, 0x1400)); /* X/D */ // Acquisition Device Processing Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
711 removals_.insert(DicomTag(0x0018, 0x2042)); /* TODO UID */ // Target UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
712 removals_.insert(DicomTag(0x0018, 0x4000)); // Acquisition Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
713 removals_.insert(DicomTag(0x0018, 0x700a)); /* X/D */ // Detector ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
714 removals_.insert(DicomTag(0x0018, 0x9424)); // Acquisition Protocol Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
715 removals_.insert(DicomTag(0x0018, 0x9516)); /* X/D */ // Start Acquisition DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
716 removals_.insert(DicomTag(0x0018, 0x9517)); /* X/D */ // End Acquisition DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
717 removals_.insert(DicomTag(0x0018, 0xa003)); // Contribution Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
718 removals_.insert(DicomTag(0x0020, 0x0200)); /* TODO UID */ // Synchronization Frame of Reference UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
719 removals_.insert(DicomTag(0x0020, 0x3401)); // Modifying Device ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
720 removals_.insert(DicomTag(0x0020, 0x3404)); // Modifying Device Manufacturer |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
721 removals_.insert(DicomTag(0x0020, 0x3406)); // Modified Image Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
722 removals_.insert(DicomTag(0x0020, 0x4000)); // Image Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
723 removals_.insert(DicomTag(0x0020, 0x9158)); // Frame Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
724 removals_.insert(DicomTag(0x0020, 0x9161)); /* TODO UID */ // Concatenation UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
725 removals_.insert(DicomTag(0x0020, 0x9164)); /* TODO UID */ // Dimension Organization UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
726 removals_.insert(DicomTag(0x0028, 0x1199)); /* TODO UID */ // Palette Color Lookup Table UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
727 removals_.insert(DicomTag(0x0028, 0x1214)); /* TODO UID */ // Large Palette Color Lookup Table UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
728 removals_.insert(DicomTag(0x0028, 0x4000)); // Image Presentation Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
729 removals_.insert(DicomTag(0x0032, 0x0012)); // Study ID Issuer |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
730 removals_.insert(DicomTag(0x0032, 0x1020)); // Scheduled Study Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
731 removals_.insert(DicomTag(0x0032, 0x1021)); // Scheduled Study Location AE Title |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
732 removals_.insert(DicomTag(0x0032, 0x1030)); // Reason for Study |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
733 removals_.insert(DicomTag(0x0032, 0x1032)); // Requesting Physician |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
734 removals_.insert(DicomTag(0x0032, 0x1033)); // Requesting Service |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
735 removals_.insert(DicomTag(0x0032, 0x1060)); /* X/Z */ // Requested Procedure Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
736 removals_.insert(DicomTag(0x0032, 0x1070)); // Requested Contrast Agent |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
737 removals_.insert(DicomTag(0x0032, 0x4000)); // Study Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
738 removals_.insert(DicomTag(0x0038, 0x0004)); // Referenced Patient Alias Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
739 removals_.insert(DicomTag(0x0038, 0x0010)); // Admission ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
740 removals_.insert(DicomTag(0x0038, 0x0011)); // Issuer of Admission ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
741 removals_.insert(DicomTag(0x0038, 0x001e)); // Scheduled Patient Institution Residence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
742 removals_.insert(DicomTag(0x0038, 0x0020)); // Admitting Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
743 removals_.insert(DicomTag(0x0038, 0x0021)); // Admitting Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
744 removals_.insert(DicomTag(0x0038, 0x0040)); // Discharge Diagnosis Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
745 removals_.insert(DicomTag(0x0038, 0x0050)); // Special Needs |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
746 removals_.insert(DicomTag(0x0038, 0x0060)); // Service Episode ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
747 removals_.insert(DicomTag(0x0038, 0x0061)); // Issuer of Service Episode ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
748 removals_.insert(DicomTag(0x0038, 0x0062)); // Service Episode Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
749 removals_.insert(DicomTag(0x0038, 0x0300)); // Current Patient Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
750 removals_.insert(DicomTag(0x0038, 0x0400)); // Patient's Institution Residence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
751 removals_.insert(DicomTag(0x0038, 0x0500)); // Patient State |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
752 removals_.insert(DicomTag(0x0038, 0x4000)); // Visit Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
753 removals_.insert(DicomTag(0x0040, 0x0001)); // Scheduled Station AE Title |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
754 removals_.insert(DicomTag(0x0040, 0x0002)); // Scheduled Procedure Step Start Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
755 removals_.insert(DicomTag(0x0040, 0x0003)); // Scheduled Procedure Step Start Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
756 removals_.insert(DicomTag(0x0040, 0x0004)); // Scheduled Procedure Step End Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
757 removals_.insert(DicomTag(0x0040, 0x0005)); // Scheduled Procedure Step End Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
758 removals_.insert(DicomTag(0x0040, 0x0006)); // Scheduled Performing Physician Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
759 removals_.insert(DicomTag(0x0040, 0x0007)); // Scheduled Procedure Step Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
760 removals_.insert(DicomTag(0x0040, 0x000b)); // Scheduled Performing Physician Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
761 removals_.insert(DicomTag(0x0040, 0x0010)); // Scheduled Station Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
762 removals_.insert(DicomTag(0x0040, 0x0011)); // Scheduled Procedure Step Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
763 removals_.insert(DicomTag(0x0040, 0x0012)); // Pre-Medication |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
764 removals_.insert(DicomTag(0x0040, 0x0241)); // Performed Station AE Title |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
765 removals_.insert(DicomTag(0x0040, 0x0242)); // Performed Station Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
766 removals_.insert(DicomTag(0x0040, 0x0243)); // Performed Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
767 removals_.insert(DicomTag(0x0040, 0x0244)); // Performed Procedure Step Start Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
768 removals_.insert(DicomTag(0x0040, 0x0245)); // Performed Procedure Step Start Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
769 removals_.insert(DicomTag(0x0040, 0x0250)); // Performed Procedure Step End Date |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
770 removals_.insert(DicomTag(0x0040, 0x0251)); // Performed Procedure Step End Time |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
771 removals_.insert(DicomTag(0x0040, 0x0253)); // Performed Procedure Step ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
772 removals_.insert(DicomTag(0x0040, 0x0254)); // Performed Procedure Step Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
773 removals_.insert(DicomTag(0x0040, 0x0275)); // Request Attributes Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
774 removals_.insert(DicomTag(0x0040, 0x0280)); // Comments on the Performed Procedure Step |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
775 removals_.insert(DicomTag(0x0040, 0x0555)); // Acquisition Context Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
776 removals_.insert(DicomTag(0x0040, 0x1001)); // Requested Procedure ID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
777 removals_.insert(DicomTag(0x0040, 0x1004)); // Patient Transport Arrangements |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
778 removals_.insert(DicomTag(0x0040, 0x1005)); // Requested Procedure Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
779 removals_.insert(DicomTag(0x0040, 0x1010)); // Names of Intended Recipient of Results |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
780 removals_.insert(DicomTag(0x0040, 0x1011)); // Intended Recipients of Results Identification Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
781 removals_.insert(DicomTag(0x0040, 0x1102)); // Person Address |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
782 removals_.insert(DicomTag(0x0040, 0x1103)); // Person's Telephone Numbers |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
783 removals_.insert(DicomTag(0x0040, 0x1104)); // Person's Telecom Information |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
784 removals_.insert(DicomTag(0x0040, 0x1400)); // Requested Procedure Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
785 removals_.insert(DicomTag(0x0040, 0x2001)); // Reason for the Imaging Service Request |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
786 removals_.insert(DicomTag(0x0040, 0x2008)); // Order Entered By |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
787 removals_.insert(DicomTag(0x0040, 0x2009)); // Order Enterer Location |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
788 removals_.insert(DicomTag(0x0040, 0x2010)); // Order Callback Phone Number |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
789 removals_.insert(DicomTag(0x0040, 0x2011)); // Order Callback Telecom Information |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
790 removals_.insert(DicomTag(0x0040, 0x2400)); // Imaging Service Request Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
791 removals_.insert(DicomTag(0x0040, 0x3001)); // Confidentiality Constraint on Patient Data Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
792 removals_.insert(DicomTag(0x0040, 0x4005)); // Scheduled Procedure Step Start DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
793 removals_.insert(DicomTag(0x0040, 0x4010)); // Scheduled Procedure Step Modification DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
794 removals_.insert(DicomTag(0x0040, 0x4011)); // Expected Completion DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
795 removals_.insert(DicomTag(0x0040, 0x4023)); /* TODO UID */ // Referenced General Purpose Scheduled Procedure Step Transaction UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
796 removals_.insert(DicomTag(0x0040, 0x4025)); // Scheduled Station Name Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
797 removals_.insert(DicomTag(0x0040, 0x4027)); // Scheduled Station Geographic Location Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
798 removals_.insert(DicomTag(0x0040, 0x4028)); // Performed Station Name Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
799 removals_.insert(DicomTag(0x0040, 0x4030)); // Performed Station Geographic Location Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
800 removals_.insert(DicomTag(0x0040, 0x4034)); // Scheduled Human Performers Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
801 removals_.insert(DicomTag(0x0040, 0x4035)); // Actual Human Performers Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
802 removals_.insert(DicomTag(0x0040, 0x4036)); // Human Performers Organization |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
803 removals_.insert(DicomTag(0x0040, 0x4037)); // Human Performers Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
804 removals_.insert(DicomTag(0x0040, 0x4050)); // Performed Procedure Step Start DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
805 removals_.insert(DicomTag(0x0040, 0x4051)); // Performed Procedure Step End DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
806 removals_.insert(DicomTag(0x0040, 0x4052)); // Procedure Step Cancellation DateTime |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
807 removals_.insert(DicomTag(0x0040, 0xa027)); // Verifying Organization |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
808 removals_.insert(DicomTag(0x0040, 0xa078)); // Author Observer Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
809 removals_.insert(DicomTag(0x0040, 0xa07a)); // Participant Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
810 removals_.insert(DicomTag(0x0040, 0xa07c)); // Custodial Organization Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
811 removals_.insert(DicomTag(0x0040, 0xa124)); /* TODO UID */ // UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
812 removals_.insert(DicomTag(0x0040, 0xa171)); /* TODO UID */ // Observation UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
813 removals_.insert(DicomTag(0x0040, 0xa172)); /* TODO UID */ // Referenced Observation UID (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
814 removals_.insert(DicomTag(0x0040, 0xa192)); // Observation Date (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
815 removals_.insert(DicomTag(0x0040, 0xa193)); // Observation Time (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
816 removals_.insert(DicomTag(0x0040, 0xa307)); // Current Observer (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
817 removals_.insert(DicomTag(0x0040, 0xa352)); // Verbal Source (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
818 removals_.insert(DicomTag(0x0040, 0xa353)); // Address (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
819 removals_.insert(DicomTag(0x0040, 0xa354)); // Telephone Number (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
820 removals_.insert(DicomTag(0x0040, 0xa358)); // Verbal Source Identifier Code Sequence (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
821 removals_.insert(DicomTag(0x0040, 0xa402)); /* TODO UID */ // Observation Subject UID (Trial) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
822 removals_.insert(DicomTag(0x0040, 0xa730)); // Content Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
823 removals_.insert(DicomTag(0x0040, 0xdb0c)); /* TODO UID */ // Template Extension Organization UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
824 removals_.insert(DicomTag(0x0040, 0xdb0d)); /* TODO UID */ // Template Extension Creator UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
825 removals_.insert(DicomTag(0x0062, 0x0021)); /* TODO UID */ // Tracking UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
826 removals_.insert(DicomTag(0x0070, 0x0086)); // Content Creator's Identification Code Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
827 removals_.insert(DicomTag(0x0070, 0x031a)); /* TODO UID */ // Fiducial UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
828 removals_.insert(DicomTag(0x0070, 0x1101)); /* TODO UID */ // Presentation Display Collection UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
829 removals_.insert(DicomTag(0x0070, 0x1102)); /* TODO UID */ // Presentation Sequence Collection UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
830 removals_.insert(DicomTag(0x0088, 0x0140)); /* TODO UID */ // Storage Media File-set UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
831 removals_.insert(DicomTag(0x0088, 0x0200)); // Icon Image Sequence(see Note 12) |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
832 removals_.insert(DicomTag(0x0088, 0x0904)); // Topic Title |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
833 removals_.insert(DicomTag(0x0088, 0x0906)); // Topic Subject |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
834 removals_.insert(DicomTag(0x0088, 0x0910)); // Topic Author |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
835 removals_.insert(DicomTag(0x0088, 0x0912)); // Topic Keywords |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
836 removals_.insert(DicomTag(0x0400, 0x0100)); // Digital Signature UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
837 removals_.insert(DicomTag(0x0400, 0x0402)); // Referenced Digital Signature Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
838 removals_.insert(DicomTag(0x0400, 0x0403)); // Referenced SOP Instance MAC Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
839 removals_.insert(DicomTag(0x0400, 0x0404)); // MAC |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
840 removals_.insert(DicomTag(0x0400, 0x0550)); // Modified Attributes Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
841 removals_.insert(DicomTag(0x0400, 0x0561)); // Original Attributes Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
842 removals_.insert(DicomTag(0x2030, 0x0020)); // Text String |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
843 removals_.insert(DicomTag(0x3008, 0x0105)); // Source Serial Number |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
844 removals_.insert(DicomTag(0x300a, 0x0013)); /* TODO UID */ // Dose Reference UID |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
845 removals_.insert(DicomTag(0x300c, 0x0113)); // Reason for Omission Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
846 removals_.insert(DicomTag(0x300e, 0x0008)); /* X/Z */ // Reviewer Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
847 removals_.insert(DicomTag(0x4000, 0x0010)); // Arbitrary |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
848 removals_.insert(DicomTag(0x4000, 0x4000)); // Text Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
849 removals_.insert(DicomTag(0x4008, 0x0042)); // Results ID Issuer |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
850 removals_.insert(DicomTag(0x4008, 0x0102)); // Interpretation Recorder |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
851 removals_.insert(DicomTag(0x4008, 0x010a)); // Interpretation Transcriber |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
852 removals_.insert(DicomTag(0x4008, 0x010b)); // Interpretation Text |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
853 removals_.insert(DicomTag(0x4008, 0x010c)); // Interpretation Author |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
854 removals_.insert(DicomTag(0x4008, 0x0111)); // Interpretation Approver Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
855 removals_.insert(DicomTag(0x4008, 0x0114)); // Physician Approving Interpretation |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
856 removals_.insert(DicomTag(0x4008, 0x0115)); // Interpretation Diagnosis Description |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
857 removals_.insert(DicomTag(0x4008, 0x0118)); // Results Distribution List Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
858 removals_.insert(DicomTag(0x4008, 0x0119)); // Distribution Name |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
859 removals_.insert(DicomTag(0x4008, 0x011a)); // Distribution Address |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
860 removals_.insert(DicomTag(0x4008, 0x0202)); // Interpretation ID Issuer |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
861 removals_.insert(DicomTag(0x4008, 0x0300)); // Impressions |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
862 removals_.insert(DicomTag(0x4008, 0x4000)); // Results Comments |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
863 removals_.insert(DicomTag(0xfffa, 0xfffa)); // Digital Signatures Sequence |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
864 removals_.insert(DicomTag(0xfffc, 0xfffc)); // Data Set Trailing Padding |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
865 |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
866 // Set the DeidentificationMethod tag |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
867 ReplaceInternal(DICOM_TAG_DEIDENTIFICATION_METHOD, ORTHANC_DEIDENTIFICATION_METHOD_2017c); |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
868 } |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
869 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
870 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
871 void DicomModification::SetupAnonymization(DicomVersion version) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
872 { |
2721 | 873 isAnonymization_ = true; |
874 | |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
875 removals_.clear(); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
876 clearings_.clear(); |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
877 ClearReplacements(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
878 removePrivateTags_ = true; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
879 level_ = ResourceType_Patient; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
880 uidMap_.clear(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
881 privateTagsToKeep_.clear(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
882 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
883 switch (version) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
884 { |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
885 case DicomVersion_2008: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
886 SetupAnonymization2008(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
887 break; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
888 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
889 case DicomVersion_2017c: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
890 SetupAnonymization2017c(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
891 break; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
892 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
893 default: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
894 throw OrthancException(ErrorCode_ParameterOutOfRange); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
895 } |
786 | 896 |
897 // Set the PatientIdentityRemoved tag | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
898 ReplaceInternal(DicomTag(0x0012, 0x0062), "YES"); |
786 | 899 |
900 // (*) Choose a random patient name and ID | |
788 | 901 std::string patientId = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
902 ReplaceInternal(DICOM_TAG_PATIENT_ID, patientId); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
903 ReplaceInternal(DICOM_TAG_PATIENT_NAME, patientId); |
786 | 904 } |
905 | |
906 void DicomModification::Apply(ParsedDicomFile& toModify) | |
907 { | |
908 // Check the request | |
788 | 909 assert(ResourceType_Patient + 1 == ResourceType_Study && |
910 ResourceType_Study + 1 == ResourceType_Series && | |
911 ResourceType_Series + 1 == ResourceType_Instance); | |
786 | 912 |
913 if (IsRemoved(DICOM_TAG_PATIENT_ID) || | |
914 IsRemoved(DICOM_TAG_STUDY_INSTANCE_UID) || | |
915 IsRemoved(DICOM_TAG_SERIES_INSTANCE_UID) || | |
916 IsRemoved(DICOM_TAG_SOP_INSTANCE_UID)) | |
917 { | |
918 throw OrthancException(ErrorCode_BadRequest); | |
919 } | |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
920 |
786 | 921 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
922 // Sanity checks at the patient level |
788 | 923 if (level_ == ResourceType_Patient && !IsReplaced(DICOM_TAG_PATIENT_ID)) |
786 | 924 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
925 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
926 "When modifying a patient, her PatientID is required to be modified"); |
786 | 927 } |
928 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
929 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
930 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
931 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
932 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
933 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
934 "When modifying a patient, the StudyInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
935 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
936 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
937 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
938 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
939 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
940 "When modifying a patient, the SeriesInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
941 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
942 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
943 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
944 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
945 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
946 "When modifying a patient, the SopInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
947 } |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
948 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
949 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
950 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
951 // Sanity checks at the study level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
952 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_PATIENT_ID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
953 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
954 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
955 "When modifying a study, the parent PatientID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
956 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
957 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
958 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
959 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
960 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
961 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
962 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
963 "When modifying a study, the SeriesInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
964 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
965 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
966 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
967 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
968 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
969 "When modifying a study, the SopInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
970 } |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
971 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
972 |
786 | 973 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
974 // Sanity checks at the series level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
975 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_PATIENT_ID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
976 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
977 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
978 "When modifying a series, the parent PatientID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
979 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
980 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
981 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
786 | 982 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
983 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
984 "When modifying a series, the parent StudyInstanceUID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
985 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
986 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
987 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
988 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
989 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
990 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
991 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
992 "When modifying a series, the SopInstanceUID cannot be manually modified"); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
993 } |
786 | 994 } |
995 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
996 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
997 // Sanity checks at the instance level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
998 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_PATIENT_ID)) |
786 | 999 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1000 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1001 "When modifying an instance, the parent PatientID cannot be manually modified"); |
786 | 1002 } |
1003 | |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1004 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1005 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1006 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1007 "When modifying an instance, the parent StudyInstanceUID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1008 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1009 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1010 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1011 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1012 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1013 "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1014 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
1015 |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1016 // (0) Create a summary of the source file, if a custom generator |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1017 // is provided |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1018 if (identifierGenerator_ != NULL) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1019 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1020 toModify.ExtractDicomSummary(currentSource_); |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1021 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1022 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1023 // (1) Make sure the relationships are updated with the ids that we force too |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1024 // i.e: an RT-STRUCT is referencing its own StudyInstanceUID |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1025 if (isAnonymization_ && updateReferencedRelationships_) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1026 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1027 if (IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1028 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1029 std::string original; |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1030 std::string replacement = GetReplacementAsString(DICOM_TAG_STUDY_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1031 toModify.GetTagValue(original, DICOM_TAG_STUDY_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1032 RegisterMappedDicomIdentifier(original, replacement, ResourceType_Study); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1033 } |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
1034 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1035 if (IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1036 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1037 std::string original; |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1038 std::string replacement = GetReplacementAsString(DICOM_TAG_SERIES_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1039 toModify.GetTagValue(original, DICOM_TAG_SERIES_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1040 RegisterMappedDicomIdentifier(original, replacement, ResourceType_Series); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1041 } |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1042 |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1043 if (IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1044 { |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1045 std::string original; |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1046 std::string replacement = GetReplacementAsString(DICOM_TAG_SOP_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1047 toModify.GetTagValue(original, DICOM_TAG_SOP_INSTANCE_UID); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1048 RegisterMappedDicomIdentifier(original, replacement, ResourceType_Instance); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1049 } |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1050 } |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1051 |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1052 |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1053 // (2) Remove the private tags, if need be |
786 | 1054 if (removePrivateTags_) |
1055 { | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
1056 toModify.RemovePrivateTags(privateTagsToKeep_); |
786 | 1057 } |
1058 | |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1059 // (3) Clear the tags specified by the user |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1060 for (SetOfTags::const_iterator it = clearings_.begin(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1061 it != clearings_.end(); ++it) |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1062 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1063 toModify.Clear(*it, true /* only clear if the tag exists in the original file */); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1064 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1065 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1066 // (4) Remove the tags specified by the user |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
1067 for (SetOfTags::const_iterator it = removals_.begin(); |
786 | 1068 it != removals_.end(); ++it) |
1069 { | |
1070 toModify.Remove(*it); | |
1071 } | |
1072 | |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1073 // (5) Replace the tags |
786 | 1074 for (Replacements::const_iterator it = replacements_.begin(); |
1075 it != replacements_.end(); ++it) | |
1076 { | |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1077 toModify.Replace(it->first, *it->second, true /* decode data URI scheme */, |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1078 DicomReplaceMode_InsertIfAbsent, privateCreator_); |
786 | 1079 } |
1080 | |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1081 // (6) Update the DICOM identifiers |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1082 if (level_ <= ResourceType_Study && |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1083 !IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
786 | 1084 { |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1085 if (keepStudyInstanceUid_) |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1086 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1087 LOG(WARNING) << "Modifying a study while keeping its original StudyInstanceUID: This should be avoided!"; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1088 } |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1089 else |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1090 { |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1091 MapDicomTags(toModify, ResourceType_Study); |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1092 } |
786 | 1093 } |
1094 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1095 if (level_ <= ResourceType_Series && |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1096 !IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
786 | 1097 { |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1098 if (keepSeriesInstanceUid_) |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1099 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1100 LOG(WARNING) << "Modifying a series while keeping its original SeriesInstanceUID: This should be avoided!"; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1101 } |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1102 else |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1103 { |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1104 MapDicomTags(toModify, ResourceType_Series); |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1105 } |
786 | 1106 } |
1107 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1108 if (level_ <= ResourceType_Instance && // Always true |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1109 !IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
786 | 1110 { |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1111 if (keepSopInstanceUid_) |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1112 { |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1113 LOG(WARNING) << "Modifying an instance while keeping its original SOPInstanceUID: This should be avoided!"; |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1114 } |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1115 else |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1116 { |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1117 MapDicomTags(toModify, ResourceType_Instance); |
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1118 } |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1119 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1120 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3344
diff
changeset
|
1121 // (7) Update the "referenced" relationships in the case of an anonymization |
2721 | 1122 if (isAnonymization_) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1123 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1124 RelationshipsVisitor visitor(*this); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1125 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1126 if (updateReferencedRelationships_) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1127 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1128 toModify.Apply(visitor); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1129 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1130 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1131 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1132 visitor.RemoveRelationships(toModify); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1133 } |
786 | 1134 } |
1135 } | |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1136 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1137 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1138 static bool IsDatabaseKey(const DicomTag& tag) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1139 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1140 return (tag == DICOM_TAG_PATIENT_ID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1141 tag == DICOM_TAG_STUDY_INSTANCE_UID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1142 tag == DICOM_TAG_SERIES_INSTANCE_UID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1143 tag == DICOM_TAG_SOP_INSTANCE_UID); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1144 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1145 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1146 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1147 static void ParseListOfTags(DicomModification& target, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1148 const Json::Value& query, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1149 DicomModification::TagOperation operation, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1150 bool force) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1151 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1152 if (!query.isArray()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1153 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1154 throw OrthancException(ErrorCode_BadRequest); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1155 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1156 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1157 for (Json::Value::ArrayIndex i = 0; i < query.size(); i++) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1158 { |
2844
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1159 if (query[i].type() != Json::stringValue) |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1160 { |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1161 throw OrthancException(ErrorCode_BadRequest); |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1162 } |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1163 |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1164 std::string name = query[i].asString(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1165 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1166 DicomTag tag = FromDcmtkBridge::ParseTag(name); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1167 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1168 if (!force && IsDatabaseKey(tag)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1169 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1170 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1171 "Marking tag \"" + name + "\" as to be " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1172 (operation == DicomModification::TagOperation_Keep ? "kept" : "removed") + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1173 " requires the \"Force\" option to be set to true"); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1174 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1175 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1176 switch (operation) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1177 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1178 case DicomModification::TagOperation_Keep: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1179 target.Keep(tag); |
2520 | 1180 VLOG(1) << "Keep: " << name << " " << tag; |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1181 break; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1182 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1183 case DicomModification::TagOperation_Remove: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1184 target.Remove(tag); |
2520 | 1185 VLOG(1) << "Remove: " << name << " " << tag; |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1186 break; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1187 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1188 default: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1189 throw OrthancException(ErrorCode_InternalError); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1190 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1191 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1192 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1193 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1194 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1195 static void ParseReplacements(DicomModification& target, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1196 const Json::Value& replacements, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1197 bool force) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1198 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1199 if (!replacements.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1200 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1201 throw OrthancException(ErrorCode_BadRequest); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1202 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1203 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1204 Json::Value::Members members = replacements.getMemberNames(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1205 for (size_t i = 0; i < members.size(); i++) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1206 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1207 const std::string& name = members[i]; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1208 const Json::Value& value = replacements[name]; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1209 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1210 DicomTag tag = FromDcmtkBridge::ParseTag(name); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1211 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1212 if (!force && IsDatabaseKey(tag)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1213 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1214 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1215 "Marking tag \"" + name + "\" as to be replaced " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1216 "requires the \"Force\" option to be set to true"); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1217 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1218 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1219 target.Replace(tag, value, false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1220 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1221 VLOG(1) << "Replace: " << name << " " << tag |
2520 | 1222 << " == " << value.toStyledString(); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1223 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1224 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1225 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1226 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1227 static bool GetBooleanValue(const std::string& member, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1228 const Json::Value& json, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1229 bool defaultValue) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1230 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1231 if (!json.isMember(member)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1232 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1233 return defaultValue; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1234 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1235 else if (json[member].type() == Json::booleanValue) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1236 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1237 return json[member].asBool(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1238 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1239 else |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1240 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1241 throw OrthancException(ErrorCode_BadFileFormat, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1242 "Member \"" + member + "\" should be a Boolean value"); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1243 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1244 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1245 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1246 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1247 void DicomModification::ParseModifyRequest(const Json::Value& request) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1248 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1249 if (!request.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1250 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1251 throw OrthancException(ErrorCode_BadFileFormat); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1252 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1253 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1254 bool force = GetBooleanValue("Force", request, false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1255 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1256 if (GetBooleanValue("RemovePrivateTags", request, false)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1257 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1258 SetRemovePrivateTags(true); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1259 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1260 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1261 if (request.isMember("Remove")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1262 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1263 ParseListOfTags(*this, request["Remove"], TagOperation_Remove, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1264 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1265 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1266 if (request.isMember("Replace")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1267 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1268 ParseReplacements(*this, request["Replace"], force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1269 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1270 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1271 // The "Keep" operation only makes sense for the tags |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1272 // StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID. Avoid |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1273 // this feature as much as possible, as this breaks the DICOM |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1274 // model of the real world, except if you know exactly what |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1275 // you're doing! |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1276 if (request.isMember("Keep")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1277 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1278 ParseListOfTags(*this, request["Keep"], TagOperation_Keep, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1279 } |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1280 |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1281 // New in Orthanc 1.6.0 |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1282 if (request.isMember("PrivateCreator")) |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1283 { |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1284 privateCreator_ = SerializationToolbox::ReadString(request, "PrivateCreator"); |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1285 } |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1286 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1287 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1288 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1289 void DicomModification::ParseAnonymizationRequest(bool& patientNameReplaced, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1290 const Json::Value& request) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1291 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1292 if (!request.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1293 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1294 throw OrthancException(ErrorCode_BadFileFormat); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1295 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1296 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1297 bool force = GetBooleanValue("Force", request, false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1298 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1299 // As of Orthanc 1.3.0, the default anonymization is done |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1300 // according to PS 3.15-2017c Table E.1-1 (basic profile) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1301 DicomVersion version = DicomVersion_2017c; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1302 if (request.isMember("DicomVersion")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1303 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1304 if (request["DicomVersion"].type() != Json::stringValue) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1305 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1306 throw OrthancException(ErrorCode_BadFileFormat); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1307 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1308 else |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1309 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1310 version = StringToDicomVersion(request["DicomVersion"].asString()); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1311 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1312 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1313 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1314 SetupAnonymization(version); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1315 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1316 std::string patientName = GetReplacementAsString(DICOM_TAG_PATIENT_NAME); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1317 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1318 if (GetBooleanValue("KeepPrivateTags", request, false)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1319 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1320 SetRemovePrivateTags(false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1321 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1322 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1323 if (request.isMember("Remove")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1324 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1325 ParseListOfTags(*this, request["Remove"], TagOperation_Remove, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1326 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1327 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1328 if (request.isMember("Replace")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1329 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1330 ParseReplacements(*this, request["Replace"], force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1331 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1332 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1333 if (request.isMember("Keep")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1334 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1335 ParseListOfTags(*this, request["Keep"], TagOperation_Keep, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1336 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1337 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1338 patientNameReplaced = (IsReplaced(DICOM_TAG_PATIENT_NAME) && |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1339 GetReplacement(DICOM_TAG_PATIENT_NAME) == patientName); |
3709
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1340 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1341 // New in Orthanc 1.6.0 |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1342 if (request.isMember("PrivateCreator")) |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1343 { |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1344 privateCreator_ = SerializationToolbox::ReadString(request, "PrivateCreator"); |
1f4910999fe7
Fix issue #168 (Plugins can't read private tags from the configuration file)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1345 } |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1346 } |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1347 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1348 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1349 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1350 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1351 static const char* REMOVE_PRIVATE_TAGS = "RemovePrivateTags"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1352 static const char* LEVEL = "Level"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1353 static const char* ALLOW_MANUAL_IDENTIFIERS = "AllowManualIdentifiers"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1354 static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1355 static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID"; |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1356 static const char* KEEP_SOP_INSTANCE_UID = "KeepSOPInstanceUID"; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1357 static const char* UPDATE_REFERENCED_RELATIONSHIPS = "UpdateReferencedRelationships"; |
2721 | 1358 static const char* IS_ANONYMIZATION = "IsAnonymization"; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1359 static const char* REMOVALS = "Removals"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1360 static const char* CLEARINGS = "Clearings"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1361 static const char* PRIVATE_TAGS_TO_KEEP = "PrivateTagsToKeep"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1362 static const char* REPLACEMENTS = "Replacements"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1363 static const char* MAP_PATIENTS = "MapPatients"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1364 static const char* MAP_STUDIES = "MapStudies"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1365 static const char* MAP_SERIES = "MapSeries"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1366 static const char* MAP_INSTANCES = "MapInstances"; |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1367 static const char* PRIVATE_CREATOR = "PrivateCreator"; // New in Orthanc 1.6.0 |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1368 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1369 void DicomModification::Serialize(Json::Value& value) const |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1370 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1371 if (identifierGenerator_ != NULL) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1372 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1373 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1374 "Cannot serialize a DicomModification with a custom identifier generator"); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1375 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1376 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1377 value = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1378 value[REMOVE_PRIVATE_TAGS] = removePrivateTags_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1379 value[LEVEL] = EnumerationToString(level_); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1380 value[ALLOW_MANUAL_IDENTIFIERS] = allowManualIdentifiers_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1381 value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1382 value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_; |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1383 value[KEEP_SOP_INSTANCE_UID] = keepSopInstanceUid_; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1384 value[UPDATE_REFERENCED_RELATIONSHIPS] = updateReferencedRelationships_; |
2721 | 1385 value[IS_ANONYMIZATION] = isAnonymization_; |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1386 value[PRIVATE_CREATOR] = privateCreator_; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1387 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1388 SerializationToolbox::WriteSetOfTags(value, removals_, REMOVALS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1389 SerializationToolbox::WriteSetOfTags(value, clearings_, CLEARINGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1390 SerializationToolbox::WriteSetOfTags(value, privateTagsToKeep_, PRIVATE_TAGS_TO_KEEP); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1391 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1392 Json::Value& tmp = value[REPLACEMENTS]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1393 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1394 tmp = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1395 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1396 for (Replacements::const_iterator it = replacements_.begin(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1397 it != replacements_.end(); ++it) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1398 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1399 assert(it->second != NULL); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1400 tmp[it->first.Format()] = *it->second; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1401 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1402 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1403 Json::Value& mapPatients = value[MAP_PATIENTS]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1404 Json::Value& mapStudies = value[MAP_STUDIES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1405 Json::Value& mapSeries = value[MAP_SERIES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1406 Json::Value& mapInstances = value[MAP_INSTANCES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1407 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1408 mapPatients = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1409 mapStudies = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1410 mapSeries = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1411 mapInstances = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1412 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1413 for (UidMap::const_iterator it = uidMap_.begin(); it != uidMap_.end(); ++it) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1414 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1415 Json::Value* tmp = NULL; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1416 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1417 switch (it->first.first) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1418 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1419 case ResourceType_Patient: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1420 tmp = &mapPatients; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1421 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1422 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1423 case ResourceType_Study: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1424 tmp = &mapStudies; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1425 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1426 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1427 case ResourceType_Series: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1428 tmp = &mapSeries; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1429 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1430 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1431 case ResourceType_Instance: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1432 tmp = &mapInstances; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1433 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1434 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1435 default: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1436 throw OrthancException(ErrorCode_InternalError); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1437 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1438 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1439 assert(tmp != NULL); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1440 (*tmp) [it->first.second] = it->second; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1441 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1442 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1443 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1444 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1445 void DicomModification::UnserializeUidMap(ResourceType level, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1446 const Json::Value& serialized, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1447 const char* field) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1448 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1449 if (!serialized.isMember(field) || |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1450 serialized[field].type() != Json::objectValue) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1451 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1452 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1453 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1454 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1455 Json::Value::Members names = serialized[field].getMemberNames(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1456 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1457 for (Json::Value::Members::const_iterator it = names.begin(); it != names.end(); ++it) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1458 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1459 const Json::Value& value = serialized[field][*it]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1460 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1461 if (value.type() != Json::stringValue) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1462 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1463 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1464 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1465 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1466 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1467 uidMap_[std::make_pair(level, *it)] = value.asString(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1468 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1469 } |
2655 | 1470 } |
1471 | |
1472 | |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
1473 DicomModification::DicomModification(const Json::Value& serialized) : |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
1474 identifierGenerator_(NULL) |
2655 | 1475 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1476 removePrivateTags_ = SerializationToolbox::ReadBoolean(serialized, REMOVE_PRIVATE_TAGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1477 level_ = StringToResourceType(SerializationToolbox::ReadString(serialized, LEVEL).c_str()); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1478 allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1479 keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1480 keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID); |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3712
diff
changeset
|
1481 keepSopInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SOP_INSTANCE_UID); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1482 updateReferencedRelationships_ = SerializationToolbox::ReadBoolean |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1483 (serialized, UPDATE_REFERENCED_RELATIONSHIPS); |
2721 | 1484 isAnonymization_ = SerializationToolbox::ReadBoolean(serialized, IS_ANONYMIZATION); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1485 |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1486 if (serialized.isMember(PRIVATE_CREATOR)) |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1487 { |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1488 privateCreator_ = SerializationToolbox::ReadString(serialized, PRIVATE_CREATOR); |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1489 } |
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1490 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1491 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1492 SerializationToolbox::ReadSetOfTags(clearings_, serialized, CLEARINGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1493 SerializationToolbox::ReadSetOfTags(privateTagsToKeep_, serialized, PRIVATE_TAGS_TO_KEEP); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1494 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1495 if (!serialized.isMember(REPLACEMENTS) || |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1496 serialized[REPLACEMENTS].type() != Json::objectValue) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1497 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1498 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1499 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1500 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1501 Json::Value::Members names = serialized[REPLACEMENTS].getMemberNames(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1502 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1503 for (Json::Value::Members::const_iterator it = names.begin(); it != names.end(); ++it) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1504 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1505 DicomTag tag(0, 0); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1506 if (!DicomTag::ParseHexadecimal(tag, it->c_str())) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1507 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1508 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1509 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1510 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1511 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1512 const Json::Value& value = serialized[REPLACEMENTS][*it]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1513 replacements_.insert(std::make_pair(tag, new Json::Value(value))); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1514 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1515 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1516 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1517 UnserializeUidMap(ResourceType_Patient, serialized, MAP_PATIENTS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1518 UnserializeUidMap(ResourceType_Study, serialized, MAP_STUDIES); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1519 UnserializeUidMap(ResourceType_Series, serialized, MAP_SERIES); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1520 UnserializeUidMap(ResourceType_Instance, serialized, MAP_INSTANCES); |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1521 } |
786 | 1522 } |