annotate OrthancStone/Sources/Toolbox/OrthancDatasets/DicomPath.h @ 1664:32e765ca7193

fix build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Nov 2020 12:15:21 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
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
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
1504
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
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
1504
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include <DicomFormat/DicomTag.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <vector>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <stddef.h>
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace OrthancStone
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 class DicomPath
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 private:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 typedef std::pair<Orthanc::DicomTag, size_t> Prefix;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 std::vector<Prefix> prefix_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 Orthanc::DicomTag finalTag_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 const Prefix& GetPrefixItem(size_t depth) const;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 Prefix& GetPrefixItem(size_t depth);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 public:
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
45 explicit DicomPath(const Orthanc::DicomTag& finalTag) :
1504
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 finalTag_(finalTag)
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 DicomPath(const Orthanc::DicomTag& sequence,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 size_t index,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 DicomPath(const Orthanc::DicomTag& sequence1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 size_t index1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 const Orthanc::DicomTag& sequence2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 size_t index2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 DicomPath(const Orthanc::DicomTag& sequence1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 size_t index1,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 const Orthanc::DicomTag& sequence2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 size_t index2,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 const Orthanc::DicomTag& sequence3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 size_t index3,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 const Orthanc::DicomTag& tag);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 void AddToPrefix(const Orthanc::DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 size_t position)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 prefix_.push_back(std::make_pair(tag, position));
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 size_t GetPrefixLength() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return prefix_.size();
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 Orthanc::DicomTag GetPrefixTag(size_t depth) const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 return GetPrefixItem(depth).first;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 size_t GetPrefixIndex(size_t depth) const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 return GetPrefixItem(depth).second;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 void SetPrefixIndex(size_t depth,
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 size_t value)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 GetPrefixItem(depth).second = value;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 const Orthanc::DicomTag& GetFinalTag() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 return finalTag_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 void SetFinalTag(const Orthanc::DicomTag& tag)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 finalTag_ = tag;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 std::string Format() const;
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 };
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 }