comparison OrthancFramework/Sources/DicomParsing/DicomModification.h @ 4685:693f049729ba

New versions of Keep(), Remove() and Replace() in DicomModification that use DicomPath
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jun 2021 18:28:57 +0200
parents e3810750dc9d
children 45bce660ce3a
comparison
equal deleted inserted replaced
4684:e3810750dc9d 4685:693f049729ba
95 return elementTo_; 95 return elementTo_;
96 } 96 }
97 97
98 bool Contains(const DicomTag& tag) const; 98 bool Contains(const DicomTag& tag) const;
99 }; 99 };
100
101 class SequenceReplacement : public boost::noncopyable
102 {
103 private:
104 DicomPath path_;
105 Json::Value value_;
106
107 public:
108 SequenceReplacement(const DicomPath& path,
109 const Json::Value& value) :
110 path_(path),
111 value_(value)
112 {
113 }
114
115 const DicomPath& GetPath() const
116 {
117 return path_;
118 }
119
120 const Json::Value& GetValue() const
121 {
122 return value_;
123 }
124 };
100 125
101 typedef std::set<DicomTag> SetOfTags; 126 typedef std::set<DicomTag> SetOfTags;
102 typedef std::map<DicomTag, Json::Value*> Replacements; 127 typedef std::map<DicomTag, Json::Value*> Replacements;
128 typedef std::list<DicomTagRange> RemovedRanges;
129 typedef std::list<DicomPath> ListOfPaths;
130 typedef std::list<SequenceReplacement*> SequenceReplacements;
131
103 typedef std::map< std::pair<ResourceType, std::string>, std::string> UidMap; 132 typedef std::map< std::pair<ResourceType, std::string>, std::string> UidMap;
104 typedef std::list<DicomTagRange> RemovedRanges; 133
105
106 SetOfTags removals_; 134 SetOfTags removals_;
107 SetOfTags clearings_; 135 SetOfTags clearings_;
108 Replacements replacements_; 136 Replacements replacements_;
109 bool removePrivateTags_; 137 bool removePrivateTags_;
110 ResourceType level_; 138 ResourceType level_;
120 std::string privateCreator_; 148 std::string privateCreator_;
121 149
122 IDicomIdentifierGenerator* identifierGenerator_; 150 IDicomIdentifierGenerator* identifierGenerator_;
123 151
124 // New in Orthanc 1.9.4 152 // New in Orthanc 1.9.4
125 SetOfTags uids_; 153 SetOfTags uids_;
126 RemovedRanges removedRanges_; 154 RemovedRanges removedRanges_;
155 ListOfPaths keepSequences_; // Can *possibly* be a path whose prefix is empty
156 ListOfPaths removeSequences_; // Must *never* be a path whose prefix is empty
157 SequenceReplacements sequenceReplacements_; // Must *never* be a path whose prefix is empty
127 158
128 std::string MapDicomIdentifier(const std::string& original, 159 std::string MapDicomIdentifier(const std::string& original,
129 ResourceType level); 160 ResourceType level);
130 161
131 void RegisterMappedDicomIdentifier(const std::string& original, 162 void RegisterMappedDicomIdentifier(const std::string& original,
137 168
138 void MarkNotOrthancAnonymization(); 169 void MarkNotOrthancAnonymization();
139 170
140 void ClearReplacements(); 171 void ClearReplacements();
141 172
142 bool CancelReplacement(const DicomTag& tag); 173 void CancelReplacement(const DicomTag& tag);
143 174
144 void ReplaceInternal(const DicomTag& tag, 175 void ReplaceInternal(const DicomTag& tag,
145 const Json::Value& value); 176 const Json::Value& value);
146 177
147 void SetupUidsFromOrthanc_1_9_3(); 178 void SetupUidsFromOrthanc_1_9_3();
212 void Serialize(Json::Value& value) const; 243 void Serialize(Json::Value& value) const;
213 244
214 void SetPrivateCreator(const std::string& privateCreator); 245 void SetPrivateCreator(const std::string& privateCreator);
215 246
216 const std::string& GetPrivateCreator() const; 247 const std::string& GetPrivateCreator() const;
248
249 // New in Orthanc 1.9.4
250 void Keep(const DicomPath& path);
251
252 // New in Orthanc 1.9.4
253 void Remove(const DicomPath& path);
254
255 // New in Orthanc 1.9.4
256 void Replace(const DicomPath& path,
257 const Json::Value& value, // Encoded using UTF-8
258 bool safeForAnonymization);
217 }; 259 };
218 } 260 }