Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4723:4b721432fa67 openssl-3.x
integration mainline->openssl-3.x
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jun 2021 12:50:01 +0200 |
parents | 783f8a048035 2b4da0ee6b73 |
children | 61da49321754 |
comparison
equal
deleted
inserted
replaced
4719:b11900508dc0 | 4723:4b721432fa67 |
---|---|
52 static Orthanc::Semaphore throttlingSemaphore_(4); // TODO => PARAMETER? | 52 static Orthanc::Semaphore throttlingSemaphore_(4); // TODO => PARAMETER? |
53 | 53 |
54 | 54 |
55 static const std::string CHECK_REVISIONS = "CheckRevisions"; | 55 static const std::string CHECK_REVISIONS = "CheckRevisions"; |
56 | 56 |
57 static const char* const IGNORE_LENGTH = "ignore-length"; | |
58 | |
57 | 59 |
58 namespace Orthanc | 60 namespace Orthanc |
59 { | 61 { |
60 static std::string GetDocumentationSampleResource(ResourceType type) | 62 static std::string GetDocumentationSampleResource(ResourceType type) |
61 { | 63 { |
398 ServerContext& context = OrthancRestApi::GetContext(call); | 400 ServerContext& context = OrthancRestApi::GetContext(call); |
399 | 401 |
400 std::string publicId = call.GetUriComponent("id", ""); | 402 std::string publicId = call.GetUriComponent("id", ""); |
401 | 403 |
402 std::set<DicomTag> ignoreTagLength; | 404 std::set<DicomTag> ignoreTagLength; |
403 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); | 405 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH); |
404 | 406 |
405 if (format != DicomToJsonFormat_Full || | 407 if (format != DicomToJsonFormat_Full || |
406 !ignoreTagLength.empty()) | 408 !ignoreTagLength.empty()) |
407 { | 409 { |
408 Json::Value full; | 410 Json::Value full; |
430 .SetTag("Instances") | 432 .SetTag("Instances") |
431 .SetSummary("Get DICOM tags") | 433 .SetSummary("Get DICOM tags") |
432 .SetDescription("Get the DICOM tags in the specified format. By default, the `full` format is used, which " | 434 .SetDescription("Get the DICOM tags in the specified format. By default, the `full` format is used, which " |
433 "combines hexadecimal tags with human-readable description.") | 435 "combines hexadecimal tags with human-readable description.") |
434 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") | 436 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") |
437 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings, | |
438 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) | |
435 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") | 439 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") |
436 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/tags", 10); | 440 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/tags", 10); |
437 return; | 441 return; |
438 } | 442 } |
439 | 443 |
464 call.GetDocumentation() | 468 call.GetDocumentation() |
465 .SetTag("Instances") | 469 .SetTag("Instances") |
466 .SetSummary("Get human-readable tags") | 470 .SetSummary("Get human-readable tags") |
467 .SetDescription("Get the DICOM tags in human-readable format (same as the `/instances/{id}/tags?simplify` route)") | 471 .SetDescription("Get the DICOM tags in human-readable format (same as the `/instances/{id}/tags?simplify` route)") |
468 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") | 472 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") |
469 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, | 473 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings, |
470 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) | 474 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) |
471 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") | 475 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") |
472 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/simplified-tags", 10); | 476 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/simplified-tags", 10); |
473 return; | 477 return; |
474 } | 478 } |
2394 call.GetDocumentation() | 2398 call.GetDocumentation() |
2395 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */)) | 2399 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */)) |
2396 .SetSummary("Get " + m + " module" + std::string(resource == m ? "" : " of " + resource)) | 2400 .SetSummary("Get " + m + " module" + std::string(resource == m ? "" : " of " + resource)) |
2397 .SetDescription("Get the " + m + " module of the DICOM " + resource + " whose Orthanc identifier is provided in the URL") | 2401 .SetDescription("Get the " + m + " module of the DICOM " + resource + " whose Orthanc identifier is provided in the URL") |
2398 .SetUriArgument("id", "Orthanc identifier of the " + resource + " of interest") | 2402 .SetUriArgument("id", "Orthanc identifier of the " + resource + " of interest") |
2399 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, | 2403 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings, |
2400 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) | 2404 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) |
2401 .AddAnswerType(MimeType_Json, "Information about the DICOM " + resource) | 2405 .AddAnswerType(MimeType_Json, "Information about the DICOM " + resource) |
2402 .SetHttpGetSample(GetDocumentationSampleResource(resourceType) + "/" + (*call.GetFullUri().rbegin()), true); | 2406 .SetHttpGetSample(GetDocumentationSampleResource(resourceType) + "/" + (*call.GetFullUri().rbegin()), true); |
2403 return; | 2407 return; |
2404 } | 2408 } |
2415 | 2419 |
2416 ServerContext& context = OrthancRestApi::GetContext(call); | 2420 ServerContext& context = OrthancRestApi::GetContext(call); |
2417 std::string publicId = call.GetUriComponent("id", ""); | 2421 std::string publicId = call.GetUriComponent("id", ""); |
2418 | 2422 |
2419 std::set<DicomTag> ignoreTagLength; | 2423 std::set<DicomTag> ignoreTagLength; |
2420 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); | 2424 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH); |
2421 | 2425 |
2422 typedef std::set<DicomTag> ModuleTags; | 2426 typedef std::set<DicomTag> ModuleTags; |
2423 ModuleTags moduleTags; | 2427 ModuleTags moduleTags; |
2424 DicomTag::AddTagsForModule(moduleTags, module); | 2428 DicomTag::AddTagsForModule(moduleTags, module); |
2425 | 2429 |
2791 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) | 2795 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) |
2792 .SetSummary("Get tags of instances") | 2796 .SetSummary("Get tags of instances") |
2793 .SetDescription("Get the tags of all the child instances of the DICOM " + r + | 2797 .SetDescription("Get the tags of all the child instances of the DICOM " + r + |
2794 " whose Orthanc identifier is provided in the URL") | 2798 " whose Orthanc identifier is provided in the URL") |
2795 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") | 2799 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") |
2796 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, | 2800 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings, |
2797 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) | 2801 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) |
2798 .AddAnswerType(MimeType_Json, "JSON object associating the Orthanc identifiers of the instances, with the values of their DICOM tags") | 2802 .AddAnswerType(MimeType_Json, "JSON object associating the Orthanc identifiers of the instances, with the values of their DICOM tags") |
2799 .SetTruncatedJsonHttpGetSample(GetDocumentationSampleResource(t) + "/instances-tags", 5); | 2803 .SetTruncatedJsonHttpGetSample(GetDocumentationSampleResource(t) + "/instances-tags", 5); |
2800 return; | 2804 return; |
2801 } | 2805 } |
2803 ServerContext& context = OrthancRestApi::GetContext(call); | 2807 ServerContext& context = OrthancRestApi::GetContext(call); |
2804 std::string publicId = call.GetUriComponent("id", ""); | 2808 std::string publicId = call.GetUriComponent("id", ""); |
2805 DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Full); | 2809 DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Full); |
2806 | 2810 |
2807 std::set<DicomTag> ignoreTagLength; | 2811 std::set<DicomTag> ignoreTagLength; |
2808 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); | 2812 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH); |
2809 | 2813 |
2810 // Retrieve all the instances of this patient/study/series | 2814 // Retrieve all the instances of this patient/study/series |
2811 typedef std::list<std::string> Instances; | 2815 typedef std::list<std::string> Instances; |
2812 Instances instances; | 2816 Instances instances; |
2813 | 2817 |