comparison OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 1429:7366a0bdda6a

attempt of fix for Syngo.Via
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jun 2015 14:43:08 +0200
parents d710ea64f0fd
children f967bdf8534e
comparison
equal deleted inserted replaced
1428:0a355eeeb351 1429:7366a0bdda6a
417 } 417 }
418 } 418 }
419 } 419 }
420 420
421 421
422 static DcmDataset* ConvertQueryFields(const DicomMap& fields,
423 ModalityManufacturer manufacturer)
424 {
425 switch (manufacturer)
426 {
427 case ModalityManufacturer_SyngoVia:
428 {
429 std::auto_ptr<DicomMap> fix(fields.Clone());
430
431 // This issue for Syngo.Via and its solution was reported by
432 // Emsy Chan by private mail on June 17th, 2015.
433 std::set<DicomTag> tags;
434 fix->GetTags(tags);
435
436 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
437 {
438 if (FromDcmtkBridge::GetValueRepresentation(*it) == ValueRepresentation_Date)
439 {
440 // Replace a "*" query by an empty query ("") for "date"
441 // value representations. Necessary to search over dates
442 // in Syngo.Via.
443 const DicomValue* value = fix->TestAndGetValue(*it);
444
445 if (value != NULL &&
446 value->AsString() == "*")
447 {
448 fix->SetValue(*it, "");
449 }
450 }
451 }
452
453 return ToDcmtkBridge::Convert(*fix);
454 }
455
456 default:
457 return ToDcmtkBridge::Convert(fields);
458 }
459 }
460
461
422 void DicomUserConnection::Find(DicomFindAnswers& result, 462 void DicomUserConnection::Find(DicomFindAnswers& result,
423 ResourceType level, 463 ResourceType level,
424 const DicomMap& fields) 464 const DicomMap& fields)
425 { 465 {
426 CheckFindQuery(level, fields); 466 CheckFindQuery(level, fields);
428 CheckIsOpen(); 468 CheckIsOpen();
429 469
430 FindPayload payload; 470 FindPayload payload;
431 payload.answers = &result; 471 payload.answers = &result;
432 472
473 std::auto_ptr<DcmDataset> dataset(ConvertQueryFields(fields, manufacturer_));
474
433 const char* sopClass; 475 const char* sopClass;
434 std::auto_ptr<DcmDataset> dataset(ToDcmtkBridge::Convert(fields));
435 switch (level) 476 switch (level)
436 { 477 {
437 case ResourceType_Patient: 478 case ResourceType_Patient:
438 payload.level = "PATIENT"; 479 payload.level = "PATIENT";
439 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "PATIENT"); 480 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "PATIENT");
543 ResourceType level, 584 ResourceType level,
544 const DicomMap& fields) 585 const DicomMap& fields)
545 { 586 {
546 CheckIsOpen(); 587 CheckIsOpen();
547 588
589 std::auto_ptr<DcmDataset> dataset(ConvertQueryFields(fields, manufacturer_));
590
548 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; 591 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel;
549 std::auto_ptr<DcmDataset> dataset(ToDcmtkBridge::Convert(fields));
550
551 switch (level) 592 switch (level)
552 { 593 {
553 case ResourceType_Patient: 594 case ResourceType_Patient:
554 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "PATIENT"); 595 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "PATIENT");
555 break; 596 break;