Mercurial > hg > orthanc
comparison OrthancServer/Search/LookupResource.cpp @ 1758:318c2e83c2bd db-changes
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Oct 2015 12:53:45 +0100 |
parents | 03b030680e3d |
children | 91a5d39ec665 |
comparison
equal
deleted
inserted
replaced
1757:98abb8d7f905 | 1758:318c2e83c2bd |
---|---|
228 it->second->Setup(query, it->first); | 228 it->second->Setup(query, it->first); |
229 } | 229 } |
230 | 230 |
231 query.Apply(candidates, database); | 231 query.Apply(candidates, database); |
232 | 232 |
233 /*{ | |
234 query.Print(std::cout); | |
235 std::list<int64_t> source; | |
236 candidates.Flatten(source); | |
237 printf("=> %d\n", source.size()); | |
238 }*/ | |
239 | |
233 // Secondly, filter using the main DICOM tags | 240 // Secondly, filter using the main DICOM tags |
234 if (!identifiersConstraints_.empty() || | 241 if (!identifiersConstraints_.empty() || |
235 !mainTagsConstraints_.empty()) | 242 !mainTagsConstraints_.empty()) |
236 { | 243 { |
237 std::list<int64_t> source; | 244 std::list<int64_t> source; |
415 } | 422 } |
416 | 423 |
417 | 424 |
418 void LookupResource::AddDicomConstraint(const DicomTag& tag, | 425 void LookupResource::AddDicomConstraint(const DicomTag& tag, |
419 const std::string& dicomQuery, | 426 const std::string& dicomQuery, |
420 bool caseSensitivePN) | 427 bool caseSensitive) |
421 { | 428 { |
422 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag); | 429 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag); |
423 | |
424 bool sensitive = true; | |
425 if (vr == ValueRepresentation_PatientName) | |
426 { | |
427 sensitive = caseSensitivePN; | |
428 } | |
429 | 430 |
430 // http://www.itk.org/Wiki/DICOM_QueryRetrieve_Explained | 431 // http://www.itk.org/Wiki/DICOM_QueryRetrieve_Explained |
431 // http://dicomiseasy.blogspot.be/2012/01/dicom-queryretrieve-part-i.html | 432 // http://dicomiseasy.blogspot.be/2012/01/dicom-queryretrieve-part-i.html |
432 | |
433 if (tag == DICOM_TAG_MODALITIES_IN_STUDY) | 433 if (tag == DICOM_TAG_MODALITIES_IN_STUDY) |
434 { | 434 { |
435 SetModalitiesInStudy(dicomQuery); | 435 SetModalitiesInStudy(dicomQuery); |
436 } | 436 } |
437 else if ((vr == ValueRepresentation_Date || | 437 else if ((vr == ValueRepresentation_Date || |
448 * C.2.2.2.5 ("Range Matching"). | 448 * C.2.2.2.5 ("Range Matching"). |
449 **/ | 449 **/ |
450 size_t separator = dicomQuery.find('-'); | 450 size_t separator = dicomQuery.find('-'); |
451 std::string lower = dicomQuery.substr(0, separator); | 451 std::string lower = dicomQuery.substr(0, separator); |
452 std::string upper = dicomQuery.substr(separator + 1); | 452 std::string upper = dicomQuery.substr(separator + 1); |
453 Add(tag, new RangeConstraint(lower, upper, sensitive)); | 453 Add(tag, new RangeConstraint(lower, upper, caseSensitive)); |
454 } | 454 } |
455 else if (dicomQuery.find('\\') != std::string::npos) | 455 else if (dicomQuery.find('\\') != std::string::npos) |
456 { | 456 { |
457 std::auto_ptr<ListConstraint> constraint(new ListConstraint(sensitive)); | 457 std::auto_ptr<ListConstraint> constraint(new ListConstraint(caseSensitive)); |
458 | 458 |
459 std::vector<std::string> items; | 459 std::vector<std::string> items; |
460 Toolbox::TokenizeString(items, dicomQuery, '\\'); | 460 Toolbox::TokenizeString(items, dicomQuery, '\\'); |
461 | 461 |
462 for (size_t i = 0; i < items.size(); i++) | 462 for (size_t i = 0; i < items.size(); i++) |
467 Add(tag, constraint.release()); | 467 Add(tag, constraint.release()); |
468 } | 468 } |
469 else if (dicomQuery.find('*') != std::string::npos || | 469 else if (dicomQuery.find('*') != std::string::npos || |
470 dicomQuery.find('?') != std::string::npos) | 470 dicomQuery.find('?') != std::string::npos) |
471 { | 471 { |
472 Add(tag, new WildcardConstraint(dicomQuery, sensitive)); | 472 Add(tag, new WildcardConstraint(dicomQuery, caseSensitive)); |
473 } | 473 } |
474 else | 474 else |
475 { | 475 { |
476 /** | 476 /** |
477 * Case-insensitive match for PN value representation (Patient | 477 * Case-insensitive match for PN value representation (Patient |
502 * (0010,0020) LO PatientID => Case-sensitive | 502 * (0010,0020) LO PatientID => Case-sensitive |
503 * (0020,000D) UI StudyInstanceUID => Case-sensitive | 503 * (0020,000D) UI StudyInstanceUID => Case-sensitive |
504 * (0020,000E) UI SeriesInstanceUID => Case-sensitive | 504 * (0020,000E) UI SeriesInstanceUID => Case-sensitive |
505 **/ | 505 **/ |
506 | 506 |
507 Add(tag, new ValueConstraint(dicomQuery, sensitive)); | 507 Add(tag, new ValueConstraint(dicomQuery, caseSensitive)); |
508 } | 508 } |
509 } | 509 } |
510 } | 510 } |