comparison OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4517:c494ee5d0101

Added "Timeout" parameter everywhere in "/modalities/.../"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Feb 2021 15:27:25 +0100
parents d0581d0b22b8
children f8660649ae96
comparison
equal deleted inserted replaced
4516:671ee7c1fd46 4517:c494ee5d0101
673 "Whether to normalize the query, i.e. whether to wipe out from the query, the DICOM tags " 673 "Whether to normalize the query, i.e. whether to wipe out from the query, the DICOM tags "
674 "that are not applicable for the query-retrieve level of interest", false) 674 "that are not applicable for the query-retrieve level of interest", false)
675 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String, 675 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
676 "Local AET that is used for this commands, defaults to `DicomAet` configuration option. " 676 "Local AET that is used for this commands, defaults to `DicomAet` configuration option. "
677 "Ignored if `DicomModalities` already sets `LocalAet` for this modality.", false) 677 "Ignored if `DicomModalities` already sets `LocalAet` for this modality.", false)
678 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
679 "Timeout for the C-FIND command and subsequent C-MOVE retrievals, in seconds (new in Orthanc 1.9.1)", false)
678 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject, 680 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
679 "Identifier of the query, to be used with `/queries/{id}`") 681 "Identifier of the query, to be used with `/queries/{id}`")
680 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject, 682 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
681 "Root path to the query in the REST API"); 683 "Root path to the query in the REST API");
682 return; 684 return;
739 } 741 }
740 742
741 if (request.isMember(KEY_LOCAL_AET)) 743 if (request.isMember(KEY_LOCAL_AET))
742 { 744 {
743 handler->SetLocalAet(request[KEY_LOCAL_AET].asString()); 745 handler->SetLocalAet(request[KEY_LOCAL_AET].asString());
746 }
747
748 if (request.isMember(KEY_TIMEOUT))
749 {
750 // New in Orthanc 1.9.1
751 handler->SetTimeout(SerializationToolbox::ReadUnsignedInteger(request, KEY_TIMEOUT));
744 } 752 }
745 753
746 AnswerQueryHandler(call, handler); 754 AnswerQueryHandler(call, handler);
747 } 755 }
748 } 756 }
938 if (timeout >= 0) 946 if (timeout >= 0)
939 { 947 {
940 // New in Orthanc 1.7.0 948 // New in Orthanc 1.7.0
941 job->SetTimeout(static_cast<uint32_t>(timeout)); 949 job->SetTimeout(static_cast<uint32_t>(timeout));
942 } 950 }
951 else if (query.GetHandler().HasTimeout())
952 {
953 // New in Orthanc 1.9.1
954 job->SetTimeout(query.GetHandler().GetTimeout());
955 }
943 956
944 LOG(WARNING) << "Driving C-Move SCU on remote modality " 957 LOG(WARNING) << "Driving C-Move SCU on remote modality "
945 << query.GetHandler().GetRemoteModality().GetApplicationEntityTitle() 958 << query.GetHandler().GetRemoteModality().GetApplicationEntityTitle()
946 << " to target modality " << targetAet; 959 << " to target modality " << targetAet;
947 960
1177 " associated with one answer to some query/retrieve operation whose identifiers are provided in the URL") 1190 " associated with one answer to some query/retrieve operation whose identifiers are provided in the URL")
1178 .SetUriArgument("id", "Identifier of the query of interest") 1191 .SetUriArgument("id", "Identifier of the query of interest")
1179 .SetUriArgument("index", "Index of the answer") 1192 .SetUriArgument("index", "Index of the answer")
1180 .SetRequestField(KEY_QUERY, RestApiCallDocumentation::Type_JsonObject, 1193 .SetRequestField(KEY_QUERY, RestApiCallDocumentation::Type_JsonObject,
1181 "Associative array containing the filter on the values of the DICOM tags", true) 1194 "Associative array containing the filter on the values of the DICOM tags", true)
1195 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
1196 "Timeout for the C-FIND command, in seconds (new in Orthanc 1.9.1)", false)
1182 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject, 1197 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
1183 "Identifier of the query, to be used with `/queries/{id}`") 1198 "Identifier of the query, to be used with `/queries/{id}`")
1184 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject, 1199 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
1185 "Root path to the query in the REST API"); 1200 "Root path to the query in the REST API");
1186 return; 1201 return;
1227 else 1242 else
1228 { 1243 {
1229 handler->SetFindNormalized(parent.GetHandler().IsFindNormalized()); 1244 handler->SetFindNormalized(parent.GetHandler().IsFindNormalized());
1230 handler->SetModality(parent.GetHandler().GetModalitySymbolicName()); 1245 handler->SetModality(parent.GetHandler().GetModalitySymbolicName());
1231 handler->SetLevel(CHILDREN_LEVEL); 1246 handler->SetLevel(CHILDREN_LEVEL);
1247
1248 // New in Orthanc 1.9.1
1249 if (request.isMember(KEY_TIMEOUT))
1250 {
1251 handler->SetTimeout(SerializationToolbox::ReadUnsignedInteger(request, KEY_TIMEOUT));
1252 }
1253 else if (parent.GetHandler().HasTimeout())
1254 {
1255 handler->SetTimeout(parent.GetHandler().GetTimeout());
1256 }
1232 1257
1233 if (request.isMember(KEY_QUERY)) 1258 if (request.isMember(KEY_QUERY))
1234 { 1259 {
1235 std::map<DicomTag, std::string> query; 1260 std::map<DicomTag, std::string> query;
1236 SerializationToolbox::ReadMapOfTags(query, request, KEY_QUERY); 1261 SerializationToolbox::ReadMapOfTags(query, request, KEY_QUERY);
2113 "List of the Orthanc identifiers of the DICOM resources to be checked by storage commitment", true) 2138 "List of the Orthanc identifiers of the DICOM resources to be checked by storage commitment", true)
2114 .SetRequestField(DICOM_INSTANCES, RestApiCallDocumentation::Type_JsonListOfObjects, 2139 .SetRequestField(DICOM_INSTANCES, RestApiCallDocumentation::Type_JsonListOfObjects,
2115 "List of DICOM resources that are not necessarily stored within Orthanc, but that must " 2140 "List of DICOM resources that are not necessarily stored within Orthanc, but that must "
2116 "be checked by storage commitment. This is a list of JSON objects that must contain the " 2141 "be checked by storage commitment. This is a list of JSON objects that must contain the "
2117 "`SOPClassUID` and `SOPInstanceUID` fields.", true) 2142 "`SOPClassUID` and `SOPInstanceUID` fields.", true)
2143 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
2144 "Timeout for the storage commitment command (new in Orthanc 1.9.1)", false)
2118 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject, 2145 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
2119 "Identifier of the storage commitment report, to be used with `/storage-commitment/{id}`") 2146 "Identifier of the storage commitment report, to be used with `/storage-commitment/{id}`")
2120 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject, 2147 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
2121 "Root path to the storage commitment report in the REST API") 2148 "Root path to the storage commitment report in the REST API")
2122 .SetUriArgument("id", "Identifier of the modality of interest"); 2149 .SetUriArgument("id", "Identifier of the modality of interest");
2270 // actual SCU call in order to avoid race conditions 2297 // actual SCU call in order to avoid race conditions
2271 context.GetStorageCommitmentReports().Store( 2298 context.GetStorageCommitmentReports().Store(
2272 transactionUid, new StorageCommitmentReports::Report(remoteAet)); 2299 transactionUid, new StorageCommitmentReports::Report(remoteAet));
2273 2300
2274 DicomAssociationParameters parameters(localAet, remote); 2301 DicomAssociationParameters parameters(localAet, remote);
2302 InjectAssociationTimeout(parameters, json);
2275 2303
2276 std::vector<std::string> a(sopClassUids.begin(), sopClassUids.end()); 2304 std::vector<std::string> a(sopClassUids.begin(), sopClassUids.end());
2277 std::vector<std::string> b(sopInstanceUids.begin(), sopInstanceUids.end()); 2305 std::vector<std::string> b(sopInstanceUids.begin(), sopInstanceUids.end());
2278 DicomAssociation::RequestStorageCommitment(parameters, transactionUid, a, b); 2306 DicomAssociation::RequestStorageCommitment(parameters, transactionUid, a, b);
2279 } 2307 }