]> Creatis software - gdcm.git/commitdiff
We don't switch any longer to ImplicitVR when undocumented DataElement is found
authorjpr <jpr>
Tue, 24 Jul 2007 16:17:04 +0000 (16:17 +0000)
committerjpr <jpr>
Tue, 24 Jul 2007 16:17:04 +0000 (16:17 +0000)
(DocEntry::WriteContent puts vr="UN" for undocumented Shadow)

src/gdcmDocEntry.cxx
src/gdcmFileHelper.cxx

index 3a0ec998f8f741813d117ba2fc27f87b0cf06c5c..2466076dae15f362087efe6ae42b4e57baa7c158 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/05/23 14:18:09 $
-  Version:   $Revision: 1.88 $
+  Date:      $Date: 2007/07/24 16:17:04 $
+  Version:   $Revision: 1.89 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -125,14 +125,25 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype)
       uint16_t zero = 0;
       uint16_t shortLgr = (uint16_t)lgth;
 
+/*
       if( IsVRUnknown() )
-      {
+      { 
          // GDCM_VRUNKNOWN was stored in the Entry VR;
          // deal with Entry as if TS were Implicit VR
          binary_write(*fp, lgth);
       }
       else
+*/
+      if( IsVRUnknown() )  
       {
+      // if VR was not set, we set it to "UN"
+      // (FileHelper::Write has no longer to switch to ImplicitVR 
+      // when undocumented VR DataElements exist!)
+         SetVR("UN");
+         vr=GetVR();
+      }      
+     
+      //{
          binary_write(*fp, vr.str());
          // See PS 3.5-2004 page 33, 36                  
          if ( (vr == "SQ") || (vr == "OB") || (vr == "OW") || (vr == "OF") 
@@ -160,7 +171,7 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype)
          {
             binary_write(*fp, shortLgr);
          }
-      }
+      //}
    } 
    else // IMPLICIT VR 
    { 
index 32f79cb6e55e59fba9026f2684aac1d8027bea88..d652eba776a8407dc2fcac49aea83e7a72103938 100644 (file)
@@ -4,8 +4,8 @@
   Module:    $RCSfile: gdcmFileHelper.cxx,v $
   Language:  C++
 
-  Date:      $Date: 2007/07/13 08:17:21 $
-  Version:   $Revision: 1.117 $
+  Date:      $Date: 2007/07/24 16:17:04 $
+  Version:   $Revision: 1.118 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -728,13 +728,15 @@ bool FileHelper::Write(std::string const &fileName)
    // Let's just *dream* about it; *never* trust a user !
    // We turn to Implicit VR if at least the VR of one element is unknown.
    
-   /// \TODO : better we put vr=UN for undocumented Shadow Groups !
+   // Better we let DocEntry::WriteContent to put vr=UN for undocumented Shadow Groups !
+
+/*
          e = FileInternal->GetFirstEntry();
          while (e != 0)
          {
             if (e->GetVR() == "  ")  
             {
+
                SetWriteTypeToDcmImplVR();
                SetWriteFileTypeToImplicitVR();
                flag = true;
@@ -748,8 +750,10 @@ bool FileHelper::Write(std::string const &fileName)
             SetWriteFileTypeToExplicitVR();
          }
          break;
+*/
+
+         SetWriteFileTypeToExplicitVR();
 
-         SetWriteFileTypeToExplicitVR(); // to see JPRx
   break;
       case ACR:
       case ACR_LIBIDO: