comparison Framework/Toolbox/OrthancDatasets/DicomPath.h @ 1504:d8af188ab545

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