Mercurial > hg > orthanc
comparison OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 1371:f528849ee9f7 query-retrieve
DICOM Query/Retrieve available from Orthanc Explorer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 27 May 2015 17:33:13 +0200 |
parents | b22ba8c5edbe |
children | d710ea64f0fd |
comparison
equal
deleted
inserted
replaced
1370:7b6f5115607f | 1371:f528849ee9f7 |
---|---|
397 | 397 |
398 default: | 398 default: |
399 throw OrthancException(ErrorCode_InternalError); | 399 throw OrthancException(ErrorCode_InternalError); |
400 } | 400 } |
401 | 401 |
402 if (level == ResourceType_Study) | |
403 { | |
404 allowedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY); | |
405 } | |
406 | |
407 allowedTags.insert(DICOM_TAG_SPECIFIC_CHARACTER_SET); | |
408 | |
402 DicomArray query(fields); | 409 DicomArray query(fields); |
403 for (size_t i = 0; i < query.GetSize(); i++) | 410 for (size_t i = 0; i < query.GetSize(); i++) |
404 { | 411 { |
405 const DicomTag& tag = query.GetElement(i).GetTag(); | 412 const DicomTag& tag = query.GetElement(i).GetTag(); |
406 if (allowedTags.find(tag) == allowedTags.end()) | 413 if (allowedTags.find(tag) == allowedTags.end()) |
531 Check(cond); | 538 Check(cond); |
532 } | 539 } |
533 | 540 |
534 | 541 |
535 void DicomUserConnection::MoveInternal(const std::string& targetAet, | 542 void DicomUserConnection::MoveInternal(const std::string& targetAet, |
543 ResourceType level, | |
536 const DicomMap& fields) | 544 const DicomMap& fields) |
537 { | 545 { |
538 CheckIsOpen(); | 546 CheckIsOpen(); |
539 | 547 |
540 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; | 548 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel; |
541 std::auto_ptr<DcmDataset> dataset(ToDcmtkBridge::Convert(fields)); | 549 std::auto_ptr<DcmDataset> dataset(ToDcmtkBridge::Convert(fields)); |
550 | |
551 switch (level) | |
552 { | |
553 case ResourceType_Patient: | |
554 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "PATIENT"); | |
555 break; | |
556 | |
557 case ResourceType_Study: | |
558 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "STUDY"); | |
559 break; | |
560 | |
561 case ResourceType_Series: | |
562 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "SERIES"); | |
563 break; | |
564 | |
565 case ResourceType_Instance: | |
566 if (manufacturer_ == ModalityManufacturer_ClearCanvas || | |
567 manufacturer_ == ModalityManufacturer_Dcm4Chee) | |
568 { | |
569 // This is a particular case for ClearCanvas, thanks to Peter Somlo <peter.somlo@gmail.com>. | |
570 // https://groups.google.com/d/msg/orthanc-users/j-6C3MAVwiw/iolB9hclom8J | |
571 // http://www.clearcanvas.ca/Home/Community/OldForums/tabid/526/aff/11/aft/14670/afv/topic/Default.aspx | |
572 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "IMAGE"); | |
573 } | |
574 else | |
575 { | |
576 DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "INSTANCE"); | |
577 } | |
578 break; | |
579 | |
580 default: | |
581 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
582 } | |
542 | 583 |
543 // Figure out which of the accepted presentation contexts should be used | 584 // Figure out which of the accepted presentation contexts should be used |
544 int presID = ASC_findAcceptedPresentationContextID(pimpl_->assoc_, sopClass); | 585 int presID = ASC_findAcceptedPresentationContextID(pimpl_->assoc_, sopClass); |
545 if (presID == 0) | 586 if (presID == 0) |
546 { | 587 { |
878 | 919 |
879 default: | 920 default: |
880 throw OrthancException(ErrorCode_InternalError); | 921 throw OrthancException(ErrorCode_InternalError); |
881 } | 922 } |
882 | 923 |
883 MoveInternal(targetAet, move); | 924 MoveInternal(targetAet, level, move); |
884 } | 925 } |
885 | 926 |
886 | 927 |
887 void DicomUserConnection::MovePatient(const std::string& targetAet, | 928 void DicomUserConnection::MovePatient(const std::string& targetAet, |
888 const std::string& patientId) | 929 const std::string& patientId) |
889 { | 930 { |
890 DicomMap query; | 931 DicomMap query; |
891 query.SetValue(DICOM_TAG_PATIENT_ID, patientId); | 932 query.SetValue(DICOM_TAG_PATIENT_ID, patientId); |
892 MoveInternal(targetAet, query); | 933 MoveInternal(targetAet, ResourceType_Patient, query); |
893 } | 934 } |
894 | 935 |
895 void DicomUserConnection::MoveStudy(const std::string& targetAet, | 936 void DicomUserConnection::MoveStudy(const std::string& targetAet, |
896 const std::string& studyUid) | 937 const std::string& studyUid) |
897 { | 938 { |
898 DicomMap query; | 939 DicomMap query; |
899 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); | 940 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); |
900 MoveInternal(targetAet, query); | 941 MoveInternal(targetAet, ResourceType_Study, query); |
901 } | 942 } |
902 | 943 |
903 void DicomUserConnection::MoveSeries(const std::string& targetAet, | 944 void DicomUserConnection::MoveSeries(const std::string& targetAet, |
904 const std::string& studyUid, | 945 const std::string& studyUid, |
905 const std::string& seriesUid) | 946 const std::string& seriesUid) |
906 { | 947 { |
907 DicomMap query; | 948 DicomMap query; |
908 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); | 949 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); |
909 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid); | 950 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid); |
910 MoveInternal(targetAet, query); | 951 MoveInternal(targetAet, ResourceType_Series, query); |
911 } | 952 } |
912 | 953 |
913 void DicomUserConnection::MoveInstance(const std::string& targetAet, | 954 void DicomUserConnection::MoveInstance(const std::string& targetAet, |
914 const std::string& studyUid, | 955 const std::string& studyUid, |
915 const std::string& seriesUid, | 956 const std::string& seriesUid, |
917 { | 958 { |
918 DicomMap query; | 959 DicomMap query; |
919 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); | 960 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid); |
920 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid); | 961 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid); |
921 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid); | 962 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid); |
922 MoveInternal(targetAet, query); | 963 MoveInternal(targetAet, ResourceType_Instance, query); |
923 } | 964 } |
924 | 965 |
925 | 966 |
926 void DicomUserConnection::SetTimeout(uint32_t seconds) | 967 void DicomUserConnection::SetTimeout(uint32_t seconds) |
927 { | 968 { |