Mercurial > hg > orthanc
changeset 3303:a215182a0c2f
"DicomMoveScu" jobs provide the associated C-FIND answer in their "Query" public field
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 24 Feb 2019 10:03:02 +0100 |
parents | 8ed445e94486 |
children | e83546f4adcc |
files | NEWS OrthancServer/ServerJobs/DicomMoveScuJob.cpp OrthancServer/ServerJobs/DicomMoveScuJob.h |
diffstat | 3 files changed, 51 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Sun Feb 24 09:30:13 2019 +0100 +++ b/NEWS Sun Feb 24 10:03:02 2019 +0100 @@ -10,6 +10,12 @@ - Simplified Chinese (ISO 2022 IR 58) * Basic support for character sets with code extensions (ISO 2022 escape sequences) +REST API +-------- + +* API version has been upgraded to 1.5 +* "DicomMoveScu" jobs provide the associated C-FIND answer in their "Query" public field + Plugins -------
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.cpp Sun Feb 24 09:30:13 2019 +0100 +++ b/OrthancServer/ServerJobs/DicomMoveScuJob.cpp Sun Feb 24 10:03:02 2019 +0100 @@ -36,6 +36,11 @@ #include "../../Core/SerializationToolbox.h" #include "../ServerContext.h" +static const char* const LOCAL_AET = "LocalAet"; +static const char* const TARGET_AET = "TargetAet"; +static const char* const REMOTE = "Remote"; +static const char* const QUERY = "Query"; + namespace Orthanc { class DicomMoveScuJob::Command : public SetOfCommandsJob::ICommand @@ -97,10 +102,36 @@ connection_->Move(targetAet_, findAnswer); } - + + + static void AddTagIfString(Json::Value& target, + const DicomMap& answer, + const DicomTag& tag) + { + const DicomValue* value = answer.TestAndGetValue(tag); + if (value != NULL && + !value->IsNull() && + !value->IsBinary()) + { + target[tag.Format()] = value->GetContent(); + } + } + void DicomMoveScuJob::AddFindAnswer(const DicomMap& answer) { + assert(query_.type() == Json::arrayValue); + + // Copy the identifiers tags, if they exist + Json::Value item = Json::objectValue; + AddTagIfString(item, answer, DICOM_TAG_QUERY_RETRIEVE_LEVEL); + AddTagIfString(item, answer, DICOM_TAG_PATIENT_ID); + AddTagIfString(item, answer, DICOM_TAG_STUDY_INSTANCE_UID); + AddTagIfString(item, answer, DICOM_TAG_SERIES_INSTANCE_UID); + AddTagIfString(item, answer, DICOM_TAG_SOP_INSTANCE_UID); + AddTagIfString(item, answer, DICOM_TAG_ACCESSION_NUMBER); + query_.append(item); + AddCommand(new Command(*this, answer)); } @@ -165,21 +196,25 @@ value["LocalAet"] = localAet_; value["RemoteAet"] = remote_.GetApplicationEntityTitle(); + value["Query"] = query_; } - static const char* LOCAL_AET = "LocalAet"; - static const char* TARGET_AET = "TargetAet"; - static const char* REMOTE = "Remote"; - DicomMoveScuJob::DicomMoveScuJob(ServerContext& context, const Json::Value& serialized) : SetOfCommandsJob(new Unserializer(*this), serialized), - context_(context) + context_(context), + query_(Json::arrayValue) { localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET); targetAet_ = SerializationToolbox::ReadString(serialized, TARGET_AET); remote_ = RemoteModalityParameters(serialized[REMOTE]); + + if (serialized.isMember(QUERY) && + serialized[QUERY].type() == Json::arrayValue) + { + query_ = serialized[QUERY]; + } } @@ -193,6 +228,7 @@ { target[LOCAL_AET] = localAet_; target[TARGET_AET] = targetAet_; + target[QUERY] = query_; remote_.Serialize(target[REMOTE], true /* force advanced format */); return true; }
--- a/OrthancServer/ServerJobs/DicomMoveScuJob.h Sun Feb 24 09:30:13 2019 +0100 +++ b/OrthancServer/ServerJobs/DicomMoveScuJob.h Sun Feb 24 10:03:02 2019 +0100 @@ -53,12 +53,14 @@ std::string targetAet_; RemoteModalityParameters remote_; std::auto_ptr<DicomUserConnection> connection_; + Json::Value query_; void Retrieve(const DicomMap& findAnswer); public: DicomMoveScuJob(ServerContext& context) : - context_(context) + context_(context), + query_(Json::arrayValue) { }