comparison OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 1707:9a04ad916831

more tolerant c-find scp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Oct 2015 16:54:21 +0200
parents 7dae55228b16
children ec66a16aa398
comparison
equal deleted inserted replaced
1706:e8a7512a1e40 1707:9a04ad916831
382 payload.answers->Add(m); 382 payload.answers->Add(m);
383 } 383 }
384 } 384 }
385 385
386 386
387 static void CheckFindQuery(ResourceType level, 387 static void FixFindQuery(DicomMap& fixedQuery,
388 const DicomMap& fields) 388 ResourceType level,
389 const DicomMap& fields)
389 { 390 {
390 std::set<DicomTag> allowedTags; 391 std::set<DicomTag> allowedTags;
391 392
392 // WARNING: Do not add "break" or reorder items in this switch-case! 393 // WARNING: Do not add "break" or reorder items in this switch-case!
393 switch (level) 394 switch (level)
420 for (size_t i = 0; i < query.GetSize(); i++) 421 for (size_t i = 0; i < query.GetSize(); i++)
421 { 422 {
422 const DicomTag& tag = query.GetElement(i).GetTag(); 423 const DicomTag& tag = query.GetElement(i).GetTag();
423 if (allowedTags.find(tag) == allowedTags.end()) 424 if (allowedTags.find(tag) == allowedTags.end())
424 { 425 {
425 LOG(ERROR) << "Tag not allowed for this C-Find level: " << tag; 426 LOG(WARNING) << "Tag not allowed for this C-Find level, will be ignored: " << tag;
426 throw OrthancException(ErrorCode_BadRequest); 427 }
428 else
429 {
430 fixedQuery.SetValue(tag, query.GetElement(i).GetValue());
427 } 431 }
428 } 432 }
429 } 433 }
430 434
431 435
469 } 473 }
470 474
471 475
472 void DicomUserConnection::Find(DicomFindAnswers& result, 476 void DicomUserConnection::Find(DicomFindAnswers& result,
473 ResourceType level, 477 ResourceType level,
474 const DicomMap& fields) 478 const DicomMap& originalFields)
475 { 479 {
476 CheckFindQuery(level, fields); 480 DicomMap fields;
481 FixFindQuery(fields, level, originalFields);
477 482
478 CheckIsOpen(); 483 CheckIsOpen();
479 484
480 FindPayload payload; 485 FindPayload payload;
481 payload.answers = &result; 486 payload.answers = &result;