Mercurial > hg > orthanc
comparison OrthancServer/OrthancFindRequestHandler.cpp @ 2007:655489d9165d
DicomMap::ParseDicomMetaInformation()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 09 Jun 2016 15:46:33 +0200 |
parents | 6301bbcbcaed |
children | e33e0ae51d7b |
comparison
equal
deleted
inserted
replaced
2006:6301bbcbcaed | 2007:655489d9165d |
---|---|
82 } | 82 } |
83 | 83 |
84 s += *it; | 84 s += *it; |
85 } | 85 } |
86 | 86 |
87 result.SetValue(tag, s); | 87 result.SetValue(tag, s, false); |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 static void ExtractTagFromMainDicomTags(std::set<std::string>& target, | 91 static void ExtractTagFromMainDicomTags(std::set<std::string>& target, |
92 ServerIndex& index, | 92 ServerIndex& index, |
146 index.GetChildren(studies, patient); | 146 index.GetChildren(studies, patient); |
147 | 147 |
148 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES)) | 148 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES)) |
149 { | 149 { |
150 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES, | 150 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES, |
151 boost::lexical_cast<std::string>(studies.size())); | 151 boost::lexical_cast<std::string>(studies.size()), false); |
152 } | 152 } |
153 | 153 |
154 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES) && | 154 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES) && |
155 !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) | 155 !query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) |
156 { | 156 { |
162 studies.clear(); // This information is useless below | 162 studies.clear(); // This information is useless below |
163 | 163 |
164 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES)) | 164 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES)) |
165 { | 165 { |
166 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES, | 166 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES, |
167 boost::lexical_cast<std::string>(series.size())); | 167 boost::lexical_cast<std::string>(series.size()), false); |
168 } | 168 } |
169 | 169 |
170 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) | 170 if (!query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) |
171 { | 171 { |
172 return; | 172 return; |
176 GetChildren(instances, index, series); | 176 GetChildren(instances, index, series); |
177 | 177 |
178 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) | 178 if (query.HasTag(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES)) |
179 { | 179 { |
180 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, | 180 result.SetValue(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, |
181 boost::lexical_cast<std::string>(instances.size())); | 181 boost::lexical_cast<std::string>(instances.size()), false); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 static void ComputeStudyCounters(DicomMap& result, | 186 static void ComputeStudyCounters(DicomMap& result, |
194 index.GetChildren(series, study); | 194 index.GetChildren(series, study); |
195 | 195 |
196 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES)) | 196 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES)) |
197 { | 197 { |
198 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES, | 198 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES, |
199 boost::lexical_cast<std::string>(series.size())); | 199 boost::lexical_cast<std::string>(series.size()), false); |
200 } | 200 } |
201 | 201 |
202 if (query.HasTag(DICOM_TAG_MODALITIES_IN_STUDY)) | 202 if (query.HasTag(DICOM_TAG_MODALITIES_IN_STUDY)) |
203 { | 203 { |
204 std::set<std::string> values; | 204 std::set<std::string> values; |
216 GetChildren(instances, index, series); | 216 GetChildren(instances, index, series); |
217 | 217 |
218 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES)) | 218 if (query.HasTag(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES)) |
219 { | 219 { |
220 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES, | 220 result.SetValue(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES, |
221 boost::lexical_cast<std::string>(instances.size())); | 221 boost::lexical_cast<std::string>(instances.size()), false); |
222 } | 222 } |
223 | 223 |
224 if (query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY)) | 224 if (query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY)) |
225 { | 225 { |
226 std::set<std::string> values; | 226 std::set<std::string> values; |
239 index.GetChildren(instances, series); | 239 index.GetChildren(instances, series); |
240 | 240 |
241 if (query.HasTag(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES)) | 241 if (query.HasTag(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES)) |
242 { | 242 { |
243 result.SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES, | 243 result.SetValue(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES, |
244 boost::lexical_cast<std::string>(instances.size())); | 244 boost::lexical_cast<std::string>(instances.size()), false); |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 static DicomMap* ComputeCounters(ServerContext& context, | 249 static DicomMap* ComputeCounters(ServerContext& context, |
340 std::string tag = query.GetElement(i).GetTag().Format(); | 340 std::string tag = query.GetElement(i).GetTag().Format(); |
341 std::string value; | 341 std::string value; |
342 if (resource.isMember(tag)) | 342 if (resource.isMember(tag)) |
343 { | 343 { |
344 value = resource.get(tag, Json::arrayValue).get("Value", "").asString(); | 344 value = resource.get(tag, Json::arrayValue).get("Value", "").asString(); |
345 result.SetValue(query.GetElement(i).GetTag(), value); | 345 result.SetValue(query.GetElement(i).GetTag(), value, false); |
346 } | 346 } |
347 else | 347 else |
348 { | 348 { |
349 result.SetValue(query.GetElement(i).GetTag(), ""); | 349 result.SetValue(query.GetElement(i).GetTag(), "", false); |
350 } | 350 } |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 if (counters != NULL) | 354 if (counters != NULL) |
355 { | 355 { |
356 DicomArray tmp(*counters); | 356 DicomArray tmp(*counters); |
357 for (size_t i = 0; i < tmp.GetSize(); i++) | 357 for (size_t i = 0; i < tmp.GetSize(); i++) |
358 { | 358 { |
359 result.SetValue(tmp.GetElement(i).GetTag(), tmp.GetElement(i).GetValue().GetContent()); | 359 result.SetValue(tmp.GetElement(i).GetTag(), tmp.GetElement(i).GetValue().GetContent(), false); |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 if (result.GetSize() == 0 && | 363 if (result.GetSize() == 0 && |
364 sequencesToReturn.empty()) | 364 sequencesToReturn.empty()) |
494 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table mapping names of DICOM tags to strings"; | 494 LOG(ERROR) << "Lua: IncomingFindRequestFilter must return a table mapping names of DICOM tags to strings"; |
495 throw OrthancException(ErrorCode_LuaBadOutput); | 495 throw OrthancException(ErrorCode_LuaBadOutput); |
496 } | 496 } |
497 | 497 |
498 DicomTag tag(FromDcmtkBridge::ParseTag(members[i])); | 498 DicomTag tag(FromDcmtkBridge::ParseTag(members[i])); |
499 target.SetValue(tag, output[members[i]].asString()); | 499 target.SetValue(tag, output[members[i]].asString(), false); |
500 } | 500 } |
501 | 501 |
502 return true; | 502 return true; |
503 } | 503 } |
504 | 504 |
613 ValueRepresentation vr = FromDcmtkBridge::LookupValueRepresentation(tag); | 613 ValueRepresentation vr = FromDcmtkBridge::LookupValueRepresentation(tag); |
614 | 614 |
615 // DICOM specifies that searches must be case sensitive, except | 615 // DICOM specifies that searches must be case sensitive, except |
616 // for tags with a PN value representation | 616 // for tags with a PN value representation |
617 bool sensitive = true; | 617 bool sensitive = true; |
618 if (vr == ValueRepresentation_PatientName) | 618 if (vr == ValueRepresentation_PersonName) |
619 { | 619 { |
620 sensitive = caseSensitivePN; | 620 sensitive = caseSensitivePN; |
621 } | 621 } |
622 | 622 |
623 finder.AddDicomConstraint(tag, value, sensitive); | 623 finder.AddDicomConstraint(tag, value, sensitive); |