Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4423:2a69b58ff3ac
cont openapi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Dec 2020 16:51:28 +0100 |
parents | 48303e493135 |
children | d9473bd5ed43 |
comparison
equal
deleted
inserted
replaced
4422:48303e493135 | 4423:2a69b58ff3ac |
---|---|
1376 .SetTag("Networking") | 1376 .SetTag("Networking") |
1377 .SetSummary("Trigger C-STORE SCU") | 1377 .SetSummary("Trigger C-STORE SCU") |
1378 .SetDescription("Start a C-STORE SCU command as a job, in order to send DICOM resources stored locally " | 1378 .SetDescription("Start a C-STORE SCU command as a job, in order to send DICOM resources stored locally " |
1379 "to some remote DICOM modality whose identifier is provided in the URL: " | 1379 "to some remote DICOM modality whose identifier is provided in the URL: " |
1380 "https://book.orthanc-server.com/users/rest.html#rest-store-scu") | 1380 "https://book.orthanc-server.com/users/rest.html#rest-store-scu") |
1381 .AddRequestType(MimeType_PlainText, "The Orthanc identifier of one resource to be sent") | |
1381 .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings, | 1382 .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings, |
1382 "List of the Orthanc identifiers of all the DICOM resources to be sent", true) | 1383 "List of the Orthanc identifiers of all the DICOM resources to be sent", true) |
1383 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String, | 1384 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String, |
1384 "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false) | 1385 "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false) |
1385 .SetRequestField(KEY_MOVE_ORIGINATOR_AET, RestApiCallDocumentation::Type_String, | 1386 .SetRequestField(KEY_MOVE_ORIGINATOR_AET, RestApiCallDocumentation::Type_String, |
1386 "Move originator AET that is used for this commands, in order to fake a C-MOVE SCU", false) | 1387 "Move originator AET that is used for this commands, in order to fake a C-MOVE SCU", false) |
1387 .SetRequestField(KEY_MOVE_ORIGINATOR_ID, RestApiCallDocumentation::Type_Number, | 1388 .SetRequestField(KEY_MOVE_ORIGINATOR_ID, RestApiCallDocumentation::Type_Number, |
1388 "Move originator ID that is used for this commands, in order to fake a C-MOVE SCU", false) | 1389 "Move originator ID that is used for this commands, in order to fake a C-MOVE SCU", false) |
1389 .SetRequestField(KEY_STORAGE_COMMITMENT, RestApiCallDocumentation::Type_Boolean, | 1390 .SetRequestField(KEY_STORAGE_COMMITMENT, RestApiCallDocumentation::Type_Boolean, |
1390 "Whether to use DICOM storage commitment to validate the success of the C-STORE: " | 1391 "Whether to chain C-STORE with DICOM storage commitment to validate the success of the transmission: " |
1391 "https://book.orthanc-server.com/users/storage-commitment.html", false) | 1392 "https://book.orthanc-server.com/users/storage-commitment.html#chaining-c-store-with-storage-commitment", false) |
1392 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number, | 1393 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number, |
1393 "Timeout for the C-STORE command, in seconds", false) | 1394 "Timeout for the C-STORE command, in seconds", false) |
1394 .SetUriArgument("id", "Identifier of the modality of interest"); | 1395 .SetUriArgument("id", "Identifier of the modality of interest"); |
1395 return; | 1396 return; |
1396 } | 1397 } |
1474 * DICOM C-Move SCU | 1475 * DICOM C-Move SCU |
1475 ***************************************************************************/ | 1476 ***************************************************************************/ |
1476 | 1477 |
1477 static void DicomMove(RestApiPostCall& call) | 1478 static void DicomMove(RestApiPostCall& call) |
1478 { | 1479 { |
1480 if (call.IsDocumentation()) | |
1481 { | |
1482 OrthancRestApi::DocumentSubmitCommandsJob(call); | |
1483 call.GetDocumentation() | |
1484 .SetTag("Networking") | |
1485 .SetSummary("Trigger C-MOVE SCU") | |
1486 .SetDescription("Start a C-MOVE SCU command as a job, in order to drive the execution of a sequence of " | |
1487 "C-STORE commands by some remote DICOM modality whose identifier is provided in the URL: " | |
1488 "https://book.orthanc-server.com/users/rest.html#performing-c-move") | |
1489 .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings, | |
1490 "List of the Orthanc identifiers of all the DICOM resources to be sent", true) | |
1491 .SetRequestField(KEY_LEVEL, RestApiCallDocumentation::Type_String, | |
1492 "Level of the query (`Patient`, `Study`, `Series` or `Instance`)", true) | |
1493 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String, | |
1494 "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false) | |
1495 .SetRequestField(KEY_TARGET_AET, RestApiCallDocumentation::Type_String, | |
1496 "Target AET that will be used by the remote DICOM modality as a target for its C-STORE SCU " | |
1497 "commands, defaults to `DicomAet` configuration option in order to do a simple query/retrieve", false) | |
1498 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number, | |
1499 "Timeout for the C-STORE command, in seconds", false) | |
1500 .SetUriArgument("id", "Identifier of the modality of interest"); | |
1501 return; | |
1502 } | |
1503 | |
1479 const ServerContext& context = OrthancRestApi::GetContext(call); | 1504 const ServerContext& context = OrthancRestApi::GetContext(call); |
1480 | 1505 |
1481 Json::Value request; | 1506 Json::Value request; |
1482 | 1507 |
1483 if (!call.ParseJsonRequest(request) || | 1508 if (!call.ParseJsonRequest(request) || |
1607 } | 1632 } |
1608 } | 1633 } |
1609 | 1634 |
1610 static void PeerStore(RestApiPostCall& call) | 1635 static void PeerStore(RestApiPostCall& call) |
1611 { | 1636 { |
1637 static const char* KEY_TRANSCODE = "Transcode"; | |
1638 static const char* KEY_COMPRESS = "Compress"; | |
1639 | |
1640 if (call.IsDocumentation()) | |
1641 { | |
1642 OrthancRestApi::DocumentSubmitCommandsJob(call); | |
1643 call.GetDocumentation() | |
1644 .SetTag("Networking") | |
1645 .SetSummary("Send to Orthanc peer") | |
1646 .SetDescription("Send DICOM resources stored locally to some remote Orthanc peer whose identifier is provided in the URL: " | |
1647 "https://book.orthanc-server.com/users/rest.html#sending-one-resource") | |
1648 .AddRequestType(MimeType_PlainText, "The Orthanc identifier of one resource to be sent") | |
1649 .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings, | |
1650 "List of the Orthanc identifiers of all the DICOM resources to be sent", true) | |
1651 .SetRequestField(KEY_TRANSCODE, RestApiCallDocumentation::Type_String, | |
1652 "Transcode to the provided DICOM transfer syntax before the actual sending", false) | |
1653 .SetRequestField(KEY_COMPRESS, RestApiCallDocumentation::Type_Boolean, | |
1654 "Whether to compress the DICOM instances using gzip before the actual sending", false) | |
1655 .SetUriArgument("id", "Identifier of the modality of interest"); | |
1656 return; | |
1657 } | |
1658 | |
1612 ServerContext& context = OrthancRestApi::GetContext(call); | 1659 ServerContext& context = OrthancRestApi::GetContext(call); |
1613 | 1660 |
1614 std::string remote = call.GetUriComponent("id", ""); | 1661 std::string remote = call.GetUriComponent("id", ""); |
1615 | 1662 |
1616 Json::Value request; | 1663 Json::Value request; |
1617 std::unique_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context)); | 1664 std::unique_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context)); |
1618 | 1665 |
1619 GetInstancesToExport(request, *job, remote, call); | 1666 GetInstancesToExport(request, *job, remote, call); |
1620 | 1667 |
1621 static const char* TRANSCODE = "Transcode"; | |
1622 if (request.type() == Json::objectValue && | 1668 if (request.type() == Json::objectValue && |
1623 request.isMember(TRANSCODE)) | 1669 request.isMember(KEY_TRANSCODE)) |
1624 { | 1670 { |
1625 job->SetTranscode(SerializationToolbox::ReadString(request, TRANSCODE)); | 1671 job->SetTranscode(SerializationToolbox::ReadString(request, KEY_TRANSCODE)); |
1626 } | 1672 } |
1627 | 1673 |
1628 static const char* COMPRESS = "Compress"; | |
1629 if (request.type() == Json::objectValue && | 1674 if (request.type() == Json::objectValue && |
1630 request.isMember(COMPRESS)) | 1675 request.isMember(KEY_COMPRESS)) |
1631 { | 1676 { |
1632 job->SetCompress(SerializationToolbox::ReadBoolean(request, COMPRESS)); | 1677 job->SetCompress(SerializationToolbox::ReadBoolean(request, KEY_COMPRESS)); |
1633 } | 1678 } |
1634 | 1679 |
1635 { | 1680 { |
1636 OrthancConfiguration::ReaderLock lock; | 1681 OrthancConfiguration::ReaderLock lock; |
1637 | 1682 |
2034 | 2079 |
2035 static void StorageCommitmentScu(RestApiPostCall& call) | 2080 static void StorageCommitmentScu(RestApiPostCall& call) |
2036 { | 2081 { |
2037 static const char* const ORTHANC_RESOURCES = "Resources"; | 2082 static const char* const ORTHANC_RESOURCES = "Resources"; |
2038 static const char* const DICOM_INSTANCES = "DicomInstances"; | 2083 static const char* const DICOM_INSTANCES = "DicomInstances"; |
2084 | |
2085 if (call.IsDocumentation()) | |
2086 { | |
2087 call.GetDocumentation() | |
2088 .SetTag("Networking") | |
2089 .SetSummary("Trigger storage commitment request") | |
2090 .SetDescription("Trigger a storage commitment request to some remote DICOM modality whose identifier is provided " | |
2091 "in the URL: https://book.orthanc-server.com/users/storage-commitment.html#storage-commitment-scu") | |
2092 .SetRequestField(ORTHANC_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings, | |
2093 "List of the Orthanc identifiers of the DICOM resources to be checked by storage commitment", true) | |
2094 .SetRequestField(DICOM_INSTANCES, RestApiCallDocumentation::Type_JsonListOfObjects, | |
2095 "List of DICOM resources that are not necessarily stored within Orthanc, but that must " | |
2096 "be checked by storage commitment. This is a list of JSON objects that must contain the " | |
2097 "`SOPClassUID` and `SOPInstanceUID` fields.", true) | |
2098 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject, | |
2099 "Identifier of the storage commitment report, to be used with `/storage-commitment/{id}`") | |
2100 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject, | |
2101 "Root path to the storage commitment report in the REST API") | |
2102 .SetUriArgument("id", "Identifier of the modality of interest"); | |
2103 return; | |
2104 } | |
2039 | 2105 |
2040 ServerContext& context = OrthancRestApi::GetContext(call); | 2106 ServerContext& context = OrthancRestApi::GetContext(call); |
2041 | 2107 |
2042 Json::Value json; | 2108 Json::Value json; |
2043 if (!call.ParseJsonRequest(json) || | 2109 if (!call.ParseJsonRequest(json) || |
2200 } | 2266 } |
2201 | 2267 |
2202 | 2268 |
2203 static void GetStorageCommitmentReport(RestApiGetCall& call) | 2269 static void GetStorageCommitmentReport(RestApiGetCall& call) |
2204 { | 2270 { |
2271 if (call.IsDocumentation()) | |
2272 { | |
2273 call.GetDocumentation() | |
2274 .SetTag("Networking") | |
2275 .SetSummary("Get storage commitment report") | |
2276 .SetDescription("Get the storage commitment report whose identifier is provided in the URL: " | |
2277 "https://book.orthanc-server.com/users/storage-commitment.html#storage-commitment-scu") | |
2278 .SetAnswerField("Status", RestApiCallDocumentation::Type_String, | |
2279 "Can be `Success`, `Failure`, or `Pending` (the latter means that no report has been received yet)") | |
2280 .SetAnswerField("RemoteAET", RestApiCallDocumentation::Type_String, | |
2281 "AET of the remote DICOM modality") | |
2282 .SetAnswerField("Failures", RestApiCallDocumentation::Type_JsonListOfObjects, | |
2283 "List of failures that have been encountered during the storage commitment request") | |
2284 .SetAnswerField("Success", RestApiCallDocumentation::Type_JsonListOfObjects, | |
2285 "List of DICOM instances that have been acknowledged by the remote modality, " | |
2286 "each one is reported as a JSON object containing the `SOPClassUID` and " | |
2287 "`SOPInstanceUID` DICOM tags") | |
2288 .SetUriArgument("id", "Identifier of the storage commitment report"); | |
2289 return; | |
2290 } | |
2291 | |
2205 ServerContext& context = OrthancRestApi::GetContext(call); | 2292 ServerContext& context = OrthancRestApi::GetContext(call); |
2206 | 2293 |
2207 const std::string& transactionUid = call.GetUriComponent("id", ""); | 2294 const std::string& transactionUid = call.GetUriComponent("id", ""); |
2208 | 2295 |
2209 { | 2296 { |
2225 } | 2312 } |
2226 | 2313 |
2227 | 2314 |
2228 static void RemoveAfterStorageCommitment(RestApiPostCall& call) | 2315 static void RemoveAfterStorageCommitment(RestApiPostCall& call) |
2229 { | 2316 { |
2317 if (call.IsDocumentation()) | |
2318 { | |
2319 call.GetDocumentation() | |
2320 .SetTag("Networking") | |
2321 .SetSummary("Remove after storage commitment") | |
2322 .SetDescription("Remove out of Orthanc, the DICOM instances that have been reported to have been properly " | |
2323 "received the storage commitment report whose identifier is provided in the URL. This is " | |
2324 "only possible if the `Status` of the storage commitment report is `Success`. " | |
2325 "https://book.orthanc-server.com/users/storage-commitment.html#removing-the-instances") | |
2326 .SetUriArgument("id", "Identifier of the storage commitment report"); | |
2327 return; | |
2328 } | |
2329 | |
2230 ServerContext& context = OrthancRestApi::GetContext(call); | 2330 ServerContext& context = OrthancRestApi::GetContext(call); |
2231 | 2331 |
2232 const std::string& transactionUid = call.GetUriComponent("id", ""); | 2332 const std::string& transactionUid = call.GetUriComponent("id", ""); |
2233 | 2333 |
2234 { | 2334 { |