Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomParsing/ITagVisitor.h @ 5137:15109c3f0f7d
added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 18 Jan 2023 17:58:51 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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:
4044
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:
4044
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:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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:
4044
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:
4044
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:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #pragma once |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../DicomFormat/DicomTag.h" |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include <vector> |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 #include <boost/noncopyable.hpp> |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace Orthanc |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 class ITagVisitor : public boost::noncopyable |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 public: |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 enum Action |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 Action_Replace, |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
39 Action_Remove, // New in Orthanc 1.9.5 |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 Action_None |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 }; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 virtual ~ITagVisitor() |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 } |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
47 // Visiting a DICOM element that is internal to DCMTK. Can return |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
48 // "Remove" or "None". |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
49 virtual Action VisitNotSupported(const std::vector<DicomTag>& parentTags, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
50 const std::vector<size_t>& parentIndexes, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
51 const DicomTag& tag, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
52 ValueRepresentation vr) = 0; |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
53 |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
54 // SQ - can return "Remove" or "None" |
4737
979ae3ea3381
DANGEROUS commit: Anonymization is now also applied to nested sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4734
diff
changeset
|
55 virtual Action VisitSequence(const std::vector<DicomTag>& parentTags, |
979ae3ea3381
DANGEROUS commit: Anonymization is now also applied to nested sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4734
diff
changeset
|
56 const std::vector<size_t>& parentIndexes, |
979ae3ea3381
DANGEROUS commit: Anonymization is now also applied to nested sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4734
diff
changeset
|
57 const DicomTag& tag, |
979ae3ea3381
DANGEROUS commit: Anonymization is now also applied to nested sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4734
diff
changeset
|
58 size_t countItems) = 0; |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
59 |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 // SL, SS, UL, US - can return "Remove" or "None" |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
61 virtual Action VisitIntegers(const std::vector<DicomTag>& parentTags, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
62 const std::vector<size_t>& parentIndexes, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
63 const DicomTag& tag, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 ValueRepresentation vr, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 const std::vector<int64_t>& values) = 0; |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 // FL, FD, OD, OF - can return "Remove" or "None" |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 virtual Action VisitDoubles(const std::vector<DicomTag>& parentTags, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
69 const std::vector<size_t>& parentIndexes, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
70 const DicomTag& tag, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
71 ValueRepresentation vr, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
72 const std::vector<double>& values) = 0; |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
73 |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
74 // AT - can return "Remove" or "None" |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
75 virtual Action VisitAttributes(const std::vector<DicomTag>& parentTags, |
3195 | 76 const std::vector<size_t>& parentIndexes, |
77 const DicomTag& tag, | |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
78 const std::vector<DicomTag>& values) = 0; |
3195 | 79 |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
80 // OB, OL, OW, UN - can return "Remove" or "None" |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
81 virtual Action VisitBinary(const std::vector<DicomTag>& parentTags, |
3195 | 82 const std::vector<size_t>& parentIndexes, |
83 const DicomTag& tag, | |
84 ValueRepresentation vr, | |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
85 const void* data, |
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
86 size_t size) = 0; |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 |
4734
b51c08bd5c38
added ITagVisitor::Action_Remove
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
88 // Visiting an UTF-8 string - can return "Replace", "Remove" or "None" |
2499
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 virtual Action VisitString(std::string& newValue, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 const std::vector<DicomTag>& parentTags, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 const std::vector<size_t>& parentIndexes, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 const DicomTag& tag, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 ValueRepresentation vr, |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 const std::string& value) = 0; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 }; |
83b8b6743531
ITagVisitor - for anonymization relationships
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 } |