Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 3880:cdd0cb5ec4e4 transcoding
DicomStoreUserConnection::LookupTranscoding()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 May 2020 22:10:55 +0200 |
parents | b40dfa6dc8da |
children | 904575738462 |
comparison
equal
deleted
inserted
replaced
3879:a18b34dec94a | 3880:cdd0cb5ec4e4 |
---|---|
2873 | 2873 |
2874 static void TestTranscode(DicomStoreUserConnection& scu, | 2874 static void TestTranscode(DicomStoreUserConnection& scu, |
2875 const std::string& sopClassUid, | 2875 const std::string& sopClassUid, |
2876 DicomTransferSyntax transferSyntax) | 2876 DicomTransferSyntax transferSyntax) |
2877 { | 2877 { |
2878 uint8_t id; | 2878 std::set<DicomTransferSyntax> accepted; |
2879 | 2879 |
2880 if (scu.NegotiatePresentationContext(id, sopClassUid, transferSyntax)) | 2880 if (!scu.LookupTranscoding(accepted, sopClassUid, transferSyntax)) |
2881 { | 2881 { |
2882 printf("**** OK, without transcoding !! %d\n", id); | 2882 throw OrthancException(ErrorCode_NetworkProtocol, |
2883 "The SOP class is not supported by the remote modality"); | |
2884 } | |
2885 | |
2886 { | |
2887 unsigned int count = 0; | |
2888 for (std::set<DicomTransferSyntax>::const_iterator | |
2889 it = accepted.begin(); it != accepted.end(); ++it) | |
2890 { | |
2891 LOG(INFO) << "available for transcoding " << (count++) << ": " << sopClassUid | |
2892 << " / " << GetTransferSyntaxUid(*it); | |
2893 } | |
2894 } | |
2895 | |
2896 if (accepted.find(transferSyntax) != accepted.end()) | |
2897 { | |
2898 printf("**** OK, without transcoding !! [%s]\n", GetTransferSyntaxUid(transferSyntax)); | |
2883 } | 2899 } |
2884 else | 2900 else |
2885 { | 2901 { |
2886 // Transcoding - only in Orthanc >= 1.7.0 | 2902 // Transcoding - only in Orthanc >= 1.7.0 |
2887 | 2903 |
2892 }; | 2908 }; |
2893 | 2909 |
2894 bool found = false; | 2910 bool found = false; |
2895 for (size_t i = 0; i < 3; i++) | 2911 for (size_t i = 0; i < 3; i++) |
2896 { | 2912 { |
2897 if (scu.LookupPresentationContext(id, sopClassUid, uncompressed[i])) | 2913 if (accepted.find(uncompressed[i]) != accepted.end()) |
2898 { | 2914 { |
2899 printf("**** TRANSCODING to %s => %d\n", | 2915 printf("**** TRANSCODING to %s\n", GetTransferSyntaxUid(uncompressed[i])); |
2900 GetTransferSyntaxUid(uncompressed[i]), id); | |
2901 found = true; | 2916 found = true; |
2902 break; | 2917 break; |
2903 } | 2918 } |
2904 } | 2919 } |
2905 | 2920 |
2922 assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_JPEGProcess1); | 2937 assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_JPEGProcess1); |
2923 assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_JPEGProcess2_4); | 2938 assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_JPEGProcess2_4); |
2924 //assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit); | 2939 //assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit); |
2925 | 2940 |
2926 //assoc.SetUncompressedSyntaxesProposed(false); // Necessary for transcoding | 2941 //assoc.SetUncompressedSyntaxesProposed(false); // Necessary for transcoding |
2927 //assoc.SetCommonClassesProposed(false); | 2942 assoc.SetCommonClassesProposed(false); |
2943 assoc.SetRetiredBigEndianProposed(true); | |
2944 TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit); | |
2928 TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_JPEG2000); | 2945 TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_JPEG2000); |
2929 TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit); | 2946 TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_JPEG2000); |
2930 } | 2947 } |
2931 | 2948 |
2932 | 2949 |
2933 TEST(Toto, DISABLED_Store2) | 2950 TEST(Toto, DISABLED_Store2) |
2934 { | 2951 { |