comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4722:2b4da0ee6b73

added missing documentation of "ignore-length" in "/instances/{id}/tags"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 Jun 2021 12:42:54 +0200
parents 758fe3ffb336
children 4b721432fa67 9da6ca57a977
comparison
equal deleted inserted replaced
4721:cf4a80a7e1a2 4722:2b4da0ee6b73
64 static Orthanc::Semaphore throttlingSemaphore_(4); // TODO => PARAMETER? 64 static Orthanc::Semaphore throttlingSemaphore_(4); // TODO => PARAMETER?
65 65
66 66
67 static const std::string CHECK_REVISIONS = "CheckRevisions"; 67 static const std::string CHECK_REVISIONS = "CheckRevisions";
68 68
69 static const char* const IGNORE_LENGTH = "ignore-length";
70
69 71
70 namespace Orthanc 72 namespace Orthanc
71 { 73 {
72 static std::string GetDocumentationSampleResource(ResourceType type) 74 static std::string GetDocumentationSampleResource(ResourceType type)
73 { 75 {
410 ServerContext& context = OrthancRestApi::GetContext(call); 412 ServerContext& context = OrthancRestApi::GetContext(call);
411 413
412 std::string publicId = call.GetUriComponent("id", ""); 414 std::string publicId = call.GetUriComponent("id", "");
413 415
414 std::set<DicomTag> ignoreTagLength; 416 std::set<DicomTag> ignoreTagLength;
415 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); 417 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH);
416 418
417 if (format != DicomToJsonFormat_Full || 419 if (format != DicomToJsonFormat_Full ||
418 !ignoreTagLength.empty()) 420 !ignoreTagLength.empty())
419 { 421 {
420 Json::Value full; 422 Json::Value full;
442 .SetTag("Instances") 444 .SetTag("Instances")
443 .SetSummary("Get DICOM tags") 445 .SetSummary("Get DICOM tags")
444 .SetDescription("Get the DICOM tags in the specified format. By default, the `full` format is used, which " 446 .SetDescription("Get the DICOM tags in the specified format. By default, the `full` format is used, which "
445 "combines hexadecimal tags with human-readable description.") 447 "combines hexadecimal tags with human-readable description.")
446 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") 448 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
449 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings,
450 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false)
447 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") 451 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value")
448 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/tags", 10); 452 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/tags", 10);
449 return; 453 return;
450 } 454 }
451 455
476 call.GetDocumentation() 480 call.GetDocumentation()
477 .SetTag("Instances") 481 .SetTag("Instances")
478 .SetSummary("Get human-readable tags") 482 .SetSummary("Get human-readable tags")
479 .SetDescription("Get the DICOM tags in human-readable format (same as the `/instances/{id}/tags?simplify` route)") 483 .SetDescription("Get the DICOM tags in human-readable format (same as the `/instances/{id}/tags?simplify` route)")
480 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") 484 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
481 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, 485 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings,
482 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) 486 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false)
483 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value") 487 .AddAnswerType(MimeType_Json, "JSON object containing the DICOM tags and their associated value")
484 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/simplified-tags", 10); 488 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/instances/7c92ce8e-bbf67ed2-ffa3b8c1-a3b35d94-7ff3ae26/simplified-tags", 10);
485 return; 489 return;
486 } 490 }
2406 call.GetDocumentation() 2410 call.GetDocumentation()
2407 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */)) 2411 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */))
2408 .SetSummary("Get " + m + " module" + std::string(resource == m ? "" : " of " + resource)) 2412 .SetSummary("Get " + m + " module" + std::string(resource == m ? "" : " of " + resource))
2409 .SetDescription("Get the " + m + " module of the DICOM " + resource + " whose Orthanc identifier is provided in the URL") 2413 .SetDescription("Get the " + m + " module of the DICOM " + resource + " whose Orthanc identifier is provided in the URL")
2410 .SetUriArgument("id", "Orthanc identifier of the " + resource + " of interest") 2414 .SetUriArgument("id", "Orthanc identifier of the " + resource + " of interest")
2411 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, 2415 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings,
2412 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) 2416 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false)
2413 .AddAnswerType(MimeType_Json, "Information about the DICOM " + resource) 2417 .AddAnswerType(MimeType_Json, "Information about the DICOM " + resource)
2414 .SetHttpGetSample(GetDocumentationSampleResource(resourceType) + "/" + (*call.GetFullUri().rbegin()), true); 2418 .SetHttpGetSample(GetDocumentationSampleResource(resourceType) + "/" + (*call.GetFullUri().rbegin()), true);
2415 return; 2419 return;
2416 } 2420 }
2427 2431
2428 ServerContext& context = OrthancRestApi::GetContext(call); 2432 ServerContext& context = OrthancRestApi::GetContext(call);
2429 std::string publicId = call.GetUriComponent("id", ""); 2433 std::string publicId = call.GetUriComponent("id", "");
2430 2434
2431 std::set<DicomTag> ignoreTagLength; 2435 std::set<DicomTag> ignoreTagLength;
2432 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); 2436 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH);
2433 2437
2434 typedef std::set<DicomTag> ModuleTags; 2438 typedef std::set<DicomTag> ModuleTags;
2435 ModuleTags moduleTags; 2439 ModuleTags moduleTags;
2436 DicomTag::AddTagsForModule(moduleTags, module); 2440 DicomTag::AddTagsForModule(moduleTags, module);
2437 2441
2803 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) 2807 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */))
2804 .SetSummary("Get tags of instances") 2808 .SetSummary("Get tags of instances")
2805 .SetDescription("Get the tags of all the child instances of the DICOM " + r + 2809 .SetDescription("Get the tags of all the child instances of the DICOM " + r +
2806 " whose Orthanc identifier is provided in the URL") 2810 " whose Orthanc identifier is provided in the URL")
2807 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") 2811 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest")
2808 .SetHttpGetArgument("ignore-length", RestApiCallDocumentation::Type_JsonListOfStrings, 2812 .SetHttpGetArgument(IGNORE_LENGTH, RestApiCallDocumentation::Type_JsonListOfStrings,
2809 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false) 2813 "Also include the DICOM tags that are provided in this list, even if their associated value is long", false)
2810 .AddAnswerType(MimeType_Json, "JSON object associating the Orthanc identifiers of the instances, with the values of their DICOM tags") 2814 .AddAnswerType(MimeType_Json, "JSON object associating the Orthanc identifiers of the instances, with the values of their DICOM tags")
2811 .SetTruncatedJsonHttpGetSample(GetDocumentationSampleResource(t) + "/instances-tags", 5); 2815 .SetTruncatedJsonHttpGetSample(GetDocumentationSampleResource(t) + "/instances-tags", 5);
2812 return; 2816 return;
2813 } 2817 }
2815 ServerContext& context = OrthancRestApi::GetContext(call); 2819 ServerContext& context = OrthancRestApi::GetContext(call);
2816 std::string publicId = call.GetUriComponent("id", ""); 2820 std::string publicId = call.GetUriComponent("id", "");
2817 DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Full); 2821 DicomToJsonFormat format = OrthancRestApi::GetDicomFormat(call, DicomToJsonFormat_Full);
2818 2822
2819 std::set<DicomTag> ignoreTagLength; 2823 std::set<DicomTag> ignoreTagLength;
2820 ParseSetOfTags(ignoreTagLength, call, "ignore-length"); 2824 ParseSetOfTags(ignoreTagLength, call, IGNORE_LENGTH);
2821 2825
2822 // Retrieve all the instances of this patient/study/series 2826 // Retrieve all the instances of this patient/study/series
2823 typedef std::list<std::string> Instances; 2827 typedef std::list<std::string> Instances;
2824 Instances instances; 2828 Instances instances;
2825 2829