annotate OrthancServer/DicomModification.h @ 1410:8146fcd7d8af

back to mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jun 2015 13:44:41 +0200
parents 6e7e5ed91c2d
children 18c02c6987d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
4 * Department, University Hospital of Liege, Belgium
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #pragma once
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
790
331eaf9d9d69 ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 788
diff changeset
35 #include "ParsedDicomFile.h"
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 namespace Orthanc
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 class DicomModification
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 /**
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 * Process:
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 * (1) Remove private tags
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 * (2) Remove tags specified by the user
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 * (3) Replace tags
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 **/
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 private:
991
2f76b92addd4 keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 790
diff changeset
49 typedef std::set<DicomTag> SetOfTags;
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 typedef std::map<DicomTag, std::string> Replacements;
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 787
diff changeset
51 typedef std::map< std::pair<ResourceType, std::string>, std::string> UidMap;
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
991
2f76b92addd4 keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 790
diff changeset
53 SetOfTags removals_;
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 Replacements replacements_;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 bool removePrivateTags_;
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 787
diff changeset
56 ResourceType level_;
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 UidMap uidMap_;
991
2f76b92addd4 keep private tags during anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 790
diff changeset
58 SetOfTags privateTagsToKeep_;
1279
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
59 bool allowManualIdentifiers_;
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 void MapDicomIdentifier(ParsedDicomFile& dicom,
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 787
diff changeset
62 ResourceType level);
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
1279
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
64 void MarkNotOrthancAnonymization();
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
65
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 public:
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 DicomModification();
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
787
ac18946afa74 refactoring of anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 786
diff changeset
69 void Keep(const DicomTag& tag);
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 void Remove(const DicomTag& tag);
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 bool IsRemoved(const DicomTag& tag) const;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 void Replace(const DicomTag& tag,
1279
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
76 const std::string& value,
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
77 bool safeForAnonymization = false);
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 bool IsReplaced(const DicomTag& tag) const;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 const std::string& GetReplacement(const DicomTag& tag) const;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 void SetRemovePrivateTags(bool removed);
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 bool ArePrivateTagsRemoved() const
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 return removePrivateTags_;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 787
diff changeset
90 void SetLevel(ResourceType level);
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
788
7ebe4bf87196 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 787
diff changeset
92 ResourceType GetLevel() const
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 {
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 return level_;
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 void SetupAnonymization();
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 void Apply(ParsedDicomFile& toModify);
1279
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
100
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
101 void SetAllowManualIdentifiers(bool check)
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
102 {
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
103 allowManualIdentifiers_ = check;
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
104 }
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
105
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
106 bool AreAllowManualIdentifiers() const
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
107 {
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
108 return allowManualIdentifiers_;
7f3a65e84d4b More flexible /modify and /anonymize for single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
109 }
786
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 };
b6d6b65142e8 DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }