Mercurial > hg > orthanc
comparison OrthancServer/OrthancFindRequestHandler.cpp @ 4007:884b55ce01f6
Private tags returned by C-FIND SCP
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 06 Jun 2020 14:50:21 +0200 |
parents | 2a170a8f1faf |
children | 914b15dedae3 |
comparison
equal
deleted
inserted
replaced
4006:55710d73780f | 4007:884b55ce01f6 |
---|---|
300 static void AddAnswer(DicomFindAnswers& answers, | 300 static void AddAnswer(DicomFindAnswers& answers, |
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 { | 307 { |
307 DicomMap match; | 308 DicomMap match; |
308 | 309 |
309 if (dicomAsJson != NULL) | 310 if (dicomAsJson != NULL) |
310 { | 311 { |
369 LOG(WARNING) << "C-FIND query requesting a sequence, but reading JSON from disk is disabled"; | 370 LOG(WARNING) << "C-FIND query requesting a sequence, but reading JSON from disk is disabled"; |
370 answers.Add(result); | 371 answers.Add(result); |
371 } | 372 } |
372 else | 373 else |
373 { | 374 { |
374 ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), true /* be permissive, cf. issue #136 */); | 375 ParsedDicomFile dicom(result, GetDefaultDicomEncoding(), |
376 true /* be permissive, cf. issue #136 */, privateCreator); | |
375 | 377 |
376 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin(); | 378 for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin(); |
377 tag != sequencesToReturn.end(); ++tag) | 379 tag != sequencesToReturn.end(); ++tag) |
378 { | 380 { |
379 assert(dicomAsJson != NULL); | 381 assert(dicomAsJson != NULL); |
392 Json::Value item; | 394 Json::Value item; |
393 ServerToolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short); | 395 ServerToolbox::SimplifyTags(item, source["Value"][i], DicomToJsonFormat_Short); |
394 content.append(item); | 396 content.append(item); |
395 } | 397 } |
396 | 398 |
397 dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, | 399 dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, privateCreator); |
398 "" /* no private creator */); | |
399 } | 400 } |
400 } | 401 } |
401 | 402 |
402 answers.Add(dicom); | 403 answers.Add(dicom); |
403 } | 404 } |
482 ServerContext& context_; | 483 ServerContext& context_; |
483 ResourceType level_; | 484 ResourceType level_; |
484 const DicomMap& query_; | 485 const DicomMap& query_; |
485 DicomArray queryAsArray_; | 486 DicomArray queryAsArray_; |
486 const std::list<DicomTag>& sequencesToReturn_; | 487 const std::list<DicomTag>& sequencesToReturn_; |
488 std::string privateCreator_; | |
487 | 489 |
488 public: | 490 public: |
489 LookupVisitor(DicomFindAnswers& answers, | 491 LookupVisitor(DicomFindAnswers& answers, |
490 ServerContext& context, | 492 ServerContext& context, |
491 ResourceType level, | 493 ResourceType level, |
497 query_(query), | 499 query_(query), |
498 queryAsArray_(query), | 500 queryAsArray_(query), |
499 sequencesToReturn_(sequencesToReturn) | 501 sequencesToReturn_(sequencesToReturn) |
500 { | 502 { |
501 answers_.SetComplete(false); | 503 answers_.SetComplete(false); |
504 | |
505 { | |
506 OrthancConfiguration::ReaderLock lock; | |
507 privateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator(); | |
508 } | |
502 } | 509 } |
503 | 510 |
504 virtual bool IsDicomAsJsonNeeded() const | 511 virtual bool IsDicomAsJsonNeeded() const |
505 { | 512 { |
506 // Ask the "DICOM-as-JSON" attachment only if sequences are to | 513 // Ask the "DICOM-as-JSON" attachment only if sequences are to |
538 const Json::Value* dicomAsJson) | 545 const Json::Value* dicomAsJson) |
539 { | 546 { |
540 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_)); | 547 std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_)); |
541 | 548 |
542 AddAnswer(answers_, mainDicomTags, dicomAsJson, | 549 AddAnswer(answers_, mainDicomTags, dicomAsJson, |
543 queryAsArray_, sequencesToReturn_, counters.get()); | 550 queryAsArray_, sequencesToReturn_, counters.get(), privateCreator_); |
544 } | 551 } |
545 }; | 552 }; |
546 | 553 |
547 | 554 |
548 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, | 555 void OrthancFindRequestHandler::Handle(DicomFindAnswers& answers, |