annotate OrthancStone/Sources/Toolbox/OrthancDatasets/DicomPath.h @ 1592:0d4b11ba86df

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Oct 2020 15:15:32 +0200
parents 85e117739eca
children 4fb8fdf03314
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1504
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include <DicomFormat/DicomTag.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <vector>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <stddef.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 typedef std::pair<Orthanc::DicomTag, size_t> Prefix;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 std::vector<Prefix> prefix_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 Orthanc::DicomTag finalTag_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 const Prefix& GetPrefixItem(size_t depth) const;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 Prefix& GetPrefixItem(size_t depth);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public:
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
44 explicit DicomPath(const Orthanc::DicomTag& finalTag) :
1504
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 finalTag_(finalTag)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 DicomPath(const Orthanc::DicomTag& sequence,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 size_t index,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 DicomPath(const Orthanc::DicomTag& sequence1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 size_t index1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 const Orthanc::DicomTag& sequence2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 size_t index2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 DicomPath(const Orthanc::DicomTag& sequence1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 size_t index1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 const Orthanc::DicomTag& sequence2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 size_t index2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 const Orthanc::DicomTag& sequence3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 size_t index3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 void AddToPrefix(const Orthanc::DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 size_t position)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 prefix_.push_back(std::make_pair(tag, position));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 size_t GetPrefixLength() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 return prefix_.size();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 Orthanc::DicomTag GetPrefixTag(size_t depth) const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 return GetPrefixItem(depth).first;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 size_t GetPrefixIndex(size_t depth) const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 return GetPrefixItem(depth).second;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 void SetPrefixIndex(size_t depth,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 size_t value)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 GetPrefixItem(depth).second = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 const Orthanc::DicomTag& GetFinalTag() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 return finalTag_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 void SetFinalTag(const Orthanc::DicomTag& tag)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 finalTag_ = tag;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 std::string Format() const;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 };
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }