diff OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4740:c1d6ce00be3f openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Jul 2021 08:40:43 +0200
parents b11900508dc0 3709565bee7f
children 2e71a08eea15
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Jul 06 08:36:54 2021 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Jul 06 08:40:43 2021 +0200
@@ -379,7 +379,7 @@
     }
 
     Json::Value result;
-    answers.ToJson(result, true);
+    answers.ToJson(result, DicomToJsonFormat_Human);
     call.GetOutput().AnswerJson(result);
   }
 
@@ -422,7 +422,7 @@
     }
 
     Json::Value result;
-    answers.ToJson(result, true);
+    answers.ToJson(result, DicomToJsonFormat_Human);
     call.GetOutput().AnswerJson(result);
   }
 
@@ -466,7 +466,7 @@
     }
 
     Json::Value result;
-    answers.ToJson(result, true);
+    answers.ToJson(result, DicomToJsonFormat_Human);
     call.GetOutput().AnswerJson(result);
   }
 
@@ -511,7 +511,7 @@
     }
 
     Json::Value result;
-    answers.ToJson(result, true);
+    answers.ToJson(result, DicomToJsonFormat_Human);
     call.GetOutput().AnswerJson(result);
   }
 
@@ -565,7 +565,7 @@
     for (size_t i = 0; i < patients.GetSize(); i++)
     {
       Json::Value patient;
-      patients.ToJson(patient, i, true);
+      patients.ToJson(patient, i, DicomToJsonFormat_Human);
 
       DicomMap::SetupFindStudyTemplate(m);
       if (!MergeQueryAndTemplate(m, call))
@@ -584,7 +584,7 @@
       for (size_t j = 0; j < studies.GetSize(); j++)
       {
         Json::Value study;
-        studies.ToJson(study, j, true);
+        studies.ToJson(study, j, DicomToJsonFormat_Human);
 
         DicomMap::SetupFindSeriesTemplate(m);
         if (!MergeQueryAndTemplate(m, call))
@@ -603,7 +603,7 @@
         for (size_t k = 0; k < series.GetSize(); k++)
         {
           Json::Value series2;
-          series.ToJson(series2, k, true);
+          series.ToJson(series2, k, DicomToJsonFormat_Human);
           study["Series"].append(series2);
         }
 
@@ -924,6 +924,7 @@
     }
     
     std::unique_ptr<DicomMoveScuJob> job(new DicomMoveScuJob(context));
+    job->SetQueryFormat(OrthancRestApi::GetDicomFormat(body, DicomToJsonFormat_Short));
     
     {
       QueryAccessor query(call);
@@ -967,6 +968,8 @@
   static void DocumentRetrieveShared(RestApiPostCall& call)
   {
     OrthancRestApi::DocumentSubmitCommandsJob(call);
+    OrthancRestApi::DocumentDicomFormat(call, DicomToJsonFormat_Short);
+
     call.GetDocumentation()
       .SetTag("Networking")
       .SetUriArgument("id", "Identifier of the query of interest")
@@ -1511,7 +1514,6 @@
   {
     if (call.IsDocumentation())
     {
-      OrthancRestApi::DocumentSubmitCommandsJob(call);
       call.GetDocumentation()
         .SetTag("Networking")
         .SetSummary("Trigger C-MOVE SCU")
@@ -1560,7 +1562,7 @@
       MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
     DicomAssociationParameters params(localAet, source);
-    InjectAssociationTimeout(params, request);
+    InjectAssociationTimeout(params, request);  // Handles KEY_TIMEOUT
 
     DicomControlUserConnection connection(params);
 
@@ -2128,13 +2130,16 @@
   {
     if (call.IsDocumentation())
     {
+      OrthancRestApi::DocumentDicomFormat(call, DicomToJsonFormat_Human);
+
       call.GetDocumentation()
         .SetTag("Networking")
         .SetSummary("C-FIND SCU for worklist")
         .SetDescription("Trigger C-FIND SCU command against the remote worklists of the DICOM modality "
                         "whose identifier is provided in URL")
         .SetUriArgument("id", "Identifier of the modality of interest")
-        .AddRequestType(MimeType_Json, "Associative array containing the query on the values of the DICOM tags")
+        .SetRequestField(KEY_QUERY, RestApiCallDocumentation::Type_JsonObject,
+                         "Associative array containing the filter on the values of the DICOM tags", true)
         .AddAnswerType(MimeType_Json, "JSON array describing the DICOM tags of the matching worklists");
       return;
     }
@@ -2142,9 +2147,23 @@
     Json::Value json;
     if (call.ParseJsonRequest(json))
     {
-      std::unique_ptr<ParsedDicomFile> query
-        (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0),
-                                         "" /* no private creator */));
+      std::unique_ptr<ParsedDicomFile> query;
+      DicomToJsonFormat format;
+
+      if (json.isMember(KEY_QUERY))
+      {
+        // New in Orthanc 1.9.5
+        query.reset(ParsedDicomFile::CreateFromJson(json[KEY_QUERY], static_cast<DicomFromJsonFlags>(0),
+                                                    "" /* no private creator */));
+        format = OrthancRestApi::GetDicomFormat(json, DicomToJsonFormat_Human);
+      }
+      else
+      {
+        // Compatibility with Orthanc <= 1.9.4
+        query.reset(ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0),
+                                                    "" /* no private creator */));
+        format = DicomToJsonFormat_Human;
+      }
 
       DicomFindAnswers answers(true);
 
@@ -2154,7 +2173,7 @@
       }
 
       Json::Value result;
-      answers.ToJson(result, true);
+      answers.ToJson(result, format);
       call.GetOutput().AnswerJson(result);
     }
     else