Mercurial > hg > orthanc
changeset 5912:641dad7eace2 get-scu-test
C-GET: use SOPClassesInStudy for negotiation
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 09 Dec 2024 16:48:46 +0100 |
parents | bfae0fc2ea1b |
children | f7fcf8b102d3 |
files | OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp OrthancServer/Sources/ServerJobs/DicomGetScuJob.h OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h |
diffstat | 3 files changed, 17 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp Mon Dec 09 10:07:19 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp Mon Dec 09 16:48:46 2024 +0100 @@ -68,17 +68,15 @@ if (connection_.get() == NULL) { std::set<std::string> sopClassesToPropose; - std::set<std::string> sopClassesInStudy; std::set<std::string> acceptedSopClasses; std::list<DicomTransferSyntax> proposedTransferSyntaxes; - if (findAnswer.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY) && - findAnswer.LookupStringValues(sopClassesInStudy, DICOM_TAG_SOP_CLASSES_IN_STUDY, false)) + if (sopClassesFromResourcesToRetrieve_.size() > 0) { context_.GetAcceptedSopClasses(acceptedSopClasses, 0); // keep the sop classes from the resources to retrieve only if they are accepted by Orthanc - Toolbox::GetIntersection(sopClassesToPropose, sopClassesInStudy, acceptedSopClasses); + Toolbox::GetIntersection(sopClassesToPropose, sopClassesFromResourcesToRetrieve_, acceptedSopClasses); } else { @@ -104,39 +102,20 @@ connection_->Get(findAnswer, InstanceReceivedHandler, &context_); } - void DicomGetScuJob::AddResourceToRetrieve(ResourceType level, const std::string& dicomId) + void DicomGetScuJob::AddFindAnswer(const DicomMap& answer) { - // TODO-GET: when retrieving a single series, one must provide the StudyInstanceUID too - DicomMap item; - - switch (level) - { - case ResourceType_Patient: - item.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, ResourceTypeToDicomQueryRetrieveLevel(level), false); - item.SetValue(DICOM_TAG_PATIENT_ID, dicomId, false); - break; - - case ResourceType_Study: - item.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, ResourceTypeToDicomQueryRetrieveLevel(level), false); - item.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, dicomId, false); - break; + DicomRetrieveScuBaseJob::AddFindAnswer(answer); - case ResourceType_Series: - item.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, ResourceTypeToDicomQueryRetrieveLevel(level), false); - item.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, dicomId, false); - break; - - case ResourceType_Instance: - item.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, ResourceTypeToDicomQueryRetrieveLevel(level), false); - item.SetValue(DICOM_TAG_SOP_INSTANCE_UID, dicomId, false); - break; - - default: - throw OrthancException(ErrorCode_InternalError); + std::set<std::string> sopClassesInStudy; + if (answer.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY) + && answer.LookupStringValues(sopClassesInStudy, DICOM_TAG_SOP_CLASSES_IN_STUDY, false)) + { + for (std::set<std::string>::const_iterator it = sopClassesInStudy.begin(); it != sopClassesInStudy.end(); ++it) + { + sopClassesFromResourcesToRetrieve_.insert(*it); + } } - query_.Add(item); - - AddCommand(new Command(*this, item)); } + }
--- a/OrthancServer/Sources/ServerJobs/DicomGetScuJob.h Mon Dec 09 10:07:19 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomGetScuJob.h Mon Dec 09 16:48:46 2024 +0100 @@ -35,7 +35,8 @@ class DicomGetScuJob : public DicomRetrieveScuBaseJob { private: - + std::set<std::string> sopClassesFromResourcesToRetrieve_; + virtual void Retrieve(const DicomMap& findAnswer) ORTHANC_OVERRIDE; public: @@ -48,7 +49,7 @@ const Json::Value& serialized); - void AddResourceToRetrieve(ResourceType level, const std::string& dicomId); + virtual void AddFindAnswer(const DicomMap &answer) ORTHANC_OVERRIDE; virtual void GetJobType(std::string& target) const ORTHANC_OVERRIDE
--- a/OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h Mon Dec 09 10:07:19 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h Mon Dec 09 16:48:46 2024 +0100 @@ -107,7 +107,7 @@ const Json::Value &serialized); public: - void AddFindAnswer(const DicomMap &answer); + virtual void AddFindAnswer(const DicomMap &answer); void AddQuery(const DicomMap& query);