changeset 4422:48303e493135

cont openapi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Dec 2020 16:05:07 +0100
parents a7d72378e1cb
children 2a69b58ff3ac
files OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp
diffstat 3 files changed, 78 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Tue Dec 29 15:22:00 2020 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Tue Dec 29 16:05:07 2020 +0100
@@ -700,6 +700,35 @@
 
   static void CreateDicom(RestApiPostCall& call)
   {
+    if (call.IsDocumentation())
+    {
+      call.GetDocumentation()
+        .SetTag("System")
+        .SetSummary("Create one DICOM instance")
+        .SetDescription("Create one DICOM instance, and store it into Orthanc")
+        .SetRequestField("Tags", RestApiCallDocumentation::Type_JsonObject,
+                         "Associative array containing the tags of the new instance to be created", true)
+        .SetRequestField("Content", RestApiCallDocumentation::Type_String,
+                         "This field can be used to embed an image (pixel data) or a PDF inside the created DICOM instance. "
+                         "The PNG image, the JPEG image or the PDF file must be provided using their "
+                         "[data URI scheme encoding](https://en.wikipedia.org/wiki/Data_URI_scheme). "
+                         "This field can possibly contain a JSON array, in which case a DICOM series is created "
+                         "containing one DICOM instance for each item in the `Content` field.", false)
+        .SetRequestField("Parent", RestApiCallDocumentation::Type_String,
+                         "If present, the newly created instance will be attached to the parent DICOM resource "
+                         "whose Orthanc identifier is contained in this field. The DICOM tags of the parent "
+                         "modules in the DICOM hierarchy will be automatically copied to the newly created instance.", false)
+        .SetRequestField("InterpretBinaryTags", RestApiCallDocumentation::Type_Boolean,
+                         "If some value in the `Tags` associative array is formatted according to some "
+                         "[data URI scheme encoding](https://en.wikipedia.org/wiki/Data_URI_scheme), "
+                         "whether this value is decoded to a binary value or kept as such (`true` by default)", false)
+        .SetRequestField("PrivateCreator", RestApiCallDocumentation::Type_String,
+                         "The private creator to be used for private tags in `Tags`", false)
+        .SetAnswerField("ID", RestApiCallDocumentation::Type_String, "Orthanc identifier of the newly created instance")
+        .SetAnswerField("Path", RestApiCallDocumentation::Type_String, "Path to access the instance in the REST API");
+      return;
+    }
+
     Json::Value request;
     if (!call.ParseJsonRequest(request) ||
         !request.isObject())
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Dec 29 15:22:00 2020 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Tue Dec 29 16:05:07 2020 +0100
@@ -967,7 +967,7 @@
       DocumentRetrieveShared(call);
       call.GetDocumentation()
         .SetSummary("Retrieve one answer")
-        .SetDescription("Start a C-MOVE command as a job, in order to retrieve one answer associated with the "
+        .SetDescription("Start a C-MOVE SCU command as a job, in order to retrieve one answer associated with the "
                         "query/retrieve operation whose identifiers are provided in the URL: "
                         "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move")
         .SetUriArgument("index", "Index of the answer");
@@ -986,7 +986,7 @@
       DocumentRetrieveShared(call);
       call.GetDocumentation()
         .SetSummary("Retrieve all answers")
-        .SetDescription("Start a C-MOVE command as a job, in order to retrieve all the answers associated with the "
+        .SetDescription("Start a C-MOVE SCU command as a job, in order to retrieve all the answers associated with the "
                         "query/retrieve operation whose identifier is provided in the URL: "
                         "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move");
       return;
@@ -1365,6 +1365,36 @@
 
   static void DicomStore(RestApiPostCall& call)
   {
+    static const char* KEY_MOVE_ORIGINATOR_AET = "MoveOriginatorAet";
+    static const char* KEY_MOVE_ORIGINATOR_ID = "MoveOriginatorID";
+    static const char* KEY_STORAGE_COMMITMENT = "StorageCommitment";
+    
+    if (call.IsDocumentation())
+    {
+      OrthancRestApi::DocumentSubmitCommandsJob(call);
+      call.GetDocumentation()
+        .SetTag("Networking")
+        .SetSummary("Trigger C-STORE SCU")
+        .SetDescription("Start a C-STORE SCU command as a job, in order to send DICOM resources stored locally "
+                        "to some remote DICOM modality whose identifier is provided in the URL: "
+                        "https://book.orthanc-server.com/users/rest.html#rest-store-scu")
+        .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings,
+                         "List of the Orthanc identifiers of all the DICOM resources to be sent", true)
+        .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
+                         "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false)
+        .SetRequestField(KEY_MOVE_ORIGINATOR_AET, RestApiCallDocumentation::Type_String,
+                         "Move originator AET that is used for this commands, in order to fake a C-MOVE SCU", false)
+        .SetRequestField(KEY_MOVE_ORIGINATOR_ID, RestApiCallDocumentation::Type_Number,
+                         "Move originator ID that is used for this commands, in order to fake a C-MOVE SCU", false)
+        .SetRequestField(KEY_STORAGE_COMMITMENT, RestApiCallDocumentation::Type_Boolean,
+                         "Whether to use DICOM storage commitment to validate the success of the C-STORE: "
+                         "https://book.orthanc-server.com/users/storage-commitment.html", false)
+        .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
+                         "Timeout for the C-STORE command, in seconds", false)
+        .SetUriArgument("id", "Identifier of the modality of interest");
+      return;
+    }
+
     ServerContext& context = OrthancRestApi::GetContext(call);
 
     std::string remote = call.GetUriComponent("id", "");
@@ -1377,9 +1407,9 @@
     std::string localAet = Toolbox::GetJsonStringField
       (request, KEY_LOCAL_AET, context.GetDefaultLocalApplicationEntityTitle());
     std::string moveOriginatorAET = Toolbox::GetJsonStringField
-      (request, "MoveOriginatorAet", context.GetDefaultLocalApplicationEntityTitle());
+      (request, KEY_MOVE_ORIGINATOR_AET, context.GetDefaultLocalApplicationEntityTitle());
     int moveOriginatorID = Toolbox::GetJsonIntegerField
-      (request, "MoveOriginatorID", 0 /* By default, not a C-MOVE */);
+      (request, KEY_MOVE_ORIGINATOR_ID, 0 /* By default, not a C-MOVE */);
 
     job->SetLocalAet(localAet);
     job->SetRemoteModality(MyGetModalityUsingSymbolicName(remote));
@@ -1390,7 +1420,7 @@
     }
 
     // New in Orthanc 1.6.0
-    if (Toolbox::GetJsonBooleanField(request, "StorageCommitment", false))
+    if (Toolbox::GetJsonBooleanField(request, KEY_STORAGE_COMMITMENT, false))
     {
       job->EnableStorageCommitment(true);
     }
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Dec 29 15:22:00 2020 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Dec 29 16:05:07 2020 +0100
@@ -2293,6 +2293,20 @@
 
   static void Lookup(RestApiPostCall& call)
   {
+    if (call.IsDocumentation())
+    {
+      call.GetDocumentation()
+        .SetTag("System")
+        .SetSummary("Look for DICOM identifiers")
+        .SetDescription("This URI can be used to convert one DICOM identifier to a list of matching Orthanc resources")
+        .AddRequestType(MimeType_PlainText, "The DICOM identifier of interest (i.e. the value of `PatientID`, "
+                        "`StudyInstanceUID`, `SeriesInstanceUID`, or `SOPInstanceUID`)")
+        .AddAnswerType(MimeType_Json, "JSON array containing a list of matching Orthanc resources, each item in the "
+                       "list corresponding to a JSON object with the fields `Type`, `ID` and `Path` identifying one "
+                       "DICOM resource that is stored by Orthanc");
+      return;
+    }
+
     std::string tag;
     call.BodyToString(tag);