]> Creatis software - gdcm.git/commitdiff
* Fix bug when reading the DicomVR.dic file
authorregrain <regrain>
Fri, 21 Oct 2005 08:28:01 +0000 (08:28 +0000)
committerregrain <regrain>
Fri, 21 Oct 2005 08:28:01 +0000 (08:28 +0000)
   -- BeNours

Dicts/dicomVR.dic
Testing/TestVR.cxx
src/gdcmVR.cxx

index 6a1f2277aa2ddd2f4a3fd0afd7552dcb812a044e..7e30c6e7eb8fb7b042598144d5043b70c9f0028c 100644 (file)
@@ -24,4 +24,3 @@ UL Unsigned Long;         // Exactly 4 bytes
 UN Unknown;               // Any length of bytes
 US Unsigned Short;        // Exactly 2 bytes
 UT Unlimited Text;        // At most 2^32 -1 chars
-
index c72f54219a41a11af67a47a0199063ec3a35d390..303ec22dfaa1f422bc38d3e20df6cd44c982ffef 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/20 15:05:15 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2005/10/21 08:28:02 $
+  Version:   $Revision: 1.10 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
                                                                                 
 =========================================================================*/
 #include "gdcmVR.h"
+#include "gdcmDebug.h"
 
 int TestVR(int , char *[])
 {
    int error = 0;
    gdcm::VR *vr = new gdcm::VR();
  
+   gdcm::Debug::DebugOn();
+
    // There should be 16 entries ...
    vr->Print( std::cout );
 
@@ -48,7 +51,7 @@ int TestVR(int , char *[])
    }
    if( vr->IsValidVR( "\000/" ) )
    {
-      std::cerr << "'\000/' is a valid VR" << std::endl;
+      std::cerr << "' /' is a valid VR" << std::endl;
       error++;
    }
    if( vr->IsValidVR( gdcm::GDCM_VRUNKNOWN ) )
index e091908658d13942c245198209e3c1fc331561d1..29670812080cf006d5e3f206499b53ef6862a1b9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmVR.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/20 14:45:11 $
-  Version:   $Revision: 1.44 $
+  Date:      $Date: 2005/10/21 08:28:03 $
+  Version:   $Revision: 1.45 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -23,6 +23,7 @@
 
 #include <fstream>
 #include <iostream>
+#include <string.h>
 
 namespace gdcm 
 {
@@ -42,7 +43,7 @@ VR::VR()
    std::ifstream from(filename.c_str());
    if ( !from )
    {
-      gdcmWarningMacro("Can't open dictionary" << filename.c_str());
+      gdcmWarningMacro("Can't open dictionary " << filename.c_str());
       FillDefaultVRDict(vr);
    }
    else
@@ -55,6 +56,9 @@ VR::VR()
       {
          from >> std::ws;
          from.getline(buff, 1024, ' ');
+         if( strcmp(buff,"") == 0)
+            continue;
+
          key = buff;
          from >> std::ws;
          from.getline(buff, 1024, ';');
@@ -63,10 +67,7 @@ VR::VR()
          from >> std::ws;
          from.getline(buff, 1024, '\n');
    
-         if ( key != "" )
-         {
-            vr[key] = name;
-         }
+         vr[key] = name;
       }
       from.close();
    }