# HG changeset patch # User Alain Mazy # Date 1733769662 -3600 # Node ID 305d318f488d53ce04fba8dd949a6b233ddfbd1d # Parent 866defb5f95ad99b993423bf3a2c6a420bc2c7fb cleanup get-scu (re-integrate commits from the get-scu-test branch) diff -r 866defb5f95a -r 305d318f488d OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp --- a/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp Mon Dec 09 10:04:34 2024 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp Mon Dec 09 19:41:02 2024 +0100 @@ -538,10 +538,12 @@ sopClass = UID_GETPatientRootQueryRetrieveInformationModel; break; case ResourceType_Study: + case ResourceType_Series: + case ResourceType_Instance: sopClass = UID_GETStudyRootQueryRetrieveInformationModel; break; default: - throw OrthancException(ErrorCode_InternalError); // TODO-GET: implement series + instances + throw OrthancException(ErrorCode_InternalError); } // Figure out which of the accepted presentation contexts should be used @@ -660,8 +662,8 @@ if (result.bad()) { + LOG(WARNING) << "C-GET SCU handler: Failed to receive dataset: " << result.text(); desiredCStoreReturnStatus = STATUS_STORE_Error_CannotUnderstand; - // TODO-GET: return ? } else { diff -r 866defb5f95a -r 305d318f488d OrthancServer/Resources/Configuration.json --- a/OrthancServer/Resources/Configuration.json Mon Dec 09 10:04:34 2024 +0100 +++ b/OrthancServer/Resources/Configuration.json Mon Dec 09 19:41:02 2024 +0100 @@ -220,7 +220,7 @@ // The list of rejected Storage SOP classes. // This configuration is only meaningful if // "AcceptedSopClasses" is using regular expressions - // or if it not defined. + // or if it is not defined. // Each entry can contain wildcards ("?" or "*"). // (new in Orthanc 1.12.6) // "RejectedSopClasses" : [ diff -r 866defb5f95a -r 305d318f488d OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp --- a/OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp Mon Dec 09 10:04:34 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomGetScuJob.cpp Mon Dec 09 19:41:02 2024 +0100 @@ -68,17 +68,15 @@ if (connection_.get() == NULL) { std::set sopClassesToPropose; - std::set sopClassesInStudy; std::set acceptedSopClasses; std::list 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 sopClassesInStudy; + if (answer.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY) + && answer.LookupStringValues(sopClassesInStudy, DICOM_TAG_SOP_CLASSES_IN_STUDY, false)) + { + for (std::set::const_iterator it = sopClassesInStudy.begin(); it != sopClassesInStudy.end(); ++it) + { + sopClassesFromResourcesToRetrieve_.insert(*it); + } } - query_.Add(item); - - AddCommand(new Command(*this, item)); } + } diff -r 866defb5f95a -r 305d318f488d OrthancServer/Sources/ServerJobs/DicomGetScuJob.h --- a/OrthancServer/Sources/ServerJobs/DicomGetScuJob.h Mon Dec 09 10:04:34 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomGetScuJob.h Mon Dec 09 19:41:02 2024 +0100 @@ -35,7 +35,8 @@ class DicomGetScuJob : public DicomRetrieveScuBaseJob { private: - + std::set 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 diff -r 866defb5f95a -r 305d318f488d OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h --- a/OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h Mon Dec 09 10:04:34 2024 +0100 +++ b/OrthancServer/Sources/ServerJobs/DicomRetrieveScuBaseJob.h Mon Dec 09 19:41:02 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); diff -r 866defb5f95a -r 305d318f488d TODO --- a/TODO Mon Dec 09 10:04:34 2024 +0100 +++ b/TODO Mon Dec 09 19:41:02 2024 +0100 @@ -186,9 +186,6 @@ Mid-term -------- -* Support C-GET SCU (note that C-GET SCP was introduced in Orthanc 1.7.0) -* Configure the list of accepted SOP Classes - https://discourse.orthanc-server.org/t/can-you-limit-the-sop-classes-accepted-as-store-scp/4606 * Check how Orthanc shall behave wrt to AcceptedSopClasses in these situations (consider Orthanc accepts CT but not PT) - What shall we log/warn if an external modality tries to send a PT/CT @@ -204,9 +201,6 @@ * Strict hierarchical C-FIND: https://groups.google.com/d/msg/orthanc-users/VBHpeGVSNKM/tkaVvjWFBwAJ * report DIMSE error codes in Rest API and job status for /store /query /move /retrieve -* report progress report of C-Move operation in jop progress. There are - progress callbacks available in DIMSE_moveUser - https://groups.google.com/g/orthanc-users/c/c8cGnA7FzsE/m/BSs66D8wBwAJ * Log outgoing C-Find queries * Support other Transfer Syntaxes in the Worklist plugin: https://discourse.orthanc-server.org/t/could-you-please-create-an-option-to-set-the-transfer-syntax-in-the-worklist-plugin-currently-little-endian-explicit-is-fixed/4871