Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/OrthancDatasets/DicomPath.h @ 1653:2e3b2ed239b9
Fixed usage of object cookie
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 16 Nov 2020 22:17:01 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
rev | line source |
---|---|
1504 | 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 | |
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 | 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 | |
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 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include <DicomFormat/DicomTag.h> | |
26 | |
27 #include <vector> | |
28 #include <stddef.h> | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class DicomPath | |
33 { | |
34 private: | |
35 typedef std::pair<Orthanc::DicomTag, size_t> Prefix; | |
36 | |
37 std::vector<Prefix> prefix_; | |
38 Orthanc::DicomTag finalTag_; | |
39 | |
40 const Prefix& GetPrefixItem(size_t depth) const; | |
41 | |
42 Prefix& GetPrefixItem(size_t depth); | |
43 | |
44 public: | |
1571 | 45 explicit DicomPath(const Orthanc::DicomTag& finalTag) : |
1504 | 46 finalTag_(finalTag) |
47 { | |
48 } | |
49 | |
50 DicomPath(const Orthanc::DicomTag& sequence, | |
51 size_t index, | |
52 const Orthanc::DicomTag& tag); | |
53 | |
54 DicomPath(const Orthanc::DicomTag& sequence1, | |
55 size_t index1, | |
56 const Orthanc::DicomTag& sequence2, | |
57 size_t index2, | |
58 const Orthanc::DicomTag& tag); | |
59 | |
60 DicomPath(const Orthanc::DicomTag& sequence1, | |
61 size_t index1, | |
62 const Orthanc::DicomTag& sequence2, | |
63 size_t index2, | |
64 const Orthanc::DicomTag& sequence3, | |
65 size_t index3, | |
66 const Orthanc::DicomTag& tag); | |
67 | |
68 void AddToPrefix(const Orthanc::DicomTag& tag, | |
69 size_t position) | |
70 { | |
71 prefix_.push_back(std::make_pair(tag, position)); | |
72 } | |
73 | |
74 size_t GetPrefixLength() const | |
75 { | |
76 return prefix_.size(); | |
77 } | |
78 | |
79 Orthanc::DicomTag GetPrefixTag(size_t depth) const | |
80 { | |
81 return GetPrefixItem(depth).first; | |
82 } | |
83 | |
84 size_t GetPrefixIndex(size_t depth) const | |
85 { | |
86 return GetPrefixItem(depth).second; | |
87 } | |
88 | |
89 void SetPrefixIndex(size_t depth, | |
90 size_t value) | |
91 { | |
92 GetPrefixItem(depth).second = value; | |
93 } | |
94 | |
95 const Orthanc::DicomTag& GetFinalTag() const | |
96 { | |
97 return finalTag_; | |
98 } | |
99 | |
100 void SetFinalTag(const Orthanc::DicomTag& tag) | |
101 { | |
102 finalTag_ = tag; | |
103 } | |
104 | |
105 std::string Format() const; | |
106 }; | |
107 } |