diff OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 4785:61da49321754 openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Aug 2021 22:21:24 +0200
parents 783f8a048035 388d108f6e4b
children 70d2a97ca8cb
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Wed Jul 21 10:48:14 2021 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Aug 30 22:21:24 2021 +0200
@@ -46,6 +46,7 @@
 static const char* const KEEP = "Keep";
 static const char* const KEEP_PRIVATE_TAGS = "KeepPrivateTags";
 static const char* const KEEP_SOURCE = "KeepSource";
+static const char* const LEVEL = "Level";
 static const char* const PARENT = "Parent";
 static const char* const PRIVATE_CREATOR = "PrivateCreator";
 static const char* const REMOVE = "Remove";
@@ -68,6 +69,15 @@
   }
 
 
+  static void DocumentKeepSource(RestApiPostCall& call)
+  {
+    call.GetDocumentation()
+      .SetRequestField(KEEP_SOURCE, RestApiCallDocumentation::Type_Boolean,
+                       "If set to `false`, instructs Orthanc to the remove original resources. "
+                       "By default, the original resources are kept in Orthanc.", false);
+  }
+
+
   static void DocumentModifyOptions(RestApiPostCall& call)
   {
     // Check out "DicomModification::ParseModifyRequest()"
@@ -90,6 +100,9 @@
                        "as this breaks the DICOM model of the real world.", false)
       .SetRequestField(PRIVATE_CREATOR, RestApiCallDocumentation::Type_String,
                        "The private creator to be used for private tags in `Replace`", false);
+
+    // This was existing, but undocumented in Orthanc <= 1.9.6
+    DocumentKeepSource(call);
   }
 
 
@@ -113,6 +126,9 @@
                        "List of DICOM tags whose value must not be destroyed by the anonymization. " INFO_SUBSEQUENCES, false)
       .SetRequestField(PRIVATE_CREATOR, RestApiCallDocumentation::Type_String,
                        "The private creator to be used for private tags in `Replace`", false);
+
+    // This was existing, but undocumented in Orthanc <= 1.9.6
+    DocumentKeepSource(call);
   }
 
 
@@ -431,6 +447,11 @@
         .SetSummary("Modify a set of resources")
         .SetRequestField(RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings,
                          "List of the Orthanc identifiers of the patients/studies/series/instances of interest.", true)
+        .SetRequestField(LEVEL, RestApiCallDocumentation::Type_String,
+                         "Level of the modification (`Patient`, `Study`, `Series` or `Instance`). If absent, "
+                         "the level defaults to `Instance`, but is set to `Patient` if `PatientID` is modified, "
+                         "to `Study` if `StudyInstanceUID` is modified, or to `Series` if `SeriesInstancesUID` "
+                         "is modified. (new in Orthanc 1.9.7)", false)
         .SetDescription("Start a job that will modify all the DICOM patients, studies, series or instances "
                         "whose identifiers are provided in the `Resources` field.")
         .AddAnswerType(MimeType_Json, "The list of all the resources that have been altered by this modification");
@@ -442,7 +463,15 @@
     Json::Value body;
     ParseModifyRequest(body, *modification, call);
 
-    modification->SetLevel(DetectModifyLevel(*modification));
+    if (body.isMember(LEVEL))
+    {
+      // This case was introduced in Orthanc 1.9.7
+      modification->SetLevel(StringToResourceType(body[LEVEL].asCString()));
+    }
+    else
+    {
+      modification->SetLevel(DetectModifyLevel(*modification));
+    }
 
     SubmitBulkJob(modification, false /* not an anonymization */, call, body);
   }