diff 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
line wrap: on
line diff
--- a/UnitTestsSources/FromDcmtkTests.cpp	Mon May 04 19:17:07 2020 +0200
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Mon May 04 22:10:55 2020 +0200
@@ -2875,11 +2875,27 @@
                           const std::string& sopClassUid,
                           DicomTransferSyntax transferSyntax)
 {
-  uint8_t id;
-      
-  if (scu.NegotiatePresentationContext(id, sopClassUid, transferSyntax))
+  std::set<DicomTransferSyntax> accepted;
+
+  if (!scu.LookupTranscoding(accepted, sopClassUid, transferSyntax))
+  {
+    throw OrthancException(ErrorCode_NetworkProtocol,
+                           "The SOP class is not supported by the remote modality");
+  }
+
   {
-    printf("**** OK, without transcoding !! %d\n", id);
+    unsigned int count = 0;
+    for (std::set<DicomTransferSyntax>::const_iterator
+           it = accepted.begin(); it != accepted.end(); ++it)
+    {
+      LOG(INFO) << "available for transcoding " << (count++) << ": " << sopClassUid
+                << " / " << GetTransferSyntaxUid(*it);
+    }
+  }
+  
+  if (accepted.find(transferSyntax) != accepted.end())
+  {
+    printf("**** OK, without transcoding !! [%s]\n", GetTransferSyntaxUid(transferSyntax));
   }
   else
   {
@@ -2894,10 +2910,9 @@
     bool found = false;
     for (size_t i = 0; i < 3; i++)
     {
-      if (scu.LookupPresentationContext(id, sopClassUid, uncompressed[i]))
+      if (accepted.find(uncompressed[i]) != accepted.end())
       {
-        printf("**** TRANSCODING to %s => %d\n",
-               GetTransferSyntaxUid(uncompressed[i]), id);
+        printf("**** TRANSCODING to %s\n", GetTransferSyntaxUid(uncompressed[i]));
         found = true;
         break;
       }
@@ -2924,9 +2939,11 @@
   //assoc.RegisterStorageClass(UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit);
 
   //assoc.SetUncompressedSyntaxesProposed(false);  // Necessary for transcoding
-  //assoc.SetCommonClassesProposed(false);
+  assoc.SetCommonClassesProposed(false);
+  assoc.SetRetiredBigEndianProposed(true);
+  TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit);
   TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_JPEG2000);
-  TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_LittleEndianExplicit);
+  TestTranscode(assoc, UID_MRImageStorage, DicomTransferSyntax_JPEG2000);
 }