Mercurial > hg > orthanc
diff OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp @ 4766:388d108f6e4b
Added "Level" option to POST /tools/bulk-modify
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 16 Aug 2021 10:54:38 +0200 |
parents | fb98db281d1d |
children | 61da49321754 94616af363ec |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp Fri Aug 13 17:41:09 2021 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp Mon Aug 16 10:54:38 2021 +0200 @@ -58,6 +58,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"; @@ -80,6 +81,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()" @@ -102,6 +112,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); } @@ -125,6 +138,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); } @@ -443,6 +459,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"); @@ -454,7 +475,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); }