comparison Core/DicomNetworking/DicomControlUserConnection.cpp @ 3875:ea1d32861cfc transcoding

moving timeout from DicomAssocation to DicomAssociationParameters
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 May 2020 14:49:31 +0200
parents 2effa961f67f
children cb801e5b4411
comparison
equal deleted inserted replaced
3874:2effa961f67f 3875:ea1d32861cfc
255 int presID = ASC_findAcceptedPresentationContextID( 255 int presID = ASC_findAcceptedPresentationContextID(
256 &association_->GetDcmtkAssociation(), sopClass); 256 &association_->GetDcmtkAssociation(), sopClass);
257 if (presID == 0) 257 if (presID == 0)
258 { 258 {
259 throw OrthancException(ErrorCode_DicomFindUnavailable, 259 throw OrthancException(ErrorCode_DicomFindUnavailable,
260 "Remote AET is " + parameters_.GetRemoteApplicationEntityTitle()); 260 "Remote AET is " + parameters_.GetRemoteModality().GetApplicationEntityTitle());
261 } 261 }
262 262
263 T_DIMSE_C_FindRQ request; 263 T_DIMSE_C_FindRQ request;
264 memset(&request, 0, sizeof(request)); 264 memset(&request, 0, sizeof(request));
265 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++; 265 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++;
307 if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess) 307 if (response.DimseStatus == STATUS_FIND_Failed_UnableToProcess)
308 { 308 {
309 throw OrthancException(ErrorCode_NetworkProtocol, 309 throw OrthancException(ErrorCode_NetworkProtocol,
310 HttpStatus_422_UnprocessableEntity, 310 HttpStatus_422_UnprocessableEntity,
311 "C-FIND SCU to AET \"" + 311 "C-FIND SCU to AET \"" +
312 parameters_.GetRemoteApplicationEntityTitle() + 312 parameters_.GetRemoteModality().GetApplicationEntityTitle() +
313 "\" has failed with DIMSE status 0x" + buf + 313 "\" has failed with DIMSE status 0x" + buf +
314 " (unable to process - invalid query ?)"); 314 " (unable to process - invalid query ?)");
315 } 315 }
316 else 316 else
317 { 317 {
318 throw OrthancException(ErrorCode_NetworkProtocol, "C-FIND SCU to AET \"" + 318 throw OrthancException(ErrorCode_NetworkProtocol, "C-FIND SCU to AET \"" +
319 parameters_.GetRemoteApplicationEntityTitle() + 319 parameters_.GetRemoteModality().GetApplicationEntityTitle() +
320 "\" has failed with DIMSE status 0x" + buf); 320 "\" has failed with DIMSE status 0x" + buf);
321 } 321 }
322 } 322 }
323 } 323 }
324 324
329 { 329 {
330 assert(association_.get() != NULL); 330 assert(association_.get() != NULL);
331 association_->Open(parameters_); 331 association_->Open(parameters_);
332 332
333 std::unique_ptr<ParsedDicomFile> query( 333 std::unique_ptr<ParsedDicomFile> query(
334 ConvertQueryFields(fields, parameters_.GetRemoteManufacturer())); 334 ConvertQueryFields(fields, parameters_.GetRemoteModality().GetManufacturer()));
335 DcmDataset* dataset = query->GetDcmtkObject().getDataset(); 335 DcmDataset* dataset = query->GetDcmtkObject().getDataset();
336 336
337 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; 337 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel;
338 switch (level) 338 switch (level)
339 { 339 {
360 // Figure out which of the accepted presentation contexts should be used 360 // Figure out which of the accepted presentation contexts should be used
361 int presID = ASC_findAcceptedPresentationContextID(&association_->GetDcmtkAssociation(), sopClass); 361 int presID = ASC_findAcceptedPresentationContextID(&association_->GetDcmtkAssociation(), sopClass);
362 if (presID == 0) 362 if (presID == 0)
363 { 363 {
364 throw OrthancException(ErrorCode_DicomMoveUnavailable, 364 throw OrthancException(ErrorCode_DicomMoveUnavailable,
365 "Remote AET is " + parameters_.GetRemoteApplicationEntityTitle()); 365 "Remote AET is " + parameters_.GetRemoteModality().GetApplicationEntityTitle());
366 } 366 }
367 367
368 T_DIMSE_C_MoveRQ request; 368 T_DIMSE_C_MoveRQ request;
369 memset(&request, 0, sizeof(request)); 369 memset(&request, 0, sizeof(request));
370 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++; 370 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++;
410 if (response.DimseStatus == STATUS_MOVE_Failed_UnableToProcess) 410 if (response.DimseStatus == STATUS_MOVE_Failed_UnableToProcess)
411 { 411 {
412 throw OrthancException(ErrorCode_NetworkProtocol, 412 throw OrthancException(ErrorCode_NetworkProtocol,
413 HttpStatus_422_UnprocessableEntity, 413 HttpStatus_422_UnprocessableEntity,
414 "C-MOVE SCU to AET \"" + 414 "C-MOVE SCU to AET \"" +
415 parameters_.GetRemoteApplicationEntityTitle() + 415 parameters_.GetRemoteModality().GetApplicationEntityTitle() +
416 "\" has failed with DIMSE status 0x" + buf + 416 "\" has failed with DIMSE status 0x" + buf +
417 " (unable to process - resource not found ?)"); 417 " (unable to process - resource not found ?)");
418 } 418 }
419 else 419 else
420 { 420 {
421 throw OrthancException(ErrorCode_NetworkProtocol, "C-MOVE SCU to AET \"" + 421 throw OrthancException(ErrorCode_NetworkProtocol, "C-MOVE SCU to AET \"" +
422 parameters_.GetRemoteApplicationEntityTitle() + 422 parameters_.GetRemoteModality().GetApplicationEntityTitle() +
423 "\" has failed with DIMSE status 0x" + buf); 423 "\" has failed with DIMSE status 0x" + buf);
424 } 424 }
425 } 425 }
426 } 426 }
427 427
468 468
469 if (normalize) 469 if (normalize)
470 { 470 {
471 DicomMap fields; 471 DicomMap fields;
472 NormalizeFindQuery(fields, level, originalFields); 472 NormalizeFindQuery(fields, level, originalFields);
473 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteManufacturer())); 473 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteModality().GetManufacturer()));
474 } 474 }
475 else 475 else
476 { 476 {
477 query.reset(new ParsedDicomFile(originalFields, 477 query.reset(new ParsedDicomFile(originalFields,
478 GetDefaultDicomEncoding(), 478 GetDefaultDicomEncoding(),
514 throw OrthancException(ErrorCode_ParameterOutOfRange); 514 throw OrthancException(ErrorCode_ParameterOutOfRange);
515 } 515 }
516 516
517 517
518 const char* universal; 518 const char* universal;
519 if (parameters_.GetRemoteManufacturer() == ModalityManufacturer_GE) 519 if (parameters_.GetRemoteModality().GetManufacturer() == ModalityManufacturer_GE)
520 { 520 {
521 universal = "*"; 521 universal = "*";
522 } 522 }
523 else 523 else
524 { 524 {
658 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false); 658 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
659 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false); 659 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false);
660 MoveInternal(targetAet, ResourceType_Instance, query); 660 MoveInternal(targetAet, ResourceType_Instance, query);
661 } 661 }
662 662
663 void DicomControlUserConnection::SetTimeout(uint32_t seconds)
664 {
665 parameters_.SetTimeout(seconds);
666 }
667 663
668 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result, 664 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result,
669 ParsedDicomFile& query) 665 ParsedDicomFile& query)
670 { 666 {
671 DcmDataset* dataset = query.GetDcmtkObject().getDataset(); 667 DcmDataset* dataset = query.GetDcmtkObject().getDataset();