Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 1822:9ed9458aa44f
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Nov 2015 10:06:50 +0100 |
parents | 613df4362575 |
children | 0ef4e6e66b56 |
comparison
equal
deleted
inserted
replaced
1821:580951a33583 | 1822:9ed9458aa44f |
---|---|
48 #include "Search/LookupIdentifierQuery.h" | 48 #include "Search/LookupIdentifierQuery.h" |
49 #include "Search/LookupResource.h" | 49 #include "Search/LookupResource.h" |
50 | 50 |
51 #include "FromDcmtkBridge.h" | 51 #include "FromDcmtkBridge.h" |
52 #include "ServerContext.h" | 52 #include "ServerContext.h" |
53 #include "DicomInstanceToStore.h" | |
53 | 54 |
54 #include <boost/lexical_cast.hpp> | 55 #include <boost/lexical_cast.hpp> |
55 #include <stdio.h> | 56 #include <stdio.h> |
56 | 57 |
57 static const uint64_t MEGA_BYTES = 1024 * 1024; | 58 static const uint64_t MEGA_BYTES = 1024 * 1024; |
591 } | 592 } |
592 | 593 |
593 | 594 |
594 | 595 |
595 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, | 596 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, |
596 const DicomMap& dicomSummary, | 597 DicomInstanceToStore& instanceToStore, |
597 const Attachments& attachments, | 598 const Attachments& attachments) |
598 const std::string& remoteAet, | 599 { |
599 const MetadataMap& metadata) | 600 boost::mutex::scoped_lock lock(mutex_); |
600 { | 601 |
601 boost::mutex::scoped_lock lock(mutex_); | 602 const DicomMap& dicomSummary = instanceToStore.GetSummary(); |
603 const ServerIndex::MetadataMap& metadata = instanceToStore.GetMetadata(); | |
602 | 604 |
603 instanceMetadata.clear(); | 605 instanceMetadata.clear(); |
604 | 606 |
605 DicomInstanceHasher hasher(dicomSummary); | 607 DicomInstanceHasher hasher(instanceToStore.GetSummary()); |
606 | 608 |
607 try | 609 try |
608 { | 610 { |
609 Transaction t(*this); | 611 Transaction t(*this); |
610 | 612 |
764 // Attach the auto-computed metadata for the instance level, | 766 // Attach the auto-computed metadata for the instance level, |
765 // reflecting these additions into the input metadata map | 767 // reflecting these additions into the input metadata map |
766 db_.SetMetadata(instance, MetadataType_Instance_ReceptionDate, now); | 768 db_.SetMetadata(instance, MetadataType_Instance_ReceptionDate, now); |
767 instanceMetadata[MetadataType_Instance_ReceptionDate] = now; | 769 instanceMetadata[MetadataType_Instance_ReceptionDate] = now; |
768 | 770 |
769 db_.SetMetadata(instance, MetadataType_Instance_RemoteAet, remoteAet); | 771 db_.SetMetadata(instance, MetadataType_Instance_RemoteAet, instanceToStore.GetRemoteAet()); |
770 instanceMetadata[MetadataType_Instance_RemoteAet] = remoteAet; | 772 instanceMetadata[MetadataType_Instance_RemoteAet] = instanceToStore.GetRemoteAet(); |
771 | 773 |
772 const DicomValue* value; | 774 const DicomValue* value; |
773 if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_INSTANCE_NUMBER)) != NULL || | 775 if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_INSTANCE_NUMBER)) != NULL || |
774 (value = dicomSummary.TestAndGetValue(DICOM_TAG_IMAGE_INDEX)) != NULL) | 776 (value = dicomSummary.TestAndGetValue(DICOM_TAG_IMAGE_INDEX)) != NULL) |
775 { | 777 { |