Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomParsing/DicomModification.h @ 4684:e3810750dc9d
simplified DicomModification::RelationshipsVisitor
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Jun 2021 14:42:09 +0200 |
parents | 898e8ac8c453 |
children | 693f049729ba |
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 |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4297
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
786 | 6 * |
7 * 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
|
8 * 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
|
9 * 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
|
10 * the License, or (at your option) any later version. |
786 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * 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
|
15 * Lesser General Public License for more details. |
786 | 16 * |
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
|
17 * 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
|
18 * 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
|
19 * <http://www.gnu.org/licenses/>. |
786 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
790 | 25 #include "ParsedDicomFile.h" |
786 | 26 |
4680
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
27 #include <list> |
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
28 |
898e8ac8c453
fix build of wsi and stone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
29 |
786 | 30 namespace Orthanc |
31 { | |
4063
e00f3d089991
shared library of orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
32 class ORTHANC_PUBLIC DicomModification : public boost::noncopyable |
786 | 33 { |
34 /** | |
35 * Process: | |
36 * (1) Remove private tags | |
37 * (2) Remove tags specified by the user | |
38 * (3) Replace tags | |
39 **/ | |
40 | |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
41 public: |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
42 enum TagOperation |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
43 { |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
44 TagOperation_Keep, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
45 TagOperation_Remove |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
46 }; |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
47 |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
48 class IDicomIdentifierGenerator : public boost::noncopyable |
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 public: |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
51 virtual ~IDicomIdentifierGenerator() |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
52 { |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
53 } |
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 virtual bool Apply(std::string& target, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
56 const std::string& sourceIdentifier, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
57 ResourceType level, |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
58 const DicomMap& sourceDicom) = 0; |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
59 }; |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
60 |
786 | 61 private: |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
62 class RelationshipsVisitor; |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
63 |
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
|
64 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
|
65 { |
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 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 |
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 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
|
73 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
|
74 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
|
75 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
|
76 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
|
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 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
|
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 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
|
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 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
|
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 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
|
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 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
|
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 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
|
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 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
|
94 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
95 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
|
96 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
97 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
98 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
|
99 }; |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4677
diff
changeset
|
100 |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
790
diff
changeset
|
101 typedef std::set<DicomTag> SetOfTags; |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
102 typedef std::map<DicomTag, Json::Value*> Replacements; |
788 | 103 typedef std::map< std::pair<ResourceType, std::string>, std::string> UidMap; |
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
|
104 typedef std::list<DicomTagRange> RemovedRanges; |
786 | 105 |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
790
diff
changeset
|
106 SetOfTags removals_; |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
107 SetOfTags clearings_; |
786 | 108 Replacements replacements_; |
109 bool removePrivateTags_; | |
788 | 110 ResourceType level_; |
786 | 111 UidMap uidMap_; |
991
2f76b92addd4
keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
790
diff
changeset
|
112 SetOfTags privateTagsToKeep_; |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
113 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
|
114 bool keepStudyInstanceUid_; |
3b40ca7470cc
"Keep" option for modifications to keep original DICOM identifiers (advanced feature)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
115 bool keepSeriesInstanceUid_; |
3860
9ccbbd55bc23
allow Keeping the SOPInstanceUID in /instances/../modify
Alain Mazy <alain@mazy.be>
parents:
3709
diff
changeset
|
116 bool keepSopInstanceUid_; |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
117 bool updateReferencedRelationships_; |
2721 | 118 bool isAnonymization_; |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
119 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
|
120 std::string privateCreator_; |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
121 |
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
122 IDicomIdentifierGenerator* identifierGenerator_; |
786 | 123 |
4684
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
124 // New in Orthanc 1.9.4 |
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
125 SetOfTags uids_; |
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
126 RemovedRanges removedRanges_; |
e3810750dc9d
simplified DicomModification::RelationshipsVisitor
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4680
diff
changeset
|
127 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
128 std::string MapDicomIdentifier(const std::string& original, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
129 ResourceType level); |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
130 |
3513
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
131 void RegisterMappedDicomIdentifier(const std::string& original, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
132 const std::string& mapped, |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
133 ResourceType level); |
7db879b014ff
Fix lost relationships between CT and RT-STRUCT during anonymization
amazy
parents:
3060
diff
changeset
|
134 |
2506
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
135 void MapDicomTags(ParsedDicomFile& dicom, |
51b91ead6c38
Preservation of UID relationships while anonymizing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
136 ResourceType level); |
786 | 137 |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
138 void MarkNotOrthancAnonymization(); |
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
139 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
140 void ClearReplacements(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
141 |
2323 | 142 bool CancelReplacement(const DicomTag& tag); |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
143 |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
144 void ReplaceInternal(const DicomTag& tag, |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
145 const Json::Value& value); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
146 |
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
|
147 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
|
148 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
149 void SetupAnonymization2008(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
150 |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
151 void SetupAnonymization2017c(); |
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
152 |
4677
521e39b3f2c0
Fix issue #146 (Update Anonyization to 2019c) - was actually updated to 2021b
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
153 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
|
154 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
155 void UnserializeUidMap(ResourceType level, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
156 const Json::Value& serialized, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
157 const char* field); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
158 |
786 | 159 public: |
160 DicomModification(); | |
161 | |
4200 | 162 explicit DicomModification(const Json::Value& serialized); |
2655 | 163 |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
164 ~DicomModification(); |
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
165 |
787
ac18946afa74
refactoring of anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
786
diff
changeset
|
166 void Keep(const DicomTag& tag); |
786 | 167 |
168 void Remove(const DicomTag& tag); | |
169 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
170 // 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
|
171 void Clear(const DicomTag& tag); |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
172 |
786 | 173 bool IsRemoved(const DicomTag& tag) const; |
174 | |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
175 bool IsCleared(const DicomTag& tag) const; |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
176 |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
177 // "safeForAnonymization" tells Orthanc that this replacement does |
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
178 // not break the anonymization process it implements (for internal use only) |
786 | 179 void Replace(const DicomTag& tag, |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
180 const Json::Value& value, // Encoded using UTF-8 |
2310
b7fba68747f6
DicomModification::Clear()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2309
diff
changeset
|
181 bool safeForAnonymization); |
786 | 182 |
183 bool IsReplaced(const DicomTag& tag) const; | |
184 | |
1698
d78b87f93bcf
DicomModification use Json::Value
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
185 const Json::Value& GetReplacement(const DicomTag& tag) const; |
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 std::string GetReplacementAsString(const DicomTag& tag) const; |
786 | 188 |
189 void SetRemovePrivateTags(bool removed); | |
190 | |
4297 | 191 bool ArePrivateTagsRemoved() const; |
786 | 192 |
788 | 193 void SetLevel(ResourceType level); |
786 | 194 |
4297 | 195 ResourceType GetLevel() const; |
786 | 196 |
2309
4dc313b9a20a
Argument "DicomVersion" in URIs "/{...}/{...}/anonymization"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
197 void SetupAnonymization(DicomVersion version); |
786 | 198 |
199 void Apply(ParsedDicomFile& toModify); | |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
200 |
4297 | 201 void SetAllowManualIdentifiers(bool check); |
1279
7f3a65e84d4b
More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
202 |
4297 | 203 bool AreAllowManualIdentifiers() const; |
2519
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
204 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
205 void ParseModifyRequest(const Json::Value& request); |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
206 |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
207 void ParseAnonymizationRequest(bool& patientNameReplaced, |
2e6b7862ccf2
ParseAnonymizationRequest/ParseModifyRequest now in DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2506
diff
changeset
|
208 const Json::Value& request); |
2535
d3476d90dcb7
DicomModification::SetDicomIdentifierGenerator()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2519
diff
changeset
|
209 |
4297 | 210 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
|
211 |
2f3007bf0708
event queues in Lua, serialization of sequence of operations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2535
diff
changeset
|
212 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
|
213 |
4297 | 214 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
|
215 |
4297 | 216 const std::string& GetPrivateCreator() const; |
786 | 217 }; |
218 } |