Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomParsing/DicomModification.h @ 5220:df39c7583a49 db-protobuf
preparing virtual methods for labels
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Apr 2023 18:09:04 +0200 |
parents | 0ea402b4d901 |
children | 5b2a5cc64cb1 |
rev | line source |
---|---|
4297 | 1 /** |
786 | 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 |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5141
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5141
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
786 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
11 * the License, or (at your option) any later version. |
786 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
16 * Lesser General Public License for more details. |
786 | 17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4063
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
786 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
790 | 26 #include "ParsedDicomFile.h" |
786 | 27 |
4680
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
28 #include <list> |
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
29 |
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
30 |
786 | 31 namespace Orthanc |
32 { | |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
33 class ORTHANC_PUBLIC DicomModification : public boost::noncopyable |
786 | 34 { |
35 /** | |
36 * Process: | |
37 * (1) Remove private tags | |
38 * (2) Remove tags specified by the user | |
39 * (3) Replace tags | |
40 **/ | |
41 | |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
42 public: |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
43 class IDicomIdentifierGenerator : public boost::noncopyable |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
44 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
45 public: |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
46 virtual ~IDicomIdentifierGenerator() |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
47 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
48 } |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
49 |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
50 virtual bool Apply(std::string& target, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
51 const std::string& sourceIdentifier, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
52 ResourceType level, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
53 const DicomMap& sourceDicom) = 0; |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
54 }; |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
55 |
786 | 56 private: |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
57 class RelationshipsVisitor; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
58 |
4678
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
59 class DicomTagRange |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
60 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
61 private: |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
62 uint16_t groupFrom_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
63 uint16_t groupTo_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
64 uint16_t elementFrom_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
65 uint16_t elementTo_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
66 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
67 public: |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
68 DicomTagRange(uint16_t groupFrom, |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
69 uint16_t groupTo, |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
70 uint16_t elementFrom, |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
71 uint16_t elementTo); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
72 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
73 uint16_t GetGroupFrom() const |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
74 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
75 return groupFrom_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
76 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
77 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
78 uint16_t GetGroupTo() const |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
79 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
80 return groupTo_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
81 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
82 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
83 uint16_t GetElementFrom() const |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
84 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
85 return elementFrom_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
86 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
87 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
88 uint16_t GetElementTo() const |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
89 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
90 return elementTo_; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
91 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
92 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
93 bool Contains(const DicomTag& tag) const; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
94 }; |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
95 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
96 class SequenceReplacement : public boost::noncopyable |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
97 { |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
98 private: |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
99 DicomPath path_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
100 Json::Value value_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
101 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
102 public: |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
103 SequenceReplacement(const DicomPath& path, |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
104 const Json::Value& value) : |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
105 path_(path), |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
106 value_(value) |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
107 { |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
108 } |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
109 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
110 const DicomPath& GetPath() const |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
111 { |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
112 return path_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
113 } |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
114 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
115 const Json::Value& GetValue() const |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
116 { |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
117 return value_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
118 } |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
119 }; |
4678
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
120 |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
121 typedef std::set<DicomTag> SetOfTags; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
122 typedef std::map<DicomTag, Json::Value*> Replacements; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
123 typedef std::list<DicomTagRange> RemovedRanges; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
124 typedef std::list<DicomPath> ListOfPaths; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
125 typedef std::list<SequenceReplacement*> SequenceReplacements; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
126 |
788 | 127 typedef std::map< std::pair<ResourceType, std::string>, std::string> UidMap; |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
128 |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
790
diff
changeset
|
129 SetOfTags removals_; |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
130 SetOfTags clearings_; |
5137
15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
Alain Mazy <am@osimis.io>
parents:
5130
diff
changeset
|
131 SetOfTags keep_; |
786 | 132 Replacements replacements_; |
133 bool removePrivateTags_; | |
788 | 134 ResourceType level_; |
786 | 135 UidMap uidMap_; |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
790
diff
changeset
|
136 SetOfTags privateTagsToKeep_; |
5122
8638522eeda1
revert changeset df4a90a65af9 that removes features used elsewhere, and protect by Force the change of UIDs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5087
diff
changeset
|
137 bool allowManualIdentifiers_; |
2194
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
138 bool keepStudyInstanceUid_; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
139 bool keepSeriesInstanceUid_; |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3709
diff
changeset
|
140 bool keepSopInstanceUid_; |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
141 bool updateReferencedRelationships_; |
2721 | 142 bool isAnonymization_; |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
143 DicomMap currentSource_; |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
144 std::string privateCreator_; |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
145 |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
146 IDicomIdentifierGenerator* identifierGenerator_; |
786 | 147 |
4684
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
148 // New in Orthanc 1.9.4 |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
149 SetOfTags uids_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
150 RemovedRanges removedRanges_; |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
151 ListOfPaths keepSequences_; // Can *possibly* be a path whose prefix is empty |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
152 ListOfPaths removeSequences_; // Must *never* be a path whose prefix is empty |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
153 SequenceReplacements sequenceReplacements_; // Must *never* be a path whose prefix is empty |
4684
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
154 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
155 std::string MapDicomIdentifier(const std::string& original, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
156 ResourceType level); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
157 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
158 void RegisterMappedDicomIdentifier(const std::string& original, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
159 const std::string& mapped, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
160 ResourceType level); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
161 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
162 void MapDicomTags(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
163 ResourceType level); |
786 | 164 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
165 void MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
166 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
167 void ClearReplacements(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
168 |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
169 void CancelReplacement(const DicomTag& tag); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
170 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
171 void ReplaceInternal(const DicomTag& tag, |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
172 const Json::Value& value); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
173 |
4678
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
174 void SetupUidsFromOrthanc_1_9_3(); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
175 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
176 void SetupAnonymization2008(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
177 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
178 void SetupAnonymization2017c(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
179 |
4677
521e39b3f2c0
Fix issue #146 (Update Anonyization to 2019c) - was actually updated to 2021b
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
180 void SetupAnonymization2021b(); |
521e39b3f2c0
Fix issue #146 (Update Anonyization to 2019c) - was actually updated to 2021b
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
181 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
182 void UnserializeUidMap(ResourceType level, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
183 const Json::Value& serialized, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
184 const char* field); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
185 |
786 | 186 public: |
187 DicomModification(); | |
188 | |
4200 | 189 explicit DicomModification(const Json::Value& serialized); |
2655 | 190 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
191 ~DicomModification(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
192 |
787
ac18946afa74
refactoring of anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
786
diff
changeset
|
193 void Keep(const DicomTag& tag); |
786 | 194 |
195 void Remove(const DicomTag& tag); | |
196 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
197 // Replace the DICOM tag as a NULL/empty value (e.g. for anonymization) |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
198 void Clear(const DicomTag& tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
199 |
786 | 200 bool IsRemoved(const DicomTag& tag) const; |
201 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
202 bool IsCleared(const DicomTag& tag) const; |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
203 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
204 // "safeForAnonymization" tells Orthanc that this replacement does |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
205 // not break the anonymization process it implements (for internal use only) |
786 | 206 void Replace(const DicomTag& tag, |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
207 const Json::Value& value, // Encoded using UTF-8 |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
208 bool safeForAnonymization); |
786 | 209 |
210 bool IsReplaced(const DicomTag& tag) const; | |
211 | |
5137
15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
Alain Mazy <am@osimis.io>
parents:
5130
diff
changeset
|
212 void GetReplacedTags(std::set<DicomTag>& target) const; |
15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
Alain Mazy <am@osimis.io>
parents:
5130
diff
changeset
|
213 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
214 const Json::Value& GetReplacement(const DicomTag& tag) const; |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
215 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
216 std::string GetReplacementAsString(const DicomTag& tag) const; |
786 | 217 |
5137
15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
Alain Mazy <am@osimis.io>
parents:
5130
diff
changeset
|
218 bool IsKept(const DicomTag& tag) const; |
15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
Alain Mazy <am@osimis.io>
parents:
5130
diff
changeset
|
219 |
786 | 220 void SetRemovePrivateTags(bool removed); |
221 | |
4297 | 222 bool ArePrivateTagsRemoved() const; |
786 | 223 |
788 | 224 void SetLevel(ResourceType level); |
786 | 225 |
4297 | 226 ResourceType GetLevel() const; |
786 | 227 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
228 void SetupAnonymization(DicomVersion version); |
786 | 229 |
230 void Apply(ParsedDicomFile& toModify); | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
231 |
5122
8638522eeda1
revert changeset df4a90a65af9 that removes features used elsewhere, and protect by Force the change of UIDs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5087
diff
changeset
|
232 void SetAllowManualIdentifiers(bool check); |
8638522eeda1
revert changeset df4a90a65af9 that removes features used elsewhere, and protect by Force the change of UIDs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5087
diff
changeset
|
233 |
8638522eeda1
revert changeset df4a90a65af9 that removes features used elsewhere, and protect by Force the change of UIDs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5087
diff
changeset
|
234 bool AreAllowManualIdentifiers() const; |
8638522eeda1
revert changeset df4a90a65af9 that removes features used elsewhere, and protect by Force the change of UIDs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5087
diff
changeset
|
235 |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
236 void ParseModifyRequest(const Json::Value& request); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
237 |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
238 // "patientNameOverridden" is set to "true" iff. the PatientName |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
239 // (0010,0010) tag is manually replaced, removed, cleared or kept |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4685
diff
changeset
|
240 void ParseAnonymizationRequest(bool& patientNameOverridden /* out */, |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
241 const Json::Value& request); |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
242 |
4297 | 243 void SetDicomIdentifierGenerator(IDicomIdentifierGenerator& generator); |
2616
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
244 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
245 void Serialize(Json::Value& value) const; |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
246 |
4297 | 247 void SetPrivateCreator(const std::string& privateCreator); |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
248 |
4297 | 249 const std::string& GetPrivateCreator() const; |
4685
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
250 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
251 // New in Orthanc 1.9.4 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
252 void Keep(const DicomPath& path); |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
253 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
254 // New in Orthanc 1.9.4 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
255 void Remove(const DicomPath& path); |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
256 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
257 // New in Orthanc 1.9.4 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
258 void Replace(const DicomPath& path, |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
259 const Json::Value& value, // Encoded using UTF-8 |
693f049729ba
New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4684
diff
changeset
|
260 bool safeForAnonymization); |
4789
51ec061516c9
Fix handling of option "DeidentifyLogs", notably for tags (0010,0010) and (0010,0020)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4737
diff
changeset
|
261 |
51ec061516c9
Fix handling of option "DeidentifyLogs", notably for tags (0010,0010) and (0010,0020)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4737
diff
changeset
|
262 bool IsAlteredTag(const DicomTag& tag) const; |
786 | 263 }; |
264 } |