Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/FindRequest.cpp @ 5609:4690a0d2b01e find-refactoring
preliminary support of requestedTags
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 May 2024 18:28:36 +0200 |
parents | 81a29ad7fb4b |
children | d4b570834d3a |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/FindRequest.cpp Wed May 08 13:37:23 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.cpp Wed May 08 18:28:36 2024 +0200 @@ -45,7 +45,8 @@ retrieveLabels_(false), retrieveAttachments_(false), retrieveParentIdentifier_(false), - retrieveChildrenIdentifiers_(false) + retrieveChildrenIdentifiers_(false), + retrieveOneInstanceIdentifier_(false) { } @@ -60,6 +61,82 @@ } } + + void FindRequest::SetOrthancId(ResourceType level, + const std::string& id) + { + switch (level) + { + case ResourceType_Patient: + SetOrthancPatientId(id); + break; + + case ResourceType_Study: + SetOrthancStudyId(id); + break; + + case ResourceType_Series: + SetOrthancSeriesId(id); + break; + + case ResourceType_Instance: + SetOrthancInstanceId(id); + break; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + + void FindRequest::SetOrthancPatientId(const std::string& id) + { + orthancIdentifiers_.SetPatientId(id); + } + + + void FindRequest::SetOrthancStudyId(const std::string& id) + { + if (level_ == ResourceType_Patient) + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + else + { + orthancIdentifiers_.SetStudyId(id); + } + } + + + void FindRequest::SetOrthancSeriesId(const std::string& id) + { + if (level_ == ResourceType_Patient || + level_ == ResourceType_Study) + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + else + { + orthancIdentifiers_.SetSeriesId(id); + } + } + + + void FindRequest::SetOrthancInstanceId(const std::string& id) + { + if (level_ == ResourceType_Patient || + level_ == ResourceType_Study || + level_ == ResourceType_Series) + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + else + { + orthancIdentifiers_.SetInstanceId(id); + } + } + + void FindRequest::AddDicomTagConstraint(const DicomTagConstraint& constraint) { dicomTagConstraints_.push_back(constraint); @@ -289,17 +366,4 @@ retrieveChildrenMetadata_.insert(metadata); } } - - - void FindRequest::AddRetrieveAttachmentOfOneInstance(FileContentType type) - { - if (retrieveAttachmentOfOneInstance_.find(type) == retrieveAttachmentOfOneInstance_.end()) - { - retrieveAttachmentOfOneInstance_.insert(type); - } - else - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - } }