comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4421:a7d72378e1cb

cont openapi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Dec 2020 15:22:00 +0100
parents f95ad769e671
children 48303e493135
comparison
equal deleted inserted replaced
4420:f95ad769e671 4421:a7d72378e1cb
406 } 406 }
407 407
408 408
409 static void ExportInstanceFile(RestApiPostCall& call) 409 static void ExportInstanceFile(RestApiPostCall& call)
410 { 410 {
411 if (call.IsDocumentation())
412 {
413 call.GetDocumentation()
414 .SetTag("Instances")
415 .SetSummary("Write DICOM onto filesystem")
416 .SetDescription("Write the DICOM file onto the filesystem where Orthanc is running")
417 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
418 .AddRequestType(MimeType_PlainText, "Target path on the filesystem");
419 return;
420 }
421
411 ServerContext& context = OrthancRestApi::GetContext(call); 422 ServerContext& context = OrthancRestApi::GetContext(call);
412 423
413 std::string publicId = call.GetUriComponent("id", ""); 424 std::string publicId = call.GetUriComponent("id", "");
414 425
415 std::string dicom; 426 std::string dicom;
2361 static const char* const KEY_LEVEL = "Level"; 2372 static const char* const KEY_LEVEL = "Level";
2362 static const char* const KEY_LIMIT = "Limit"; 2373 static const char* const KEY_LIMIT = "Limit";
2363 static const char* const KEY_QUERY = "Query"; 2374 static const char* const KEY_QUERY = "Query";
2364 static const char* const KEY_SINCE = "Since"; 2375 static const char* const KEY_SINCE = "Since";
2365 2376
2377 if (call.IsDocumentation())
2378 {
2379 call.GetDocumentation()
2380 .SetTag("System")
2381 .SetSummary("Look for local resources")
2382 .SetDescription("This URI can be used to perform a search on the content of the local Orthanc server, "
2383 "in a way that is similar to querying remote DICOM modalities using C-FIND SCU: "
2384 "https://book.orthanc-server.com/users/rest.html#performing-finds-within-orthanc")
2385 .SetRequestField(KEY_CASE_SENSITIVE, RestApiCallDocumentation::Type_Boolean,
2386 "Enable case-sensitive search for PN value representations (defaults to configuration option `CaseSensitivePN`)", false)
2387 .SetRequestField(KEY_EXPAND, RestApiCallDocumentation::Type_Boolean,
2388 "Also retrieve the content of the matching resources, not only their Orthanc identifiers", false)
2389 .SetRequestField(KEY_LEVEL, RestApiCallDocumentation::Type_String,
2390 "Level of the query (`Patient`, `Study`, `Series` or `Instance`)", true)
2391 .SetRequestField(KEY_LIMIT, RestApiCallDocumentation::Type_Number,
2392 "Limit the number of reported resources", false)
2393 .SetRequestField(KEY_SINCE, RestApiCallDocumentation::Type_Number,
2394 "Show only the resources since the provided index (in conjunction with `Limit`)", false)
2395 .SetRequestField(KEY_QUERY, RestApiCallDocumentation::Type_JsonObject,
2396 "Associative array containing the filter on the values of the DICOM tags", true)
2397 .AddAnswerType(MimeType_Json, "JSON array containing either the Orthanc identifiers, or detailed information "
2398 "about the reported resources (if `Expand` argument is `true`)");
2399 return;
2400 }
2401
2366 ServerContext& context = OrthancRestApi::GetContext(call); 2402 ServerContext& context = OrthancRestApi::GetContext(call);
2367 2403
2368 Json::Value request; 2404 Json::Value request;
2369 if (!call.ParseJsonRequest(request) || 2405 if (!call.ParseJsonRequest(request) ||
2370 request.type() != Json::objectValue) 2406 request.type() != Json::objectValue)
2666 } 2702 }
2667 2703
2668 2704
2669 static void OrderSlices(RestApiGetCall& call) 2705 static void OrderSlices(RestApiGetCall& call)
2670 { 2706 {
2707 if (call.IsDocumentation())
2708 {
2709 call.GetDocumentation()
2710 .SetDeprecated()
2711 .SetTag("Series")
2712 .SetSummary("Order the slices")
2713 .SetDescription("Sort the instances and frames (slices) of the DICOM series whose Orthanc identifier is provided in the URL. "
2714 "This URI is essentially used by the Orthanc Web viewer and by the Osimis Web viewer.")
2715 .SetUriArgument("id", "Orthanc identifier of the series of interest")
2716 .SetAnswerField("Dicom", RestApiCallDocumentation::Type_JsonListOfStrings,
2717 "Ordered list of paths to DICOM instances")
2718 .SetAnswerField("Slices", RestApiCallDocumentation::Type_JsonListOfStrings,
2719 "Ordered list of paths to frames. It is recommended to use this field, as it is also valid "
2720 "in the case of multiframe images.")
2721 .SetAnswerField("SlicesShort", RestApiCallDocumentation::Type_JsonListOfObjects,
2722 "Same information as the `Slices` field, but in a compact form")
2723 .SetAnswerField("Type", RestApiCallDocumentation::Type_String,
2724 "Can be `Volume` (for 3D volumes) or `Sequence` (notably for cine images)")
2725 .SetTruncatedJsonHttpGetSample("https://demo.orthanc-server.com/series/1e2c125c-411b8e86-3f4fe68e-a7584dd3-c6da78f0/ordered-slices", 10);
2726 return;
2727 }
2728
2671 const std::string id = call.GetUriComponent("id", ""); 2729 const std::string id = call.GetUriComponent("id", "");
2672 2730
2673 ServerIndex& index = OrthancRestApi::GetIndex(call); 2731 ServerIndex& index = OrthancRestApi::GetIndex(call);
2674 SliceOrdering ordering(index, id); 2732 SliceOrdering ordering(index, id);
2675 2733