Mercurial > hg > orthanc
comparison OrthancServer/OrthancFindRequestHandler.cpp @ 4011:914b15dedae3
fix for non private sequence tags in C-Find
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 08 Jun 2020 16:04:29 +0200 |
parents | 884b55ce01f6 |
children | 320cde762fd9 |
comparison
equal
deleted
inserted
replaced
4007:884b55ce01f6 | 4011:914b15dedae3 |
---|---|
301 const DicomMap& mainDicomTags, | 301 const DicomMap& mainDicomTags, |
302 const Json::Value* dicomAsJson, | 302 const Json::Value* dicomAsJson, |
303 const DicomArray& query, | 303 const DicomArray& query, |
304 const std::list<DicomTag>& sequencesToReturn, | 304 const std::list<DicomTag>& sequencesToReturn, |
305 const DicomMap* counters, | 305 const DicomMap* counters, |
306 const std::string& privateCreator) | 306 const std::string& defaultPrivateCreator) |
307 { | 307 { |
308 DicomMap match; | 308 DicomMap match; |
309 | 309 |
310 if (dicomAsJson != NULL) | 310 if (dicomAsJson != NULL) |
311 { | 311 { |
371 answers.Add(result); | 371 answers.Add(result); |
372 } | 372 } |
373 else | 373 else |
374 { | 374 { |
375 ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), | 375 ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), |
376 true /* be permissive, cf. issue #136 */, privateCreator); | 376 true /* be permissive, cf. issue #136 */, defaultPrivateCreator); |
377 | 377 |
378 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin(); | 378 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin(); |
379 tag != sequencesToReturn.end(); ++tag) | 379 tag != sequencesToReturn.end(); ++tag) |
380 { | 380 { |
381 assert(dicomAsJson != NULL); | 381 assert(dicomAsJson != NULL); |
394 Json::Value item; | 394 Json::Value item; |
395 ServerToolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short); | 395 ServerToolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short); |
396 content.append(item); | 396 content.append(item); |
397 } | 397 } |
398 | 398 |
399 dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, privateCreator); | 399 if (tag->IsPrivate()) |
400 { | |
401 dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, defaultPrivateCreator); // TODO: instead of taking the default private creator, we should get the private createor of the current "group" | |
402 } | |
403 else | |
404 { | |
405 dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, "" /* no private creator */); | |
406 } | |
400 } | 407 } |
401 } | 408 } |
402 | 409 |
403 answers.Add(dicom); | 410 answers.Add(dicom); |
404 } | 411 } |
483 ServerContext& context_; | 490 ServerContext& context_; |
484 ResourceType level_; | 491 ResourceType level_; |
485 const DicomMap& query_; | 492 const DicomMap& query_; |
486 DicomArray queryAsArray_; | 493 DicomArray queryAsArray_; |
487 const std::list<DicomTag>& sequencesToReturn_; | 494 const std::list<DicomTag>& sequencesToReturn_; |
488 std::string privateCreator_; | 495 std::string defaultPrivateCreator_; |
489 | 496 |
490 public: | 497 public: |
491 LookupVisitor(DicomFindAnswers& answers, | 498 LookupVisitor(DicomFindAnswers& answers, |
492 ServerContext& context, | 499 ServerContext& context, |
493 ResourceType level, | 500 ResourceType level, |
502 { | 509 { |
503 answers_.SetComplete(false); | 510 answers_.SetComplete(false); |
504 | 511 |
505 { | 512 { |
506 OrthancConfiguration::ReaderLock lock; | 513 OrthancConfiguration::ReaderLock lock; |
507 privateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator(); | 514 defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator(); |
508 } | 515 } |
509 } | 516 } |
510 | 517 |
511 virtual bool IsDicomAsJsonNeeded() const | 518 virtual bool IsDicomAsJsonNeeded() const |
512 { | 519 { |
545 const Json::Value* dicomAsJson) | 552 const Json::Value* dicomAsJson) |
546 { | 553 { |
547 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_)); | 554 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_)); |
548 | 555 |
549 AddAnswer(answers_, mainDicomTags, dicomAsJson, | 556 AddAnswer(answers_, mainDicomTags, dicomAsJson, |
550 queryAsArray_, sequencesToReturn_, counters.get(), privateCreator_); | 557 queryAsArray_, sequencesToReturn_, counters.get(), defaultPrivateCreator_); |
551 } | 558 } |
552 }; | 559 }; |
553 | 560 |
554 | 561 |
555 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, | 562 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, |