comparison OrthancStone/Sources/Toolbox/OrthancDatasets/DicomDatasetReader.cpp @ 1834:126522623e20

replaced OrthancStone::DicomPath by new class Orthanc::DicomPath from orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jun 2021 12:07:04 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
comparison
equal deleted inserted replaced
1833:3c0996f028a1 1834:126522623e20
33 dataset_(dataset) 33 dataset_(dataset)
34 { 34 {
35 } 35 }
36 36
37 37
38 std::string DicomDatasetReader::GetStringValue(const DicomPath& path, 38 std::string DicomDatasetReader::GetStringValue(const Orthanc::DicomPath& path,
39 const std::string& defaultValue) const 39 const std::string& defaultValue) const
40 { 40 {
41 std::string s; 41 std::string s;
42 if (dataset_.GetStringValue(s, path)) 42 if (dataset_.GetStringValue(s, path))
43 { 43 {
48 return defaultValue; 48 return defaultValue;
49 } 49 }
50 } 50 }
51 51
52 52
53 std::string DicomDatasetReader::GetMandatoryStringValue(const DicomPath& path) const 53 std::string DicomDatasetReader::GetMandatoryStringValue(const Orthanc::DicomPath& path) const
54 { 54 {
55 std::string s; 55 std::string s;
56 if (dataset_.GetStringValue(s, path)) 56 if (dataset_.GetStringValue(s, path))
57 { 57 {
58 return s; 58 return s;
65 65
66 66
67 template <typename T> 67 template <typename T>
68 static bool GetValueInternal(T& target, 68 static bool GetValueInternal(T& target,
69 const IDicomDataset& dataset, 69 const IDicomDataset& dataset,
70 const DicomPath& path) 70 const Orthanc::DicomPath& path)
71 { 71 {
72 try 72 try
73 { 73 {
74 std::string s; 74 std::string s;
75 75
89 } 89 }
90 } 90 }
91 91
92 92
93 bool DicomDatasetReader::GetIntegerValue(int& target, 93 bool DicomDatasetReader::GetIntegerValue(int& target,
94 const DicomPath& path) const 94 const Orthanc::DicomPath& path) const
95 { 95 {
96 return GetValueInternal<int>(target, dataset_, path); 96 return GetValueInternal<int>(target, dataset_, path);
97 } 97 }
98 98
99 99
100 bool DicomDatasetReader::GetUnsignedIntegerValue(unsigned int& target, 100 bool DicomDatasetReader::GetUnsignedIntegerValue(unsigned int& target,
101 const DicomPath& path) const 101 const Orthanc::DicomPath& path) const
102 { 102 {
103 int value; 103 int value;
104 104
105 if (!GetIntegerValue(value, path)) 105 if (!GetIntegerValue(value, path))
106 { 106 {
117 } 117 }
118 } 118 }
119 119
120 120
121 bool DicomDatasetReader::GetFloatValue(float& target, 121 bool DicomDatasetReader::GetFloatValue(float& target,
122 const DicomPath& path) const 122 const Orthanc::DicomPath& path) const
123 { 123 {
124 return GetValueInternal<float>(target, dataset_, path); 124 return GetValueInternal<float>(target, dataset_, path);
125 } 125 }
126 126
127 127
128 bool DicomDatasetReader::GetDoubleValue(double& target, 128 bool DicomDatasetReader::GetDoubleValue(double& target,
129 const DicomPath& path) const 129 const Orthanc::DicomPath& path) const
130 { 130 {
131 return GetValueInternal<double>(target, dataset_, path); 131 return GetValueInternal<double>(target, dataset_, path);
132 } 132 }
133 } 133 }