Mercurial > hg > orthanc
annotate Core/DicomParsing/DicomModification.cpp @ 3337:9c8e119d0c5b
fix detection of uuid on freebsd
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Apr 2019 15:51:37 +0200 |
parents | 880e4161c312 |
children | 90b4a5001c24 |
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 |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2954
diff
changeset
|
5 * Copyright (C) 2017-2019 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 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2323
diff
changeset
|
37 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2323
diff
changeset
|
38 #include "../OrthancException.h" |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
39 #include "../SerializationToolbox.h" |
790 | 40 #include "FromDcmtkBridge.h" |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
41 #include "ITagVisitor.h" |
786 | 42 |
795 | 43 #include <memory> // For std::auto_ptr |
44 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
45 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
46 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2008 = |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
47 "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
|
48 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
49 static const std::string ORTHANC_DEIDENTIFICATION_METHOD_2017c = |
2314 | 50 "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
|
51 |
786 | 52 namespace Orthanc |
53 { | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
54 class DicomModification::RelationshipsVisitor : public ITagVisitor |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
55 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
56 private: |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
57 DicomModification& that_; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
58 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
59 bool IsEnabled(const DicomTag& tag) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
60 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
61 return (!that_.IsCleared(tag) && |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
62 !that_.IsRemoved(tag) && |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
63 !that_.IsReplaced(tag)); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
64 } |
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 void RemoveIfEnabled(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
67 const DicomTag& tag) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
68 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
69 if (IsEnabled(tag)) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
70 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
71 dicom.Remove(tag); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
72 } |
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 public: |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
77 RelationshipsVisitor(DicomModification& that) : |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
78 that_(that) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
79 { |
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 |
3195 | 82 virtual void VisitNotSupported(const std::vector<DicomTag>& parentTags, |
83 const std::vector<size_t>& parentIndexes, | |
84 const DicomTag& tag, | |
85 ValueRepresentation vr) | |
86 { | |
87 } | |
88 | |
89 virtual void VisitEmptySequence(const std::vector<DicomTag>& parentTags, | |
90 const std::vector<size_t>& parentIndexes, | |
91 const DicomTag& tag) | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
92 { |
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 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
|
96 const std::vector<size_t>& parentIndexes, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
97 const DicomTag& tag, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
98 ValueRepresentation vr, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
99 const void* data, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
100 size_t size) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
101 { |
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 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
104 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
|
105 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
106 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
107 ValueRepresentation vr, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
108 const std::vector<int64_t>& values) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
109 { |
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 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
112 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
|
113 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
114 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
115 ValueRepresentation vr, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
116 const std::vector<double>& value) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
117 { |
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 |
3194
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
120 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
|
121 const std::vector<size_t>& parentIndexes, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
122 const DicomTag& tag, |
47ef29168698
support of value multiplicity in ITagVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
123 const std::vector<DicomTag>& value) |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
124 { |
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 virtual Action VisitString(std::string& newValue, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
128 const std::vector<DicomTag>& parentTags, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
129 const std::vector<size_t>& parentIndexes, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
130 const DicomTag& tag, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
131 ValueRepresentation vr, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
132 const std::string& value) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
133 { |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
134 if (!IsEnabled(tag)) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
135 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
136 return Action_None; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
137 } |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
138 else if (tag == DICOM_TAG_FRAME_OF_REFERENCE_UID || |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
139 tag == DICOM_TAG_REFERENCED_FRAME_OF_REFERENCE_UID || |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
140 tag == DICOM_TAG_REFERENCED_SOP_INSTANCE_UID || |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
141 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
|
142 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
143 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
|
144 return Action_Replace; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
145 } |
2521
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
146 else if (parentTags.size() == 1 && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
147 parentTags[0] == DICOM_TAG_CURRENT_REQUESTED_PROCEDURE_EVIDENCE_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
148 tag == DICOM_TAG_STUDY_INSTANCE_UID) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
149 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
150 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Study); |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
151 return Action_Replace; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
152 } |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
153 else if (parentTags.size() == 2 && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
154 parentTags[0] == DICOM_TAG_CURRENT_REQUESTED_PROCEDURE_EVIDENCE_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
155 parentTags[1] == DICOM_TAG_REFERENCED_SERIES_SEQUENCE && |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
156 tag == DICOM_TAG_SERIES_INSTANCE_UID) |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
157 { |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
158 newValue = that_.MapDicomIdentifier(Toolbox::StripSpaces(value), ResourceType_Series); |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
159 return Action_Replace; |
6db878376018
support anonymization of CurrentRequestedProcedureEvidenceSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2520
diff
changeset
|
160 } |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
161 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
162 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
163 return Action_None; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
164 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
165 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
166 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
167 void RemoveRelationships(ParsedDicomFile& dicom) const |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
168 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
169 // Sequences containing the UID relationships |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
170 RemoveIfEnabled(dicom, DICOM_TAG_REFERENCED_IMAGE_SEQUENCE); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
171 RemoveIfEnabled(dicom, DICOM_TAG_SOURCE_IMAGE_SEQUENCE); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
172 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
173 // Individual tags |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
174 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
|
175 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
176 // 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
|
177 // hierarchy, but remove them anyway |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
178 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
|
179 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
|
180 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
|
181 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
182 }; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
183 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
184 |
2323 | 185 bool DicomModification::CancelReplacement(const DicomTag& tag) |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
186 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
187 Replacements::iterator it = replacements_.find(tag); |
2323 | 188 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
189 if (it != replacements_.end()) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
190 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
191 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
192 replacements_.erase(it); |
2323 | 193 return true; |
194 } | |
195 else | |
196 { | |
197 return false; | |
198 } | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
199 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
200 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
201 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
202 void DicomModification::ReplaceInternal(const DicomTag& tag, |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
203 const Json::Value& value) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
204 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
205 Replacements::iterator it = replacements_.find(tag); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
206 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
207 if (it != replacements_.end()) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
208 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
209 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
210 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
|
211 it->second = new Json::Value(value); // Clone |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
212 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
213 else |
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_[tag] = new Json::Value(value); // Clone |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
216 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
217 } |
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 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
220 void DicomModification::ClearReplacements() |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
221 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
222 for (Replacements::iterator it = replacements_.begin(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
223 it != replacements_.end(); ++it) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
224 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
225 delete it->second; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
226 } |
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 replacements_.clear(); |
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 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
231 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
232 void DicomModification::MarkNotOrthancAnonymization() |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
233 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
234 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
|
235 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
236 if (it != replacements_.end() && |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
237 (it->second->asString() == ORTHANC_DEIDENTIFICATION_METHOD_2008 || |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
238 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
|
239 { |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
240 delete it->second; |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
241 replacements_.erase(it); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
242 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
243 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
244 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
245 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
246 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
247 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
|
248 ResourceType level) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
249 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
250 std::string mapped; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
251 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
252 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
|
253 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
254 if (previous == uidMap_.end()) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
255 { |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
256 if (identifierGenerator_ == NULL) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
257 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
258 mapped = FromDcmtkBridge::GenerateUniqueIdentifier(level); |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
259 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
260 else |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
261 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
262 if (!identifierGenerator_->Apply(mapped, original, level, currentSource_)) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
263 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
264 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
265 "Unable to generate an anonymized ID"); |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
266 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
267 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
268 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
269 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
|
270 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
271 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
272 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
273 mapped = previous->second; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
274 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
275 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
276 return mapped; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
277 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
278 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
279 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
280 void DicomModification::MapDicomTags(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
281 ResourceType level) |
786 | 282 { |
283 std::auto_ptr<DicomTag> tag; | |
284 | |
285 switch (level) | |
286 { | |
788 | 287 case ResourceType_Study: |
786 | 288 tag.reset(new DicomTag(DICOM_TAG_STUDY_INSTANCE_UID)); |
289 break; | |
290 | |
788 | 291 case ResourceType_Series: |
786 | 292 tag.reset(new DicomTag(DICOM_TAG_SERIES_INSTANCE_UID)); |
293 break; | |
294 | |
788 | 295 case ResourceType_Instance: |
786 | 296 tag.reset(new DicomTag(DICOM_TAG_SOP_INSTANCE_UID)); |
297 break; | |
298 | |
299 default: | |
300 throw OrthancException(ErrorCode_InternalError); | |
301 } | |
302 | |
303 std::string original; | |
304 if (!dicom.GetTagValue(original, *tag)) | |
305 { | |
306 original = ""; | |
307 } | |
308 | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
309 std::string mapped = MapDicomIdentifier(Toolbox::StripSpaces(original), level); |
786 | 310 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
311 dicom.Replace(*tag, mapped, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
312 false /* don't try and decode data URI scheme for UIDs */, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
313 DicomReplaceMode_InsertIfAbsent); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
314 } |
786 | 315 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
316 |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
317 DicomModification::DicomModification() : |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
318 removePrivateTags_(false), |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
319 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
|
320 allowManualIdentifiers_(true), |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
321 keepStudyInstanceUid_(false), |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
322 keepSeriesInstanceUid_(false), |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
323 updateReferencedRelationships_(true), |
2721 | 324 isAnonymization_(false), |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
325 identifierGenerator_(NULL) |
786 | 326 { |
327 } | |
328 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
329 DicomModification::~DicomModification() |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
330 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
331 ClearReplacements(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
332 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
333 |
787
ac18946afa74
refactoring of anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
786
diff
changeset
|
334 void DicomModification::Keep(const DicomTag& tag) |
786 | 335 { |
2323 | 336 bool wasRemoved = IsRemoved(tag); |
337 bool wasCleared = IsCleared(tag); | |
338 | |
786 | 339 removals_.erase(tag); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
340 clearings_.erase(tag); |
2323 | 341 |
342 bool wasReplaced = CancelReplacement(tag); | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
343 |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
344 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
|
345 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
346 keepStudyInstanceUid_ = true; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
347 } |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
348 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
|
349 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
350 keepSeriesInstanceUid_ = true; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
351 } |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
352 else if (tag.IsPrivate()) |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
353 { |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
354 privateTagsToKeep_.insert(tag); |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
355 } |
2323 | 356 else if (!wasRemoved && |
357 !wasReplaced && | |
358 !wasCleared) | |
2321
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
359 { |
65ffba10cace
warning message in DicomModification::Keep()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2314
diff
changeset
|
360 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
|
361 } |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
362 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
363 MarkNotOrthancAnonymization(); |
786 | 364 } |
365 | |
366 void DicomModification::Remove(const DicomTag& tag) | |
367 { | |
368 removals_.insert(tag); | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
369 clearings_.erase(tag); |
2323 | 370 CancelReplacement(tag); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
371 privateTagsToKeep_.erase(tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
372 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
373 MarkNotOrthancAnonymization(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
374 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
375 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
376 void DicomModification::Clear(const DicomTag& tag) |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
377 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
378 removals_.erase(tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
379 clearings_.insert(tag); |
2323 | 380 CancelReplacement(tag); |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
381 privateTagsToKeep_.erase(tag); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
382 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
383 MarkNotOrthancAnonymization(); |
786 | 384 } |
385 | |
386 bool DicomModification::IsRemoved(const DicomTag& tag) const | |
387 { | |
388 return removals_.find(tag) != removals_.end(); | |
389 } | |
390 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
391 bool DicomModification::IsCleared(const DicomTag& tag) const |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
392 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
393 return clearings_.find(tag) != clearings_.end(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
394 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
395 |
786 | 396 void DicomModification::Replace(const DicomTag& tag, |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
397 const Json::Value& value, |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
398 bool safeForAnonymization) |
786 | 399 { |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
400 clearings_.erase(tag); |
786 | 401 removals_.erase(tag); |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
402 privateTagsToKeep_.erase(tag); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
403 ReplaceInternal(tag, value); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
404 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
405 if (!safeForAnonymization) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
406 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
407 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
408 } |
786 | 409 } |
410 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
411 |
786 | 412 bool DicomModification::IsReplaced(const DicomTag& tag) const |
413 { | |
414 return replacements_.find(tag) != replacements_.end(); | |
415 } | |
416 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
417 const Json::Value& DicomModification::GetReplacement(const DicomTag& tag) const |
786 | 418 { |
419 Replacements::const_iterator it = replacements_.find(tag); | |
420 | |
421 if (it == replacements_.end()) | |
422 { | |
423 throw OrthancException(ErrorCode_InexistentItem); | |
424 } | |
425 else | |
426 { | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
427 return *it->second; |
786 | 428 } |
429 } | |
430 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
431 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
432 std::string DicomModification::GetReplacementAsString(const DicomTag& tag) const |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
433 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
434 const Json::Value& json = GetReplacement(tag); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
435 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
436 if (json.type() != Json::stringValue) |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
437 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
438 throw OrthancException(ErrorCode_BadParameterType); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
439 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
440 else |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
441 { |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
442 return json.asString(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
443 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
444 } |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
445 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
446 |
786 | 447 void DicomModification::SetRemovePrivateTags(bool removed) |
448 { | |
449 removePrivateTags_ = removed; | |
1279
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 if (!removed) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
452 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
453 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
454 } |
786 | 455 } |
456 | |
788 | 457 void DicomModification::SetLevel(ResourceType level) |
786 | 458 { |
459 uidMap_.clear(); | |
460 level_ = level; | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
461 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
462 if (level != ResourceType_Patient) |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
463 { |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
464 MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
465 } |
786 | 466 } |
467 | |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
468 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
469 void DicomModification::SetupAnonymization2008() |
786 | 470 { |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
471 // 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
|
472 // 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
|
473 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
474 removals_.insert(DicomTag(0x0008, 0x0014)); // Instance Creator UID |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
475 //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
|
476 removals_.insert(DicomTag(0x0008, 0x0050)); // Accession Number |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
477 removals_.insert(DicomTag(0x0008, 0x0080)); // Institution Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
478 removals_.insert(DicomTag(0x0008, 0x0081)); // Institution Address |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
479 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
|
480 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
|
481 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
|
482 removals_.insert(DicomTag(0x0008, 0x1010)); // Station Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
483 removals_.insert(DicomTag(0x0008, 0x1030)); // Study Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
484 removals_.insert(DicomTag(0x0008, 0x103e)); // Series Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
485 removals_.insert(DicomTag(0x0008, 0x1040)); // Institutional Department Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
486 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
|
487 removals_.insert(DicomTag(0x0008, 0x1050)); // Performing Physicians' Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
488 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
|
489 removals_.insert(DicomTag(0x0008, 0x1070)); // Operators' Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
490 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
|
491 //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
|
492 removals_.insert(DicomTag(0x0008, 0x2111)); // Derivation Description |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
493 //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
|
494 //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
|
495 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
|
496 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
|
497 removals_.insert(DicomTag(0x0010, 0x0040)); // Patient's Sex |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
498 removals_.insert(DicomTag(0x0010, 0x1000)); // Other Patient Ids |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
499 removals_.insert(DicomTag(0x0010, 0x1001)); // Other Patient Names |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
500 removals_.insert(DicomTag(0x0010, 0x1010)); // Patient's Age |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
501 removals_.insert(DicomTag(0x0010, 0x1020)); // Patient's Size |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
502 removals_.insert(DicomTag(0x0010, 0x1030)); // Patient's Weight |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
503 removals_.insert(DicomTag(0x0010, 0x1090)); // Medical Record Locator |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
504 removals_.insert(DicomTag(0x0010, 0x2160)); // Ethnic Group |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
505 removals_.insert(DicomTag(0x0010, 0x2180)); // Occupation |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
506 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
|
507 removals_.insert(DicomTag(0x0010, 0x4000)); // Patient Comments |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
508 removals_.insert(DicomTag(0x0018, 0x1000)); // Device Serial Number |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
509 removals_.insert(DicomTag(0x0018, 0x1030)); // Protocol Name |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
510 //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
|
511 //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
|
512 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
|
513 //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
|
514 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
|
515 removals_.insert(DicomTag(0x0020, 0x4000)); // Image Comments |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
516 removals_.insert(DicomTag(0x0040, 0x0275)); // Request Attributes Sequence |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
517 removals_.insert(DicomTag(0x0040, 0xa124)); // UID |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
518 removals_.insert(DicomTag(0x0040, 0xa730)); // Content Sequence |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
519 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
|
520 //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
|
521 //removals_.insert(DicomTag(0x3006, 0x00c2)); // Related Frame of Reference UID => RelationshipsVisitor |
786 | 522 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
523 // 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
|
524 removals_.insert(DicomTag(0x0010, 0x1040)); // Patient's Address |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
525 removals_.insert(DicomTag(0x0032, 0x1032)); // Requesting Physician |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
526 removals_.insert(DicomTag(0x0010, 0x2154)); // PatientTelephoneNumbers |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
527 removals_.insert(DicomTag(0x0010, 0x2000)); // Medical Alerts |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
528 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
529 // Set the DeidentificationMethod tag |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
530 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
|
531 } |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
532 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
533 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
534 void DicomModification::SetupAnonymization2017c() |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
535 { |
2313
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
536 /** |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
537 * 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
|
538 * 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
|
539 * generated automatically with the |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
540 * "../Resources/GenerateAnonymizationProfile.py" script. |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
541 * 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
|
542 **/ |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
543 |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
544 // 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
|
545 // 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
|
546 // 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
|
547 // 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
|
548 // 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
|
549 // 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
|
550 // 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
|
551 // 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
|
552 // 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
|
553 // 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
|
554 // 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
|
555 // 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
|
556 // 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
|
557 // 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 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
|
617 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
|
618 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
|
619 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
|
620 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
|
621 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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 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
|
628 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
|
629 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
|
630 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
|
631 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
|
632 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
|
633 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
|
634 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
|
635 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
|
636 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
|
637 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 removals_.insert(DicomTag(0x0010, 0x2110)); // Allergies |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
644 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
|
645 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
|
646 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
|
647 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
|
648 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
|
649 removals_.insert(DicomTag(0x0010, 0x2180)); // Occupation |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
650 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
|
651 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
|
652 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
|
653 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 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
|
669 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
|
670 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
|
671 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
|
672 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
|
673 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
|
674 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
|
675 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
|
676 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
|
677 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
|
678 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
|
679 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
|
680 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
|
681 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
|
682 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
|
683 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
|
684 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
|
685 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
|
686 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 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
|
723 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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 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
|
733 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
|
734 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
|
735 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
|
736 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
|
737 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
|
738 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
|
739 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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 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
|
745 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
|
746 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
|
747 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
|
748 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
|
749 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
|
750 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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 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
|
788 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
|
789 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
|
790 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
|
791 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
|
792 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
|
793 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
|
794 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
|
795 removals_.insert(DicomTag(0x0400, 0x0404)); // MAC |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
796 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
|
797 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
|
798 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
|
799 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
|
800 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
|
801 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
|
802 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
|
803 removals_.insert(DicomTag(0x4000, 0x0010)); // Arbitrary |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 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
|
815 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
|
816 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
|
817 removals_.insert(DicomTag(0x4008, 0x0300)); // Impressions |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
818 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
|
819 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
|
820 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
|
821 |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
822 // Set the DeidentificationMethod tag |
d19e716b79fa
switch to anonymization according to DICOM 2017c
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2311
diff
changeset
|
823 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
|
824 } |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
825 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
826 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
827 void DicomModification::SetupAnonymization(DicomVersion version) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
828 { |
2721 | 829 isAnonymization_ = true; |
830 | |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
831 removals_.clear(); |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
832 clearings_.clear(); |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
833 ClearReplacements(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
834 removePrivateTags_ = true; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
835 level_ = ResourceType_Patient; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
836 uidMap_.clear(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
837 privateTagsToKeep_.clear(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
838 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
839 switch (version) |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
840 { |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
841 case DicomVersion_2008: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
842 SetupAnonymization2008(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
843 break; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
844 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
845 case DicomVersion_2017c: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
846 SetupAnonymization2017c(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
847 break; |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
848 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
849 default: |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
850 throw OrthancException(ErrorCode_ParameterOutOfRange); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2277
diff
changeset
|
851 } |
786 | 852 |
853 // Set the PatientIdentityRemoved tag | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
854 ReplaceInternal(DicomTag(0x0012, 0x0062), "YES"); |
786 | 855 |
856 // (*) Choose a random patient name and ID | |
788 | 857 std::string patientId = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
858 ReplaceInternal(DICOM_TAG_PATIENT_ID, patientId); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
859 ReplaceInternal(DICOM_TAG_PATIENT_NAME, patientId); |
786 | 860 } |
861 | |
862 void DicomModification::Apply(ParsedDicomFile& toModify) | |
863 { | |
864 // Check the request | |
788 | 865 assert(ResourceType_Patient + 1 == ResourceType_Study && |
866 ResourceType_Study + 1 == ResourceType_Series && | |
867 ResourceType_Series + 1 == ResourceType_Instance); | |
786 | 868 |
869 if (IsRemoved(DICOM_TAG_PATIENT_ID) || | |
870 IsRemoved(DICOM_TAG_STUDY_INSTANCE_UID) || | |
871 IsRemoved(DICOM_TAG_SERIES_INSTANCE_UID) || | |
872 IsRemoved(DICOM_TAG_SOP_INSTANCE_UID)) | |
873 { | |
874 throw OrthancException(ErrorCode_BadRequest); | |
875 } | |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
876 |
786 | 877 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
878 // Sanity checks at the patient level |
788 | 879 if (level_ == ResourceType_Patient && !IsReplaced(DICOM_TAG_PATIENT_ID)) |
786 | 880 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
881 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
882 "When modifying a patient, her PatientID is required to be modified"); |
786 | 883 } |
884 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
885 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
886 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
887 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
|
888 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
889 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
890 "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
|
891 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
892 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
893 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
|
894 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
895 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
896 "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
|
897 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
898 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
899 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
|
900 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
901 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
902 "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
|
903 } |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
904 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
905 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
906 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
907 // Sanity checks at the study level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
908 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_PATIENT_ID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
909 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
910 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
911 "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
|
912 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
913 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
914 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
915 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
916 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
|
917 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
918 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
919 "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
|
920 } |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
921 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
922 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
|
923 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
924 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
925 "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
|
926 } |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
927 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
928 |
786 | 929 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
930 // Sanity checks at the series level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
931 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_PATIENT_ID)) |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
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 series, the parent PatientID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
935 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
936 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
937 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
786 | 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 series, the parent StudyInstanceUID cannot be manually modified"); |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
941 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
942 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
943 if (!allowManualIdentifiers_) |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
944 { |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
945 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
|
946 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
947 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
948 "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
|
949 } |
786 | 950 } |
951 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
952 |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
953 // Sanity checks at the instance level |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
954 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_PATIENT_ID)) |
786 | 955 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
956 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
957 "When modifying an instance, the parent PatientID cannot be manually modified"); |
786 | 958 } |
959 | |
1160
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
960 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
|
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 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
|
964 } |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
965 |
80671157d051
generalization of create-dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
966 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
|
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 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
|
970 } |
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 |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
973 // (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
|
974 // is provided |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
975 if (identifierGenerator_ != NULL) |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
976 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
977 toModify.ExtractDicomSummary(currentSource_); |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
978 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
979 |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2521
diff
changeset
|
980 |
786 | 981 // (1) Remove the private tags, if need be |
982 if (removePrivateTags_) | |
983 { | |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
984 toModify.RemovePrivateTags(privateTagsToKeep_); |
786 | 985 } |
986 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
987 // (2) Clear the tags specified by the user |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
988 for (SetOfTags::const_iterator it = clearings_.begin(); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
989 it != clearings_.end(); ++it) |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
990 { |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
991 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
|
992 } |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
993 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
994 // (3) Remove the tags specified by the user |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
916
diff
changeset
|
995 for (SetOfTags::const_iterator it = removals_.begin(); |
786 | 996 it != removals_.end(); ++it) |
997 { | |
998 toModify.Remove(*it); | |
999 } | |
1000 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1001 // (4) Replace the tags |
786 | 1002 for (Replacements::const_iterator it = replacements_.begin(); |
1003 it != replacements_.end(); ++it) | |
1004 { | |
1982
b5d4f9c156ad
Modification of instances can now replace PixelData
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1005 toModify.Replace(it->first, *it->second, true /* decode data URI scheme */, DicomReplaceMode_InsertIfAbsent); |
786 | 1006 } |
1007 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
1008 // (5) Update the DICOM identifiers |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1009 if (level_ <= ResourceType_Study && |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1010 !IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
786 | 1011 { |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1012 if (keepStudyInstanceUid_) |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1013 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1014 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
|
1015 } |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1016 else |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1017 { |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1018 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
|
1019 } |
786 | 1020 } |
1021 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1022 if (level_ <= ResourceType_Series && |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1023 !IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
786 | 1024 { |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1025 if (keepSeriesInstanceUid_) |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1026 { |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1027 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
|
1028 } |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1029 else |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1982
diff
changeset
|
1030 { |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1031 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
|
1032 } |
786 | 1033 } |
1034 | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1160
diff
changeset
|
1035 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
|
1036 !IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
786 | 1037 { |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1038 MapDicomTags(toModify, ResourceType_Instance); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1039 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1040 |
2721 | 1041 // (6) Update the "referenced" relationships in the case of an anonymization |
1042 if (isAnonymization_) | |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1043 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1044 RelationshipsVisitor visitor(*this); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1045 |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1046 if (updateReferencedRelationships_) |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1047 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1048 toModify.Apply(visitor); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1049 } |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1050 else |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1051 { |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1052 visitor.RemoveRelationships(toModify); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
1053 } |
786 | 1054 } |
1055 } | |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1056 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1057 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1058 static bool IsDatabaseKey(const DicomTag& tag) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1059 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1060 return (tag == DICOM_TAG_PATIENT_ID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1061 tag == DICOM_TAG_STUDY_INSTANCE_UID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1062 tag == DICOM_TAG_SERIES_INSTANCE_UID || |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1063 tag == DICOM_TAG_SOP_INSTANCE_UID); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1064 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1065 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1066 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1067 static void ParseListOfTags(DicomModification& target, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1068 const Json::Value& query, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1069 DicomModification::TagOperation operation, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1070 bool force) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1071 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1072 if (!query.isArray()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1073 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1074 throw OrthancException(ErrorCode_BadRequest); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1075 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1076 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1077 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
|
1078 { |
2844
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1079 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
|
1080 { |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1081 throw OrthancException(ErrorCode_BadRequest); |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1082 } |
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2721
diff
changeset
|
1083 |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1084 std::string name = query[i].asString(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1085 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1086 DicomTag tag = FromDcmtkBridge::ParseTag(name); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1087 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1088 if (!force && IsDatabaseKey(tag)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1089 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1090 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1091 "Marking tag \"" + name + "\" as to be " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1092 (operation == DicomModification::TagOperation_Keep ? "kept" : "removed") + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1093 " 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
|
1094 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1095 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1096 switch (operation) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1097 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1098 case DicomModification::TagOperation_Keep: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1099 target.Keep(tag); |
2520 | 1100 VLOG(1) << "Keep: " << name << " " << tag; |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1101 break; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1102 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1103 case DicomModification::TagOperation_Remove: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1104 target.Remove(tag); |
2520 | 1105 VLOG(1) << "Remove: " << name << " " << tag; |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1106 break; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1107 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1108 default: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1109 throw OrthancException(ErrorCode_InternalError); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1110 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1111 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1112 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1113 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1114 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1115 static void ParseReplacements(DicomModification& target, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1116 const Json::Value& replacements, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1117 bool force) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1118 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1119 if (!replacements.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1120 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1121 throw OrthancException(ErrorCode_BadRequest); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1122 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1123 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1124 Json::Value::Members members = replacements.getMemberNames(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1125 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
|
1126 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1127 const std::string& name = members[i]; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1128 const Json::Value& value = replacements[name]; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1129 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1130 DicomTag tag = FromDcmtkBridge::ParseTag(name); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1131 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1132 if (!force && IsDatabaseKey(tag)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1133 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1134 throw OrthancException(ErrorCode_BadRequest, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1135 "Marking tag \"" + name + "\" as to be replaced " + |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1136 "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
|
1137 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1138 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1139 target.Replace(tag, value, false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1140 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1141 VLOG(1) << "Replace: " << name << " " << tag |
2520 | 1142 << " == " << value.toStyledString(); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1143 } |
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 bool GetBooleanValue(const std::string& member, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1148 const Json::Value& json, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1149 bool defaultValue) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1150 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1151 if (!json.isMember(member)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1152 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1153 return defaultValue; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1154 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1155 else if (json[member].type() == Json::booleanValue) |
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 return json[member].asBool(); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1158 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1159 else |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1160 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1161 throw OrthancException(ErrorCode_BadFileFormat, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1162 "Member \"" + member + "\" should be a Boolean value"); |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1163 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1164 } |
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 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1167 void DicomModification::ParseModifyRequest(const Json::Value& request) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1168 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1169 if (!request.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1170 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1171 throw OrthancException(ErrorCode_BadFileFormat); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1172 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1173 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1174 bool force = GetBooleanValue("Force", request, false); |
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 if (GetBooleanValue("RemovePrivateTags", request, false)) |
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 SetRemovePrivateTags(true); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1179 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1180 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1181 if (request.isMember("Remove")) |
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 ParseListOfTags(*this, request["Remove"], TagOperation_Remove, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1184 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1185 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1186 if (request.isMember("Replace")) |
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 ParseReplacements(*this, request["Replace"], force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1189 } |
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 // 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
|
1192 // StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID. Avoid |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1193 // 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
|
1194 // 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
|
1195 // you're doing! |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1196 if (request.isMember("Keep")) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1197 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1198 ParseListOfTags(*this, request["Keep"], TagOperation_Keep, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1199 } |
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 |
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 void DicomModification::ParseAnonymizationRequest(bool& patientNameReplaced, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1204 const Json::Value& request) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1205 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1206 if (!request.isObject()) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1207 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1208 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1211 bool force = GetBooleanValue("Force", request, false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1212 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1213 // 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
|
1214 // 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
|
1215 DicomVersion version = DicomVersion_2017c; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1216 if (request.isMember("DicomVersion")) |
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 if (request["DicomVersion"].type() != Json::stringValue) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1219 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1220 throw OrthancException(ErrorCode_BadFileFormat); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1221 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1222 else |
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 version = StringToDicomVersion(request["DicomVersion"].asString()); |
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 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1228 SetupAnonymization(version); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1229 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1230 std::string patientName = GetReplacementAsString(DICOM_TAG_PATIENT_NAME); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1231 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1232 if (GetBooleanValue("KeepPrivateTags", request, false)) |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1233 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1234 SetRemovePrivateTags(false); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1235 } |
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 if (request.isMember("Remove")) |
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 ParseListOfTags(*this, request["Remove"], TagOperation_Remove, force); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1240 } |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1241 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1242 if (request.isMember("Replace")) |
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 ParseReplacements(*this, request["Replace"], force); |
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 if (request.isMember("Keep")) |
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 ParseListOfTags(*this, request["Keep"], TagOperation_Keep, force); |
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 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1252 patientNameReplaced = (IsReplaced(DICOM_TAG_PATIENT_NAME) && |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1253 GetReplacement(DICOM_TAG_PATIENT_NAME) == patientName); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
1254 } |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1255 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1256 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1257 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1258 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1259 static const char* REMOVE_PRIVATE_TAGS = "RemovePrivateTags"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1260 static const char* LEVEL = "Level"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1261 static const char* ALLOW_MANUAL_IDENTIFIERS = "AllowManualIdentifiers"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1262 static const char* KEEP_STUDY_INSTANCE_UID = "KeepStudyInstanceUID"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1263 static const char* KEEP_SERIES_INSTANCE_UID = "KeepSeriesInstanceUID"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1264 static const char* UPDATE_REFERENCED_RELATIONSHIPS = "UpdateReferencedRelationships"; |
2721 | 1265 static const char* IS_ANONYMIZATION = "IsAnonymization"; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1266 static const char* REMOVALS = "Removals"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1267 static const char* CLEARINGS = "Clearings"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1268 static const char* PRIVATE_TAGS_TO_KEEP = "PrivateTagsToKeep"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1269 static const char* REPLACEMENTS = "Replacements"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1270 static const char* MAP_PATIENTS = "MapPatients"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1271 static const char* MAP_STUDIES = "MapStudies"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1272 static const char* MAP_SERIES = "MapSeries"; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1273 static const char* MAP_INSTANCES = "MapInstances"; |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1274 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
1275 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
|
1276 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1277 if (identifierGenerator_ != NULL) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1278 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1279 throw OrthancException(ErrorCode_InternalError, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
1280 "Cannot serialize a DicomModification with a custom identifier generator"); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1281 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1282 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1283 value = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1284 value[REMOVE_PRIVATE_TAGS] = removePrivateTags_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1285 value[LEVEL] = EnumerationToString(level_); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1286 value[ALLOW_MANUAL_IDENTIFIERS] = allowManualIdentifiers_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1287 value[KEEP_STUDY_INSTANCE_UID] = keepStudyInstanceUid_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1288 value[KEEP_SERIES_INSTANCE_UID] = keepSeriesInstanceUid_; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1289 value[UPDATE_REFERENCED_RELATIONSHIPS] = updateReferencedRelationships_; |
2721 | 1290 value[IS_ANONYMIZATION] = isAnonymization_; |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1291 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1292 SerializationToolbox::WriteSetOfTags(value, removals_, REMOVALS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1293 SerializationToolbox::WriteSetOfTags(value, clearings_, CLEARINGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1294 SerializationToolbox::WriteSetOfTags(value, privateTagsToKeep_, PRIVATE_TAGS_TO_KEEP); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1295 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1296 Json::Value& tmp = value[REPLACEMENTS]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1297 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1298 tmp = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1299 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1300 for (Replacements::const_iterator it = replacements_.begin(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1301 it != replacements_.end(); ++it) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1302 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1303 assert(it->second != NULL); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1304 tmp[it->first.Format()] = *it->second; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1305 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1306 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1307 Json::Value& mapPatients = value[MAP_PATIENTS]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1308 Json::Value& mapStudies = value[MAP_STUDIES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1309 Json::Value& mapSeries = value[MAP_SERIES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1310 Json::Value& mapInstances = value[MAP_INSTANCES]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1311 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1312 mapPatients = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1313 mapStudies = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1314 mapSeries = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1315 mapInstances = Json::objectValue; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1316 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1317 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
|
1318 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1319 Json::Value* tmp = NULL; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1320 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1321 switch (it->first.first) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1322 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1323 case ResourceType_Patient: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1324 tmp = &mapPatients; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1325 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1326 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1327 case ResourceType_Study: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1328 tmp = &mapStudies; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1329 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1330 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1331 case ResourceType_Series: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1332 tmp = &mapSeries; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1333 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1334 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1335 case ResourceType_Instance: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1336 tmp = &mapInstances; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1337 break; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1338 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1339 default: |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1340 throw OrthancException(ErrorCode_InternalError); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1341 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1342 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1343 assert(tmp != NULL); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1344 (*tmp) [it->first.second] = it->second; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1345 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1346 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1347 |
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 void DicomModification::UnserializeUidMap(ResourceType level, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1350 const Json::Value& serialized, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1351 const char* field) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1352 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1353 if (!serialized.isMember(field) || |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1354 serialized[field].type() != Json::objectValue) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1355 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1356 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1357 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1358 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1359 Json::Value::Members names = serialized[field].getMemberNames(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1360 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1361 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
|
1362 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1363 const Json::Value& value = serialized[field][*it]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1364 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1365 if (value.type() != Json::stringValue) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1366 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1367 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1368 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1369 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1370 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1371 uidMap_[std::make_pair(level, *it)] = value.asString(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1372 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1373 } |
2655 | 1374 } |
1375 | |
1376 | |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
1377 DicomModification::DicomModification(const Json::Value& serialized) : |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
1378 identifierGenerator_(NULL) |
2655 | 1379 { |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1380 removePrivateTags_ = SerializationToolbox::ReadBoolean(serialized, REMOVE_PRIVATE_TAGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1381 level_ = StringToResourceType(SerializationToolbox::ReadString(serialized, LEVEL).c_str()); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1382 allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1383 keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1384 keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1385 updateReferencedRelationships_ = SerializationToolbox::ReadBoolean |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1386 (serialized, UPDATE_REFERENCED_RELATIONSHIPS); |
2721 | 1387 isAnonymization_ = SerializationToolbox::ReadBoolean(serialized, IS_ANONYMIZATION); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1388 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1389 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1390 SerializationToolbox::ReadSetOfTags(clearings_, serialized, CLEARINGS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1391 SerializationToolbox::ReadSetOfTags(privateTagsToKeep_, serialized, PRIVATE_TAGS_TO_KEEP); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1392 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1393 if (!serialized.isMember(REPLACEMENTS) || |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1394 serialized[REPLACEMENTS].type() != 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 throw OrthancException(ErrorCode_BadFileFormat); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1397 } |
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 Json::Value::Members names = serialized[REPLACEMENTS].getMemberNames(); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1400 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1401 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
|
1402 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1403 DicomTag tag(0, 0); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1404 if (!DicomTag::ParseHexadecimal(tag, it->c_str())) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1405 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1406 throw OrthancException(ErrorCode_BadFileFormat); |
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 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1409 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1410 const Json::Value& value = serialized[REPLACEMENTS][*it]; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1411 replacements_.insert(std::make_pair(tag, new Json::Value(value))); |
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 } |
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 UnserializeUidMap(ResourceType_Patient, serialized, MAP_PATIENTS); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1416 UnserializeUidMap(ResourceType_Study, serialized, MAP_STUDIES); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1417 UnserializeUidMap(ResourceType_Series, serialized, MAP_SERIES); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
1418 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
|
1419 } |
786 | 1420 } |