Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 2120:4b02ec79728a
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Nov 2016 11:19:19 +0100 |
parents | 1824a02e0951 |
children | 2ecc95a239f7 |
comparison
equal
deleted
inserted
replaced
2119:e0517f25919e | 2120:4b02ec79728a |
---|---|
632 | 632 |
633 Recycle(instanceSize, hasher.HashPatient()); | 633 Recycle(instanceSize, hasher.HashPatient()); |
634 | 634 |
635 // Create the instance | 635 // Create the instance |
636 int64_t instance = CreateResource(hasher.HashInstance(), ResourceType_Instance); | 636 int64_t instance = CreateResource(hasher.HashInstance(), ResourceType_Instance); |
637 Toolbox::SetMainDicomTags(db_, instance, ResourceType_Instance, dicomSummary); | 637 ServerToolbox::StoreMainDicomTags(db_, instance, ResourceType_Instance, dicomSummary); |
638 | 638 |
639 // Detect up to which level the patient/study/series/instance | 639 // Detect up to which level the patient/study/series/instance |
640 // hierarchy must be created | 640 // hierarchy must be created |
641 int64_t patient = -1, study = -1, series = -1; | 641 int64_t patient = -1, study = -1, series = -1; |
642 bool isNewPatient = false; | 642 bool isNewPatient = false; |
684 | 684 |
685 // Create the series if needed | 685 // Create the series if needed |
686 if (isNewSeries) | 686 if (isNewSeries) |
687 { | 687 { |
688 series = CreateResource(hasher.HashSeries(), ResourceType_Series); | 688 series = CreateResource(hasher.HashSeries(), ResourceType_Series); |
689 Toolbox::SetMainDicomTags(db_, series, ResourceType_Series, dicomSummary); | 689 ServerToolbox::StoreMainDicomTags(db_, series, ResourceType_Series, dicomSummary); |
690 } | 690 } |
691 | 691 |
692 // Create the study if needed | 692 // Create the study if needed |
693 if (isNewStudy) | 693 if (isNewStudy) |
694 { | 694 { |
695 study = CreateResource(hasher.HashStudy(), ResourceType_Study); | 695 study = CreateResource(hasher.HashStudy(), ResourceType_Study); |
696 Toolbox::SetMainDicomTags(db_, study, ResourceType_Study, dicomSummary); | 696 ServerToolbox::StoreMainDicomTags(db_, study, ResourceType_Study, dicomSummary); |
697 } | 697 } |
698 | 698 |
699 // Create the patient if needed | 699 // Create the patient if needed |
700 if (isNewPatient) | 700 if (isNewPatient) |
701 { | 701 { |
702 patient = CreateResource(hasher.HashPatient(), ResourceType_Patient); | 702 patient = CreateResource(hasher.HashPatient(), ResourceType_Patient); |
703 Toolbox::SetMainDicomTags(db_, patient, ResourceType_Patient, dicomSummary); | 703 ServerToolbox::StoreMainDicomTags(db_, patient, ResourceType_Patient, dicomSummary); |
704 } | 704 } |
705 | 705 |
706 // Create the parent-to-child links | 706 // Create the parent-to-child links |
707 db_.AttachChild(series, instance); | 707 db_.AttachChild(series, instance); |
708 | 708 |
2178 it = tmp.begin(); it != tmp.end(); ++it, pos++) | 2178 it = tmp.begin(); it != tmp.end(); ++it, pos++) |
2179 { | 2179 { |
2180 assert(db_.GetResourceType(*it) == lookup.GetLevel()); | 2180 assert(db_.GetResourceType(*it) == lookup.GetLevel()); |
2181 | 2181 |
2182 int64_t instance; | 2182 int64_t instance; |
2183 if (!Toolbox::FindOneChildInstance(instance, db_, *it, lookup.GetLevel())) | 2183 if (!ServerToolbox::FindOneChildInstance(instance, db_, *it, lookup.GetLevel())) |
2184 { | 2184 { |
2185 throw OrthancException(ErrorCode_InternalError); | 2185 throw OrthancException(ErrorCode_InternalError); |
2186 } | 2186 } |
2187 | 2187 |
2188 resources[pos] = db_.GetPublicId(*it); | 2188 resources[pos] = db_.GetPublicId(*it); |