changeset 3812:abd3a1d114c0 transcoding

transcoding to 1.2.840.10008.1.2.4.51
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Apr 2020 13:54:57 +0200
parents 890af7156f19
children aaaa442bfe39
files UnitTestsSources/FromDcmtkTests.cpp
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/UnitTestsSources/FromDcmtkTests.cpp	Tue Apr 07 08:40:30 2020 +0200
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Tue Apr 07 13:54:57 2020 +0200
@@ -2133,10 +2133,18 @@
       }
       else if (syntaxes.find(DicomTransferSyntax_JPEGProcess1) != syntaxes.end() &&
                allowNewSopInstanceUid &&
+               GetBitsStored() == 8 &&
                FromDcmtkBridge::Transcode(target, *dicom_, DicomTransferSyntax_JPEGProcess1, &rpLossy))
       {
         return true;
       }
+      else if (syntaxes.find(DicomTransferSyntax_JPEGProcess2_4) != syntaxes.end() &&
+               allowNewSopInstanceUid &&
+               GetBitsStored() <= 12 &&
+               FromDcmtkBridge::Transcode(target, *dicom_, DicomTransferSyntax_JPEGProcess2_4, &rpLossy))
+      {
+        return true;
+      }
       else
       {
         return false;
@@ -2234,8 +2242,8 @@
 
   Orthanc::DcmtkTranscoder transcoder(s.c_str(), s.size());
 
-  if (transcoder.GetBitsStored() != 8)  // TODO
-    return; 
+  /*if (transcoder.GetBitsStored() != 8)  // TODO
+    return; */
 
   {
     char buf[1024];
@@ -2272,10 +2280,11 @@
 
   {
     std::set<DicomTransferSyntax> syntaxes;
-    syntaxes.insert(DicomTransferSyntax_JPEGProcess1);
+    syntaxes.insert(DicomTransferSyntax_JPEGProcess2_4);
+    //syntaxes.insert(DicomTransferSyntax_LittleEndianExplicit);
 
     std::string t;
-    bool ok = transcoder.Transcode(t, syntaxes, false);
+    bool ok = transcoder.Transcode(t, syntaxes, true);
     printf("Transcoding: %d\n", ok);
 
     if (ok)
@@ -2337,7 +2346,7 @@
     SystemToolbox::WriteFile(t, "target.dcm");
   }
 
-  if (0)
+  if (1)
   {
     const char* const PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes";
     
@@ -2357,7 +2366,7 @@
     TestFile("/home/jodogne/Subversion/orthanc-tests/Database/Issue44/Monochrome1-Jpeg.dcm");
   }
 
-  if (1)
+  if (0)
   {
     TestFile("/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/1.2.840.10008.1.2.1.dcm");
   }