comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5596:81a29ad7fb4b find-refactoring

added possibility to retrieve main DICOM tags and metadata at any level
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 May 2024 18:44:53 +0200
parents a87f2a56257d
children 3f24eb4013d8
comparison
equal deleted inserted replaced
5595:a87f2a56257d 5596:81a29ad7fb4b
3926 if (request.GetLevel() != resource.GetLevel()) 3926 if (request.GetLevel() != resource.GetLevel())
3927 { 3927 {
3928 throw OrthancException(ErrorCode_InternalError); 3928 throw OrthancException(ErrorCode_InternalError);
3929 } 3929 }
3930 3930
3931 if (request.IsRetrieveMainDicomTags()) 3931 if (request.IsRetrieveMainDicomTags(request.GetLevel()))
3932 { 3932 {
3933 resource.GetMainDicomTags(tags_); 3933 resource.GetMainDicomTags(tags_, request.GetLevel());
3934 } 3934 }
3935 3935
3936 if (request.IsRetrieveChildrenIdentifiers()) 3936 if (request.IsRetrieveChildrenIdentifiers())
3937 { 3937 {
3938 const std::set<std::string>& s = resource.GetChildrenIdentifiers(GetChildResourceType(request.GetLevel())); 3938 const std::set<std::string>& children = resource.GetChildrenIdentifiers();
3939 for (std::set<std::string>::const_iterator it = s.begin(); it != s.end(); ++it) 3939 for (std::set<std::string>::const_iterator it = children.begin(); it != children.end(); ++it)
3940 { 3940 {
3941 childrenIds_.push_back(*it); 3941 childrenIds_.push_back(*it);
3942 } 3942 }
3943 } 3943 }
3944 3944
3945 if (request.IsRetrieveParentIdentifier()) 3945 if (request.IsRetrieveParentIdentifier())
3946 { 3946 {
3947 parentId_ = resource.GetParentIdentifier(); 3947 parentId_ = resource.GetParentIdentifier();
3948 } 3948 }
3949 3949
3950 if (request.IsRetrieveMetadata()) 3950 if (request.IsRetrieveMetadata(request.GetLevel()))
3951 { 3951 {
3952 metadata_ = resource.GetMetadata(); 3952 metadata_ = resource.GetMetadata(request.GetLevel());
3953 std::string value; 3953 std::string value;
3954 if (resource.LookupMetadata(value, MetadataType_MainDicomTagsSignature)) 3954 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_MainDicomTagsSignature))
3955 { 3955 {
3956 mainDicomTagsSignature_ = value; 3956 mainDicomTagsSignature_ = value;
3957 } 3957 }
3958 if (resource.LookupMetadata(value, MetadataType_AnonymizedFrom)) 3958 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_AnonymizedFrom))
3959 { 3959 {
3960 anonymizedFrom_ = value; 3960 anonymizedFrom_ = value;
3961 } 3961 }
3962 if (resource.LookupMetadata(value, MetadataType_ModifiedFrom)) 3962 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_ModifiedFrom))
3963 { 3963 {
3964 modifiedFrom_ = value; 3964 modifiedFrom_ = value;
3965 } 3965 }
3966 if (resource.LookupMetadata(value, MetadataType_LastUpdate)) 3966 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_LastUpdate))
3967 { 3967 {
3968 lastUpdate_ = value; 3968 lastUpdate_ = value;
3969 } 3969 }
3970 if (request.GetLevel() == ResourceType_Series) 3970 if (request.GetLevel() == ResourceType_Series)
3971 { 3971 {
3972 if (resource.LookupMetadata(value, MetadataType_Series_ExpectedNumberOfInstances)) 3972 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_Series_ExpectedNumberOfInstances))
3973 { 3973 {
3974 expectedNumberOfInstances_ = boost::lexical_cast<int>(value); 3974 expectedNumberOfInstances_ = boost::lexical_cast<int>(value);
3975 } 3975 }
3976 } 3976 }
3977 if (request.GetLevel() == ResourceType_Instance) 3977 if (request.GetLevel() == ResourceType_Instance)
3978 { 3978 {
3979 if (resource.LookupMetadata(value, MetadataType_Instance_IndexInSeries)) 3979 if (resource.LookupMetadata(value, request.GetLevel(), MetadataType_Instance_IndexInSeries))
3980 { 3980 {
3981 indexInSeries_ = boost::lexical_cast<int>(value); 3981 indexInSeries_ = boost::lexical_cast<int>(value);
3982 } 3982 }
3983 } 3983 }
3984 } 3984 }