comparison Core/DicomNetworking/DicomControlUserConnection.cpp @ 3896:210af28c4087 transcoding

merge
author Alain Mazy <alain@mazy.be>
date Thu, 07 May 2020 11:32:15 +0200
parents ea1d32861cfc
children cb801e5b4411
comparison
equal deleted inserted replaced
3895:37cf1889667a 3896:210af28c4087
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
428 428
429 DicomControlUserConnection::DicomControlUserConnection(const DicomAssociationParameters& params) : 429 DicomControlUserConnection::DicomControlUserConnection(const DicomAssociationParameters& params) :
430 parameters_(params), 430 parameters_(params),
431 association_(new DicomAssociation)
432 {
433 SetupPresentationContexts();
434 }
435
436
437 DicomControlUserConnection::DicomControlUserConnection(const std::string& localAet,
438 const RemoteModalityParameters& remote) :
439 parameters_(localAet, remote),
440 association_(new DicomAssociation) 431 association_(new DicomAssociation)
441 { 432 {
442 SetupPresentationContexts(); 433 SetupPresentationContexts();
443 } 434 }
444 435
477 468
478 if (normalize) 469 if (normalize)
479 { 470 {
480 DicomMap fields; 471 DicomMap fields;
481 NormalizeFindQuery(fields, level, originalFields); 472 NormalizeFindQuery(fields, level, originalFields);
482 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteManufacturer())); 473 query.reset(ConvertQueryFields(fields, parameters_.GetRemoteModality().GetManufacturer()));
483 } 474 }
484 else 475 else
485 { 476 {
486 query.reset(new ParsedDicomFile(originalFields, 477 query.reset(new ParsedDicomFile(originalFields,
487 GetDefaultDicomEncoding(), 478 GetDefaultDicomEncoding(),
523 throw OrthancException(ErrorCode_ParameterOutOfRange); 514 throw OrthancException(ErrorCode_ParameterOutOfRange);
524 } 515 }
525 516
526 517
527 const char* universal; 518 const char* universal;
528 if (parameters_.GetRemoteManufacturer() == ModalityManufacturer_GE) 519 if (parameters_.GetRemoteModality().GetManufacturer() == ModalityManufacturer_GE)
529 { 520 {
530 universal = "*"; 521 universal = "*";
531 } 522 }
532 else 523 else
533 { 524 {
667 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false); 658 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
668 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false); 659 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false);
669 MoveInternal(targetAet, ResourceType_Instance, query); 660 MoveInternal(targetAet, ResourceType_Instance, query);
670 } 661 }
671 662
672 void DicomControlUserConnection::SetTimeout(uint32_t seconds)
673 {
674 parameters_.SetTimeout(seconds);
675 }
676 663
677 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result, 664 void DicomControlUserConnection::FindWorklist(DicomFindAnswers& result,
678 ParsedDicomFile& query) 665 ParsedDicomFile& query)
679 { 666 {
680 DcmDataset* dataset = query.GetDcmtkObject().getDataset(); 667 DcmDataset* dataset = query.GetDcmtkObject().getDataset();