comparison OrthancServer/ServerContext.cpp @ 2124:2b1520efa282

cleaning up
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Nov 2016 12:11:34 +0100
parents 2ecc95a239f7
children bfa92c9328d7
comparison
equal deleted inserted replaced
2123:1cf093cbdad8 2124:2b1520efa282
366 throw; 366 throw;
367 } 367 }
368 } 368 }
369 369
370 370
371 void ServerContext::ReadJson(Json::Value& result, 371 void ServerContext::ReadDicomAsJson(Json::Value& result,
372 const std::string& instancePublicId) 372 const std::string& instancePublicId)
373 { 373 {
374 std::string s; 374 std::string s;
375 ReadFile(s, instancePublicId, FileContentType_DicomAsJson); 375 ReadFile(s, instancePublicId, FileContentType_DicomAsJson, true /* decompress if needed */);
376 376
377 Json::Reader reader; 377 Json::Reader reader;
378 if (!reader.parse(s, result)) 378 if (!reader.parse(s, result))
379 { 379 {
380 throw OrthancException(ErrorCode_CorruptedFile); 380 throw OrthancException(ErrorCode_CorruptedFile);
416 416
417 417
418 IDynamicObject* ServerContext::DicomCacheProvider::Provide(const std::string& instancePublicId) 418 IDynamicObject* ServerContext::DicomCacheProvider::Provide(const std::string& instancePublicId)
419 { 419 {
420 std::string content; 420 std::string content;
421 context_.ReadFile(content, instancePublicId, FileContentType_Dicom); 421 context_.ReadDicom(content, instancePublicId);
422 return new ParsedDicomFile(content); 422 return new ParsedDicomFile(content);
423 } 423 }
424 424
425 425
426 ServerContext::DicomCacheLocker::DicomCacheLocker(ServerContext& that, 426 ServerContext::DicomCacheLocker::DicomCacheLocker(ServerContext& that,
565 assert(resources.size() == instances.size()); 565 assert(resources.size() == instances.size());
566 566
567 for (size_t i = 0; i < instances.size(); i++) 567 for (size_t i = 0; i < instances.size(); i++)
568 { 568 {
569 Json::Value dicom; 569 Json::Value dicom;
570 ReadJson(dicom, instances[i]); 570 ReadDicomAsJson(dicom, instances[i]);
571 571
572 if (lookup.IsMatch(dicom)) 572 if (lookup.IsMatch(dicom))
573 { 573 {
574 if (maxResults != 0 && 574 if (maxResults != 0 &&
575 result.size() >= maxResults) 575 result.size() >= maxResults)