comparison OrthancServer/OrthancInitialization.cpp @ 613:60d90e48e809 find-move-scp

query/retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Oct 2013 17:27:26 +0200
parents 1b2cdc855bd3
children a24b0161b171
comparison
equal deleted inserted replaced
612:fdd5f7f9c4d7 613:60d90e48e809
462 for (Json::Value::ArrayIndex i = 0; i < lst.size(); i++) 462 for (Json::Value::ArrayIndex i = 0; i < lst.size(); i++)
463 { 463 {
464 target.push_back(lst[i].asString()); 464 target.push_back(lst[i].asString());
465 } 465 }
466 } 466 }
467
468
469 void ConnectToModalityUsingSymbolicName(DicomUserConnection& connection,
470 const std::string& name)
471 {
472 std::string aet, address;
473 int port;
474 ModalityManufacturer manufacturer;
475 GetDicomModality(name, aet, address, port, manufacturer);
476
477 LOG(WARNING) << "Connecting to remote DICOM modality: AET=" << aet << ", address=" << address << ", port=" << port;
478
479 connection.SetLocalApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC"));
480 connection.SetDistantApplicationEntityTitle(aet);
481 connection.SetDistantHost(address);
482 connection.SetDistantPort(port);
483 connection.SetDistantManufacturer(manufacturer);
484 connection.Open();
485 }
486
487
488 void ConnectToModalityUsingAETitle(DicomUserConnection& connection,
489 const std::string& aet)
490 {
491 std::set<std::string> modalities;
492 GetListOfDicomModalities(modalities);
493
494 std::string address;
495 int port;
496 ModalityManufacturer manufacturer;
497 bool found = false;
498
499 for (std::set<std::string>::const_iterator
500 it = modalities.begin(); it != modalities.end(); it++)
501 {
502 try
503 {
504 std::string thisAet;
505 GetDicomModality(*it, thisAet, address, port, manufacturer);
506
507 if (aet == thisAet)
508 {
509 found = true;
510 break;
511 }
512 }
513 catch (OrthancException&)
514 {
515 }
516 }
517
518 if (!found)
519 {
520 throw OrthancException("Unknown modality: " + aet);
521 }
522
523 LOG(WARNING) << "Connecting to remote DICOM modality: AET=" << aet << ", address=" << address << ", port=" << port;
524
525 connection.SetLocalApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC"));
526 connection.SetDistantApplicationEntityTitle(aet);
527 connection.SetDistantHost(address);
528 connection.SetDistantPort(port);
529 connection.SetDistantManufacturer(manufacturer);
530 connection.Open();
531 }
467 } 532 }